Product 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.
1
<div data-id="1" id="my-recommendation-block"></div>
Copied!
And put the following javascript code at the bottom of your page.
1
zlt.rec(pid, "my-recommendation-block")
Copied!
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.
1
<!-- Example -->
2
<head>
3
...
4
<!-- Initiate the tracker -->
5
### FOLLOW THE GUIDE ABOVE TO DEPLOY THE TRACKER SCRIPT ###
6
</head>
7
<body>
8
...
9
<!-- Position the recommendation block -->
10
<div data-id="1" id="my-recommendation-block"></div>
11
...
12
<!-- Call the recommendation engine -->
13
<script type="text/javascript">
14
var pid = '1,2,3';
15
zlt.rec(pid, "my-recommendation-block");
16
</script>
17
</body>
Copied!
Remember to replace [ADD YOUR TRACKER KEY] with your tracker key.

Extended options

Attribute
Usage
data-id
Template, or block selection
Required
data-mid
Model Selection, overwrites block in data-id
Optional
data-mprods
Number of Prods to get for Mobile
Optional
data-mslide
Number of Slides to show on Mobile
Optional
data-prods
Number of Products to get for Desktop
Optional
data-slide
Number of slides to show on Desktop
Optional
data-variant
Define variant for A/B testing
Optional

Examples

1
...
2
<!-- Position the recommendation block -->
3
<div data-id="design-id" data-model="model-id" id="my-recommendation-block"></div>
4
...
5
6
OR
7
8
...
9
<!-- Position the recommendation block -->
10
<div data-id="block-id" id="my-recommendation-block"></div>
11
...
Copied!

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. Read more about it in our article on product recommendations.
Last modified 14d ago