Page tracking for SPA
If you are running your webshop as a Single Page Applications (SPA), the Hello Retail partner script is typically not reloaded automatically when a visitor is triggering a new page view. To ensure Hello Retail is picking up a new page view, you'll have to ensure to call the reload()
function available through the JavaScript SDK. This should happen every time a visitor navigates to a new page (the URL changes).
It is important that reload()
is called after the page navigation has happened, meaning that any new content we need has been injected, any DOM elements that we're tying, e.g., recommendations, are present, and the URL has been updated. The reload call will trigger a post-request to https://core.helloretail.com/partner/init.html.
Check the network log in your browser, and ensure that the URL value in the form data matches the new page. If it does not, view tracking will not work correctly, and recommendations would load for the wrong products.
// Trigger reload, to track a new page-view
ADDWISH_PARTNER_NS.api.reload()