Setup for Tracking Requirements
This guide is part of a general setup guide for unsupported platforms. Find the main page for the full general guide here.
The script requires jQuery and will detect if it is available upon load.
If jQuery isn't available then our script will load it automatically.
So for shops already using jQuery you should make sure jQuery loads first, to avoid duplicates.
* Note that the #YOUR_PARTNER_ID part of the script above needs to be replaced by the unique partner id provided by the customer through the UI of the extension.
For SPA (Single page applications) you need to call the script's reload endpoint whenever essential page content changes — the most common would be when the URL changes.
The following method should be called after the new content is available in the DOM.
Conversion and cart tracking:
While the Hello Retail script takes care of most of the tracking on its own, it still needs a little help when it comes to conversion and cart tracking.
There is also an example of this being used if you go to the conversion tracking example in the documentation.
Conversion tracking specifics:
Conversions should be registered when an order is completed. Typically this will happen on the order receipt/confirmation page.
Cart tracking specifics:
The cart tracking needs to happen whenever a change is made to the cart, no matter what page the customer is on. For simplicity, you can also choose to just update the cart on every page load.
If a variant product has been purchased then the ProductData registered in the cart should be from that variant.
The cart span has an attribute called "cart-url" and the API function accepts a "url" key in its data object. This is used specifically for abandoned cart triggered emails so a link to restore each unique cart can be provided.
Usually, this is implemented through a cart restore endpoint in the extension which takes cart data as a parameter - it could look something like this: https://domain.com/cart/restore?x:y,x:y where x indicates the product id and y indicates the quantity.
Depending on the shop system it might be necessary to expand the format to accept variation or option ids as well.
Exactly how you chose to implement this feature is up to you as long as it works by requesting a URL with some parameters.