Setup Recommendations

Poduct recommendations can be deployed on any page in your store using javascript. Follow the below steps to get started.

Design your recommendations

Create the recommendation block that will be displayed on your store. This is a template design that is dynamically populated in realtime when your visitors browse your store. Make sure your recommendation block match the style of your store as well as possible. If you encounter any issues with the design, contact us for design help.

Deploy the tracker script

If not already implemented, make sure to include the header script for our tracker to each page that will serve recommendations. Follow this guide to setup your tracker script.

Deploy the recommendation block

Place your recommendation block anywhere on the page using the following tag.

<div id="my-recommendation-block"></div>

And put the following javascript code at the bottom of your page.

zlt.rec(pid, tid, "my-recommendation-block")

pid: A string of comma separated product ids. E.g. "1,2,3" tid: The id of the template you wish to display. E.g. "1"

The pid should contain the IDs of the currently viewed product and any product added to cart.

<!-- Example -->
<head>
...
<!-- Initiate the tracker -->
<script async src="https://assets.zubitracker.io/v1/tracker/js/zubitracker-v1.3.0.1.js" data-name="trackerjs" data-key ="[ADD YOUR TRACKER KEY]"></script>
<script type="text/javascript">window.zlt_queue||(window.zlt_queue=[]),window.zlt_queue2||(window.zlt_queue2=[]),window.zlt=function(){},window.zlt.rec=function(p,k,d){var u={p,k,d};window.zlt_queue2.push(u)},window.zlt.track=function(w,n){var u={};u[w]=n,window.zlt_queue.push(u)};</script>
</head>
<body>
...
<!-- Position the recommendation block -->
<div id="my-recommendation-block"></div>
...
<!-- Call the recommendation engine -->
<script type="text/javascript">
var pid = '1,2,3';
var tid = '1';
zlt.rec(pid, tid, "my-recommendation-block");
</script>
</body>

Remember to replace [ADD YOUR TRACKER KEY] with your tracker key.

Placement

We recommend that you position the recommendations as visible as possible on the product, cart and checkout pages. The position is vital for good recommendation performance.