How to set up cart tracking
Allow Hello Retail to track cart content
First, you have to allow Hello Retail to track cart contents. This information is needed to send out personalized abandoned cart email notifications, as of Triggered emails, featuring the image, title, and price of the product the customer has left behind.
Hello Retail must be correctly installed on your website before you try to set up abandoned cart notifications.
Correctly installed means you have:
- supplied us with your product data by giving us the URL to your product feed or adding the Hello Retail product span. Find a guide here.
- provided us with conversion data by adding the Hello Retail conversion span. Find a guide here.
How can I do this?
You can do this by adding a span into the HTML of your webshop's pages. A span is a small piece of code that will allow Hello Retail to collect data about the contents of the cart every time a user views a page where the span is placed. Spans should always be in the body of your HTML (in between <body> and</body>).
This is how the span looks, using product URLs as a reference to the products in the cart:
<span class="addwish-cart" style="display:none" data-url="http://example.com/cart/id/789" data-total="150.50" data-email="firstname.lastname@example.org"> <span class="addwish-product" data-url="http://example.com/product/456.html"> </span> <span class="addwish-product" data-url="http://example.com/product/2234.html"> </span> </span>
This is how the span looks, using product numbers as a reference to the products in the cart:
<span class="addwish-cart" style="display:none" data-url="http://example.com/cart/id/789" data-total="150.50" data-email="email@example.com"> <span class="addwish-product" data-productnumber="p-456-2"> </span> <span class="addwish-product" data-productnumber="p-2234"> </span> </span>
The first and last span tags are called the root span. The other spans on the inside are called the inner spans (or product spans).
- The data-URL attribute in the first line of the span (root span) is optional. If you have a URL that will lead directly back to the cart, you can include it here. This will allow you to link directly back to the abandoned cart in your notifications.
- The data-total attribute in the root span is required. This should contain the total value of the visitor's cart. Please note: The total cart value amount should be formatted with a. (dot) as decimal separator.
- The data-email attribute in the root span is especially useful when tracking carts with the intent to send out abandoned cart emails. This is used to associate an already known email with the cart. This could be if the user is already logged in - then you can associate the user's email address with the current cart.
- Inside the root, a span is several product spans. There should be one of these for every product in the cart. If the cart is empty, there are no product spans. Hello Retail can see that the cart is empty because the root span will still be there.
- In each product span, you can choose to reference products in the cart either by URL or product number. If referencing the product URL, the data-URL attribute must contain the canonical URL for the product. If referencing the product number, the data-product number should be the product number.