How to add Facebook Pixel or Google Analytics to Shopify
If you run Facebook ads or want to track visitors, you’ll want tracking installed on your Shopify store.
Shopify gives you a few ways to connect these tools. The easiest method depends on whether you’re setting up Meta Pixel or Google Analytics 4 (GA4).
How to add Meta Pixel to Shopify
Meta Pixel helps you track actions people take after visiting your store from Facebook or Instagram ads.
You can track events such as product views, add-to-cart actions, checkouts, and purchases.
1. Create your Meta Pixel
Go to Meta Events Manager and create a new data source.
Choose Web, enter your website information, and create your Pixel.
Meta will give you a Pixel ID. It looks something like this:
123456789012345
Keep that ID handy.
2. Connect Meta to Shopify
In your Shopify admin, go to:
Settings → Customer events
Look for Meta Pixel or the Meta sales channel.
You can also install the Facebook & Instagram sales channel from Shopify if it isn’t already installed.
Connect your Meta account and select the Pixel you created.
Shopify handles the connection for the standard store events, so you don’t have to paste JavaScript into your theme.
3. Check that the Pixel works
Open your Shopify store and visit a few product pages.
Then go back to Meta Events Manager and check your data source.
You can also use Meta’s Test Events section to confirm that events are reaching Meta.
Give it a few minutes. Tracking tools aren’t always instant.
How to add Google Analytics 4 to Shopify
Google Analytics shows you where visitors come from and what they do after reaching your store.
1. Create a GA4 property
Go to Google Analytics and create a new property.
During setup, create a Web data stream for your Shopify store.
Google will give you a Measurement ID that looks like this:
G-ABC1234567
Copy the ID.
2. Connect Google Analytics to Shopify
In Shopify, go to:
Settings → Customer events
Look for the Google Analytics option and connect your Google account.
Select your GA4 property and web data stream.
Shopify can then send your store’s customer events to Google Analytics.
3. Check your tracking
Open your Shopify store in another browser tab.
Then open Google Analytics and go to Reports → Realtime.
You should see your visit appear there.
Click through a product page and interact with the store. This gives you a quick check that Analytics is receiving activity.
Meta Pixel vs Google Analytics
They answer different questions.
Meta Pixel is mainly useful when you’re running Facebook and Instagram ads. It helps Meta understand what happens after someone clicks your ad.
Google Analytics is useful for understanding your website traffic, acquisition sources, pages people visit, and conversions.
If you’re running paid traffic, I’d install both. They give you different data, and having both makes it easier to understand where your sales are coming from.