Click tracking

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 Product Recommendations. When the APIs 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.

Tracking without using the fragment

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 ensure that click tracking is sent to Hello Retail even if the tracking fragment is not on the link. The click handler must call the function ADDWISH_PARTNER_NS.api.tracking.track_click with the value from the fragment as a parameter. A bare-bones implementation of this could look something like this:
<a href="" onclick="ADDWISH_PARTNER_NS.api.tracking.track_click('pb-5cb4857e6ff3911d1c76ab6a');">
Awesome product
You could consider implementing a click handler that finds the tracking fragment in the href attribute, calls the track_click() function, and then navigates to the URL without the tracking fragment.

Verify tracking

To verify that the click tracking works, you can click one of the links that should track clicks with the network tab open in the browser developer console. The Hello Retail JavaScript will request the URL. If tracking a search or product recommendation, clicking that request should include clickedProductBoxId or clickedPartnerSearchConfigKey with the value from the tracking fragment.