Solved

Troubles with viewed product on CommerceHQ platform

  • 24 January 2021
  • 1 reply
  • 88 views

Badge +2

Hey guys, I believe I may be having difficulties with the browse abandonment trigger for one of my stores. When i go into the metrics it doesn’t show it tracks. However it does track the site abandonment. 

Just wondering if there is a particular snippet i would have to add in commerceHQ or if the same snippet applies.

Just so you know, my store was migrated from shopify to commerceHQ.

icon

Best answer by Paul S 28 January 2021, 21:47

View original

1 reply

Userlevel 5
Badge +10

Hi @Blythe_Adrian,

 

Not sure if you found a solution already but the snippet you would want to use if not already added for the Viewed Product metric is below.  

 

On your product page template, add a snippet like the following:

<script type="text/javascript">
var _learnq = _learnq || [];
var item = {
"ProductName": "Winnie the Pooh",
"ProductID": "1111",
"SKU": "WINNIEPOOH",
"Categories": ["Fiction", "Children"],
"ImageURL": "http://www.example.com/path/to/product/image.png",
"URL": "http://www.example.com/path/to/product",
"Brand": "Kids Books",
"Price": 9.99,
"CompareAtPrice": 14.99
};

_learnq.push(["track", "Viewed Product", item]);
</script>

You can additionally track the recently viewed item to a person’s profile under a “Recently Viewed Items” section by adding on the following snippet directly below the Viewed Product snippet above. For more information on how to use the “Recently Viewed Items”, check out this guide.

<script type="text/javascript">
_learnq.push(["trackViewedItem", {
"Title": item.ProductName,
"ItemId": item.ProductID,
"Categories": item.Categories,
"ImageUrl": item.ImageURL,
"Url": item.URL,
"Metadata": {
"Brand": item.Brand,
"Price": item.Price,
"CompareAtPrice": item.CompareAtPrice
}
}]);
</script>

Reply