Klavyio | Added to cart custom metric for shopify store

Job ID: 30784025

Budget: $10 – $30 USD

Hello,

I’m searching for a Dev who can help us add custom Klavyio add to cart metric on our Shopify store, using .liquid.
Recently we installed the added to cart scripts on our product pages, and everything is going well. But on our website we have 3 cart buttons. So, we need to track the user on these 3 way.

1 - The first one is on the product page, as i said. No Problem for now.

2 - Through the page's sticky button: Overbeats.com/pages/overbeats-pro, when the user chooses its color in the carousel and clicks “COLOCAR NA SACOLA”, for this page we use class = header_cart

With the code:
<script type="text/javascript">

var _learnq = _learnq || [];

var classname = document.getElementsByClassName("header_cart");

var addToCart = function() {

_learnq.push(['track', 'Added to Cart', item]);

}; for (var i = 0; i < classname.length; i++) {

classname[i].addEventListener('click', addToCart, false);

}

</script>

3 - When the user chooses their color on the page: overbeats.com/pages/color, and clicks the COLOCAR NA SACOLA button

We use class = product-redirect


We use the code:
<script type="text/javascript">

var _learnq = _learnq || [];

var classname = document.getElementsByClassName("product-redirect");

var addToCart = function() {

_learnq.push(['track', 'Added to Cart', item]);

}; for (var i = 0; i < classname.length; i++) {

classname[i].addEventListener('click', addToCart, false);

}

</script>

Well after installing the code we saw that the events are being fired correctly and are appearing in the activity feed, but without the following data they are blank and the URL is wrong:


Brand: None
Categories:
CompareAtPrice:
ImageURL: https://cdn.shopify.com/shopifycloud/shopify/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_grande.gif
Name: None
Price:
ProductID: None
URL: https://overbeats.com

Klavyio support said the error happens because the code is made for product page, and this is regular custom page. And they can’t help me with this. So I’m searching for a developer who can fix create a custom code for regular page for track when the customer add to cart. If you have knowletd with Klayvio metrics let's chat about it.