Problems tracking Adds to Cart with new Facebook pixel

Highlighted
Shopify Partner
3 0 0

So I am using the new facebook pixel, and it seems to be working well for the most part, but it is not tracking adds to cart correctly. On most ads, I am seeing fewer adds to cart than sales. It is tracking some, but definitely not all. I have added the base pixel code to my them.liquid. Here is the code that I have added to my cart.liquid:

<script>
fbq('track', 'AddToCart', {
  content_name: [{% for item in cart.items %}'{{product.title}}',{% endfor %}],
  content_ids: [{% for item in cart.items %}'{{item.variant_id}}',{% endfor %}],
  content_type: 'product',
  value: {{ cart.total_price | money_without_currency }},
  currency: 'USD'
});
</script>

Does anyone see something that I'm doing wrong here? This is getting really frustrating, I've been trying to figure this out for weeks.

Thanks,
Mark

0 Likes
Highlighted
New Member
2 0 0

Hi Mark, 

 Any success with this? I have also been struggling with the same for days now. 

0 Likes
Highlighted
Shopify Partner
3 0 0

Hi Ahmer,

It seems to be working now, but I don't really know why. There was 1 error in the line that starts with "content_name" -- it should be "item.title" instead of "product.title" but it started working before that was fixed (I am using variant id's instead).

Sorry I can't be of more help.

Mark

0 Likes