Before starting to run ads on Facebook, make sure that your pixel data is correct. It is a simple mistake that can cause huge problems and result in bad data which translates to a bad decision.  

Many a time it happens that Facebook pixel may be installed at a number of places in Shopify which may result in showing exaggerated numbers and give a distorted picture of what is actually happening in the account. This is a mistake that needs to be fixed immediately – a double counting Facebook Pixel gives overinflated data that is basically worthless as you can not be sure what is driving conversions and what is not.

Recently, Mountainise was asked to look into a clients Facebook account who had trouble with declining return on ad spend (ROAS). Facebook showed exceptional revenue numbers compared to the ad spend, which was a bit suspicious. To confirm the doubt, we matched the numbers with their Google Analytics account, which showed Facebook was taking credit for nearly all 100% of sales. This is very unlikely unless 100% of your traffic is coming from paid Facebook ads.

How to check if Facebook Pixel is Double Counting

One quick way to check Facebook pixel data is to compare the various events to your data in Google Analytics for the same date ranges. They numbers don’t match perfectly, but they should be pretty close.

Facebook pixel in shopify

The odd thing that stood out from the above-highlighted figures is that the numbers for people completing a purchase were much higher than add to cart or initiate checkout which is technically impossible since not every user who puts to cart purchases the product.

If this pixel were correct, you would see the add to cart first, initiate checkout next, and purchase last, with declining numbers at each step.

This verifies that the pixel is not working properly and that the problem is at the purchase event so click the “View Details” link under Purchase.

view detail in Facebook pixel

The details that appeared showed that almost every purchase had an identical timestamp for the exact same value. At one instance there were three identical timestamps and a couple of them only had one. To point the exact problem here it’s: the Facebook pixel in Shopify was double counting or even triple counting every purchase.

The reason for different count times on occasions is due to the reason that some users who have Java disabled would block one of the pixels from firing. That would account for the single purchases. And other users might refresh the confirmation page. That would account for the triple purchases.

triple count in facebook pixel

How to Fix a Double Counting Facebook Pixel in Shopify

This client website was hosted on Shopify and had Facebook Pixel installed twice. Shopify allows native integration with Facebook which only requires putting the value of pixel ID and Shopify will take care of the rest.

This is the method most e-commerce sites should use because it’s a seamless integration that works really well. Check your store to make sure you have that enabled before following the next steps. You can get there under Online Store >> Preferences.

Facebook pixel installed in shopify

This client had the correct Facebook pixel ID which meant that the pixel code was also either hard coded into the theme files or they added it into the Additional Scripts section of Shopify. You can access the Additional Scripts under Settings.

Pixel code in shopify

The window could be expanded by grabbing from the bottom right corner of the text box. As seen here, the Facebook Pixel was also loaded in the native Shopify Facebook pixel setting. This meant the pixel was firing twice almost every time the confirmation page loaded. Moreover, the pixel has the purchase amount hard-coded as $299. That is a huge mistake unless all of the products are priced exactly the same.  299.00 should be replaced with

{{ subtotal_price | money_without_currency }}.

additional script in shopify

The solution is to just keep the native Shopify pixel integration in Facebook pixel ID in the Online Store >> Preferences section of Shopify and remove the Facebook pixel from the Additional Scripts section of the checkout settings.

Also Check one other Place

It’s also possible the site admin had hard-coded the Facebook pixel on the cart.liquid page or elsewhere in the theme files. To check, navigate to Online Store >> Edit Code as shown below:

navigate online shopify store Navigate online store

Hard-coding pixel in Shopify files must be avoided. To find a hard-coded pixel, you have to check multiple dot liquid files by opening each one individually and using command find function to search for the pixel ID. Be wary to delete the entire pixel ONLY. Make a test purchase to ensure nothing is broken after you save the change.

How to Prevent Refresh from Logging Multiple Conversions

It is always recommended to use native integration for Google Analytics and Facebook Pixel within Shopify. However, all the other pixels have to be put in the Additional Scripts section in order to track sales from various platforms (like Bing, Google Ads, Pinterest, Twitter, etc). The pixels will fire every time and log additional sales that never happen if a customer refreshes the confirmation page or bookmarks it and views it again later. To prevent this from happening, use the following code format in the Additional Scripts text box:

{% if first_time_accessed %}

Put all your conversion pixels that you only want to fire the first time here

{% else %}

Put all the other pixels/tags you want to run on every visit here

{% endif %}

Generally, you only want the pixels to fire once but if you want checkout page refreshes to be logged as a pageview then you could also put that code in the second portion so that it fires on every visit.

Even if you are using any other ecommerce platform and facing multiple conversion the solution is going to be similar to this. It means you’ve somehow installed the pixel twice through a native integration and possibly again under a custom scripts section. The recommended solution is just to keep one, most likely the native integration. And you are good to go.