FROM CACHE - en_header

My facebook pixel does not show add to cart event

Adike123
New Member
3 0 0

Hi guys,

 

Been banging my head on this for the last 2 days, hopefully, someone can help me figure out 

 

Only show this event >> Button click automatically detected  and didn't track with pixel

 

add to cart problem.jpg

 

Is there anything obvious that I'm missing?

Thanks for your reading time, and your help.

Replies 16 (16)
Lilith
Shopify Staff
Shopify Staff
603 72 174

Hey, @Adike123!

 

My name is Lilith, I'm on the Social Care team at Shopify.

 

Thanks for the screenshots and the details you provided. That was very helpful!

 

I've looked at the site that you linked in your post and tested my pixel helper to see where your pixel fires and doesn't. After taking a look at the flow of how your products get added to the cart I noticed that you're using an ajax script to keep the visitor on the same page and use the drawer to view the cart.

 

What's Happening

 

What happens with this timber drawer ajax custom modification (not supported by Shopify) is that the normal pixel event that fires when someone adds a product to cart and is taken to the cart page, it no longer viable.

 

Why It's Happening

 

When you install the pixel using the Online Store > Preferences section, your pixel's events will work normally when a customer adds a product to the cart and are then taken to the cart page.

 

If the site processes this add to cart activity differently by using a different code or script, then the basic installation of taking the customer to cart won't be used. Which means that the pixel event tracking code in that same script won't be used.

 

How to Fix It

 

The great news is that you can fix this!

 

This will require you to customize some code just like with the ajax template code.

 

This is not supported by Shopify as it is a more complex modification. However, you can certainly look into hiring a Shopify Expert if you run into any challenges.

 

What you'll do is add your Facebook Add to Cart event tracking snippet to your custom ajax code in your theme. Alternatively, you can add an inline action event code to the button on your product page.

 

Here is the link to Facebook's help guide on generating the basic tracking event codes that can be installed.

 

 

Here are some additional advanced resources for more customized event tracking on your site if you wish to explore some additional methods to track activity.

 

 

Let me know if that helped! I'm happy to answer any questions you think of as you work on your business.

Lilith | Social Care @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Adike123
New Member
3 0 0

Is there anything that I'm missing?

I follower the step that you guide me but when i  open product page , it start "add to cart" event before i click the button.

 

add to cart problem2.pngadd to cart problem3.png

Thanks for your help.

Lilith
Shopify Staff
Shopify Staff
603 72 174

Hey, there! I see why!

 

The reason that your pixel is firing before you click Add To Cart is that the snippet you added is placed in an incorrect location.

 

Essentially what your code says right now is: As soon as the theme begins to load (AKA: the <head> script) track that as an Add To Cart pixel event

 

As per the instructions in the guides I sent over, you'll want to add that event code to your ajax template or ajax scripts instead.

 

Since Shopify isn't able to support custom changes such as these to the code and I've got limited information on your site I'd still recommend reaching out to a Shopify Expert. If you're on a tight budget I'd suggest speaking with Apolomultimedia first. They've done some work on my own sites in the past and have had a great experience with them.

 

Here is a screenshot of which tab or template you should be placing the code in instead.

 

 

 

27-42-eda32-d1u3w

 

 

Let me know if this helped! Feel free to ask questions, I'm more than happy to help guide you in the right direction as you work through the modified Facebook Pixel tracking code installation!

Lilith | Social Care @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Adike123
New Member
3 0 0

Which level is right ?

problem 4.png

chewka
Shopify Partner
2 0 4

Hi! Just to let you know I have the exact same problem. 

 

The add to cart thing used to be firing and working few weeks ago with Ajaxify cart and is no longer working.

 

I've been looking in both ajaxify-cart-template.liquid file and my theme.js but without success in implementing it.

Each time I have errors or it is firing multiple times.

 

I don't know why it use to be working and I'd like to ..  

 

Now I think the easiest way is to put a custom event on add to cart button and register the ATC from here.. 

 

EDIT : it works if I put it in my JS code in the itemAddedCallback function, but it is recorded twice if a person adds multiple items to cart.

NoNamerz
New Member
1 0 0

Hi, Lilith! Could you please look at my page as well? I got the same problem. Everything tracks, page view, checkouts, purchases, but ADD to Carts don't. This happens for several of my shops and accounts, even with the new ones. Before it was all great. In one service they told me that the problem is with Sticky Add to Cart button. Anyway, it would be great if you can look at it. Thank you!

jctw
New Member
1 0 0

Hi Lilith,

I'm having the same issue. The add to cart event doesn't show nor record in Pixel.

I installed Pixel using the regular way (paste the pixel in Preference section) and use the unchanged add to cart drawer from Brooklyn Theme. I didn't modify any of the the ajax or pixel related codes,

 

I found this issue so I tested events using the function in Facebook Manager and it looks like this.

The testing process was:

View front page => View product => Add to Cart => Checkout

Facebook Pixel Test.jpg

The warning parts are fine because those data are recording correctly so I'm not worried about that. However, the Add to Cart event was not there.

Since I didn't change any code for Add to cart or Pixel, I was wondering which part could go wrong.

Thanks.

arodes
New Member
2 0 0

Hi there! I am having the same problem here. I have started a fresh store with official Brooklyn Theme and Facebook Marketing app by Shopify with the Pixel ID setting. I have contact support of Shopify Gurus but no solution at all. 

 

As you can see on this screenshot, it should be an addtocart event before initcheckout. Can anyone from Shopify escalate this issue to technical level?

Screenshot 2019-11-04 at 17.10.32.png

chewka
Shopify Partner
2 0 4

Hey, I figured out how to fire Add To Cart event.

 

Simply go on theme.js.liquid file and look line 876 for :

itemAddedCallback = function() {

 

Then just add this line right after : 

fbq('track', 'AddToCart');

 

Cheers

arodes
New Member
2 0 0

@chewka wrote:

Hey, I figured out how to fire Add To Cart event.

 

Simply go on theme.js.liquid file and look line 876 for :

itemAddedCallback = function() {

 

Then just add this line right after : 

fbq('track', 'AddToCart');

 

Cheers


Working for me now!

Areas85
New Member
3 0 0

Hi there Lilith,

 have a similar problem.

My Ads manager doesn't track the pixel correctly.

It seems to only track the initiated checkouts rather than the actual ATC.

It says "Pixel not paired to product catalog" 

Bildschirmfoto 2019-12-12 um 17.32.57.pngBildschirmfoto 2019-12-12 um 17.33.12.png

 

 

 

When I have a look in my pixel settings in facebook everything seems to be fine.

 

Bildschirmfoto 2019-12-12 um 17.37.10.png

 

I had a similar problem in a former store and had someone to "create a catalog and connect the pixel". the result was that every event was tracked double after and it messed up my whole data. What am I missing? I just installed the pixel in the preference section. So it should just rack everything correctly. but it doesn't. 

 

Any idea?

 

thanks in advance 

Andreas

Josh_Uebergang
Shopify Expert
874 34 224

Third party apps can interfere with the AddToCart event. I know a lot of Out of the Sandbox themes who used non-standard cart pages had issues with the event. They have documentation about it.

 

Sometimes you may have AddToCart events occasionally fire. If you go make a site-wide change like what @chewka has, then you will get a double of events. If you don't have any of such events which you can verify through the Pixel Event Manager, then go for a site-wide edit.

Run Google Shopping ads? Get the free definitive guide to Google Shopping for Shopify (no optin required): https://www.digitaldarts.com.au/google-shopping
AliAzemat
New Member
1 0 0

Didn't work for me the solution: fbq('track', 'AddToCart');

I put it in the next line


@chewka wrote:

Hey, I figured out how to fire Add To Cart event.

 

Simply go on theme.js.liquid file and look line 876 for :

itemAddedCallback = function() {

 

Then just add this line right after : 

fbq('track', 'AddToCart');

 

Cheers


 

LeeZ
New Member
4 0 0

HELP please! I having trouble setting up facebook pixel on my 1st Shopify store. I already manually installed the code in theme.liquid but conversion events are not firing on pixel helper.  Where do install the ADDTOCART, INITIATECHECKOUT, PURCHASE codes? 

Thanks

LeeZ
New Member
4 0 0

THanks it worked!

SimplyDropship9
Tourist
4 0 1

So this does work but I have one issue with it.  Normally add to cart tracking will only register once if you add something to cart, go to the cart page, go back and select something else, add to cart.  This should only show up as once not twice on your pixel which it does.  Using the drawer and this trick, while it now does register the add to cart event, once you close the drawer and add other items to cart it registers those all as separate add to carts making the tracking useless.

 

image.png

Also, it shows less add to cart info here whereas using the regular add to cart page (not the drawer) gives you the custom parameter info as well and doesn't complete it until you check out

image.png

Any other advice?