Last active
December 29, 2021 12:58
-
-
Save vevgeniy85/22ef5c198d4003ac8b2ded04789e8e73 to your computer and use it in GitHub Desktop.
Add new snippet klaviyo-tracking.liquid, paste code and include snippet {% include 'klaviyo-tracking' %} to product.liquid template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
var _learnq = _learnq || []; | |
var item = { | |
Name: {{ product.title|json }}, | |
ProductID: {{ product.id|json }}, | |
Categories: {{ product.collections|map:'title'|json }}, | |
ImageURL: "https:{{ product.featured_image.src|img_url:'grande' }}", | |
URL: "{{ shop.secure_url }}{{ product.url }}", | |
Brand: {{ product.vendor|json }}, | |
Price: {{ product.price|money|json }}, | |
CompareAtPrice: {{ product.compare_at_price_max|money|json }} | |
}; | |
_learnq.push(['track', 'Viewed Product', item]); | |
_learnq.push(['trackViewedItem', { | |
Title: item.Name, | |
ItemId: item.ProductID, | |
Categories: item.Categories, | |
ImageUrl: item.ImageURL, | |
Url: item.URL, | |
Metadata: { | |
Brand: item.Brand, | |
Price: item.Price, | |
CompareAtPrice: item.CompareAtPrice | |
} | |
}]); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment