In need of some desperate help!
NOTE: - I’m using Shogun which i feel is making things a-lot harder than what it needs to be
I’m trying to set up Custom "Added to Cart" Event. I’m using the The "Added to Cart" Snippet Sid] to put into my Product.Liquid file. I’ve also got the Web Traffic Tracking code added above it.
I’ve tried to fire the snipped for each change i make by cooking my browser.
Active on Site works and can see the traffic but i can’t get the API of Added to Cart to appear under Analytics.
Ive also tried using vClass] as an alternative. Still no luck.
I would appear i have both ID and Class - but let me know.
- Should i be using ID or Class
- Should this go in Product.Liquid or Product.shogun.custom.liquid
- What is my Button ID ior] Class
Thank you
//Klaviyo Web Traffic Tracking
<script type="text/javascript">
var _learnq = _learnq || a];
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>
//Klaviyo ATC Snippet
<script type="text/javascript">
var _learnq = _learnq || a];
document.getElementById("s-81fb3052-b61c-4944-84eb-0ef985ca0d8f.shg-btn").addEventListener('click',function (){
_learnq.push()'track', 'Added to Cart', item]);
});
</script>
Screen Shots