We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Add To Cart tracking issues

Add To Cart tracking issues

mishaburich
Visitor
1 0 1

Hey guys

I need help - for the past few months I've noticed big problems with add to carts

 

1. Shopify itself is showing me less add to carts in analytics than my actual add to carts and purchases.

2. My add to cart flow in klaviyo is not sending out any emails for abandoned carts - though it is sending them for abandoned checkouts

 

there seems to be something very off with shopify firing add to cart events and shopify support couldn't help me at all.

Reply 1 (1)

Small_Task_Help
Shopify Partner
1144 55 112

Hi,

Hope this will help

- Shopify not showing Add to Cart events - Add Shopify.analytics.track code
- Klaviyo not sending Add to Cart emails - Add Klaviyo _learnq.push() script
- Emails only sent for checkout - Add custom Klaviyo tracking code

Code example

<script>
  document.querySelector('form[action="/cart/add"]').addEventListener('submit', function(e) {
    fetch('/cart.js')
      .then(response => response.json())
      .then(cart => {
        const lastItem = cart.items[cart.items.length - 1];
        _learnq.push(['track', 'Added to Cart', {
          Name: lastItem.product_title,
          ProductID: lastItem.product_id,
          Categories: lastItem.product_type,
          ImageURL: lastItem.image,
          URL: window.location.href,
          Brand: lastItem.vendor,
          Price: lastItem.price / 100
        }]);
      });
  });
</script>
To Get Shopify Experts Help, Click Here or E-mail - hi@ecommercesmalltask.com
About Us - We are Shopify Developers India
At Google My Business - Ecommerce Small Task - Hire Shopify Developers Ahmedabad