Order of scraping
Generally this would not matter, but in some circumstances it can be very important.
For example, we can set the product.sku to the product.id as follows:
"to: {
"type": "var",
"value": "state.page.product.id"
}
To do this it is important to know the order of scraping:
- version
- config.storeDomain
- config.taxType
- config.trackingInterval
- config.sessionOfferPrefix
- config.currencyDecimalDefault
- config.currencyDecimalWidth
The page type is set and is one of the most important because different information is then scraped depending on this.
- page.type
We now get to see if there is a custom JS defined. If it is then the "pre" function is called. Note this is done after getting the page type so it can be easily overwritten here. Note that the custom transform must be set manually using the "setCustomTransform" function.
- config.useCustomJs
Then we set the currencies using default.
- cart.currency: set to default.currency
- order.currency: set to default.currency
If page.type is "cat" or "prod"
- page.category.name
- page.category.id
If page.type is "prod"
- page.product.name
- page.product.id
- page.product.sku
- page.product.price
- page.product.image
- page.product.url
if page.type is "cart". Note that "cart.action" is done both at the start and at the end.
- cart.action
- cart.gross
- cart.discount
- cart.discountCode
- cart.watchDiscountCodeInput
- cart.loop-item.product.name
- cart.loop-item.product.id
- cart.loop-item.product.sku
- cart.loop-item.product.quantity
- cart.loop-item.product.price
- cart.loop-item.product.image
- cart.loop-item.product.url
- cart.loop-item.product.category.id
- cart.loop0item.product.category.name
- cart.action
if page.type is "order"
- order.id
- order.number
- order.action
- order.gross
- order.discount
- order.discountCode
- order.shipping
- order.tax
- order.currency
- order.orderEmail
- order.customerFirstName
- order.customerLastName
- order.customerEmail
- order.customerId
Also note that quick cart, checkout cart and quick product views follow the same order. Also note that the "post" function of the custom transform is now called if it has been set.
- apply-to-cart