Products returned from the Hello Retail product recommendation and search apis will contain links that have a tracking code appended to them in the fragment part of the url.
Example for search
Example for product recommendations
This tracking code allows the Hello Retail script to track clicks on products in search and recoms. When the api’s are used by the Hello Retail script these tracking links will be used in the generated dom. But a click handler is implemented so that the actual url that the customer is sent to when clicking the link does not contain the tracking fragment.
If you use the api directly you can leave the tracking fragment on the product urls. This will allow the Hello Retail script to automatically track clicks on the product recommendations or search implemented using our api solution.
If you do not want to have the tracking fragment shown on the page the user lands on or the fragment does not work with your shop platform you can remove the fragment from the url. If you do this you will have to add a click handler to the products in your product recommendations or search. This click handler will make sure that click tracking is sent to Hello Retail even if the tracking fragment is not on the link. The click handler must set a cookie with the name “aw_source” and the value from the fragment in the tracking link. A bare bones implementation of this could look something like this:
<a href="https://shop.example.com/awesome-product.html" onclick="document.cookie='aw_source=pb-5cb4857e6ff3911d1c76ab6a';"> Awesome product </a>
You could consider implementing a click handler that finds the tracking fragment in the href attribute, sets it as a cookie and then navigates to the url without the tracking fragment.