Migrating pixels
If you've previously added a pixel manually to your store in a location such as the theme.liquid, checkout.liquid (Shopify Plus plan only), Additional scripts in your checkout settings, or Preferences page, then you can migrate your pixels to be compatible with a Shopify app pixel or a custom pixel. Some benefits of migrating your old pixels include:
- Easier access to tracking customer events, including checkout events
- Built in tools for privacy compliance
- Continuous maintenance and improvement by Shopify and pixel providers
Learn more about Shopify's pixel manager, and the full benefits of migrating to Shopify app pixels or custom pixels.
On this page
Migrating Meta and Google pixels from your Preferences page
On February 2, 2025, the Meta and Google Analytics pixel management settings in your Shopify admin will be upgraded in order to comply with the latest Payment Card Industry Data Security Standard (PCI DSS) security standards and regulations. This change ensures that your business and customer information stays secure against data breaches and fraud. Learn more about how Shopify helps your store stay PCI DSS v4 compliant.
If you have Meta pixels or Google Universal Analytics tags set up in the Online Store > Preferences page of your Shopify admin, then take one of the following actions before February 2, 2025, to continue tracking events for Meta and Google:
For the most accurate tracking and performance, migrate the pixel to the one of the following channels:
- Migrate your Meta pixel to the Facebook & Instagram channel.
- Migrate your Google Analytics pixel to the Google & YouTube channel.
If you no longer require a pixel for tracking, then from your Shopify admin, go to Online Store > Preferences to remove the pixel from your store.
Migrating a Google Analytics pixel to the Google & YouTube channel app
To avoid disruption to your Google Analytics measurement, it’s recommended that you migrate your Google Analytics tag to the Google & YouTube channel app. If you don't migrate your tag to the app, your tag will be automatically converted to a custom pixel, which may result in degraded measurement performance and features in Google Analytics. Specifically, you can expect the following impact:
- Data reported in Google Analytics may change (or, in some cases, be lost) due to differences in event measurement and tag behavior.
Core features of Google Analytics such as enhanced measurement and cross-domain measurement might not work correctly.
Tag Assistant might not work or may incorrectly report on your GA4 tag.
Tag Diagnostics might not correctly identify your GA4 tag or might recommend features that do not work for you.
Settings you’ve previously added to the Additional Google Analytics Javascript section will be dropped.
Consent treatment of your Google Analytics tag might change.
Migrate your Google Analytics pixel
On the Google & YouTube channel app, the pixel that you track is referred to as a tag. To migrate a Google tag from your Preferences page, you first need to install and set up the Google & YouTube channel app on your store.
Depending on whether you’re using Google Analytics 4 (GA4), follow one of the sets of steps to migrate your Google Analytics pixel:
- If you haven’t set up Google Analytics, then follow the steps to set up Google Analytics through the Google & YouTube channel app . The GA tag will be auto-configured for the following ecommerce events:
- view_item
- add_to_cart
- begin_checkout
- purchase
- search
- add_payment_info
- page_view.
- If you’re already using Google Analytics, then follow the steps to confirm and set up your Google measurement ID.
Confirm and set up your Google measurement ID Steps
- Go to https://analytics.google.com/ and sign into your Google Analytics 4 account, and then find your measurement ID.
- From your Shopify admin, go to Sales channels > Google & YouTube.
- In your Google Analytics property section find your Google Analytics measurement ID.
- If your measurement ID matches in the Google & YouTube channel app and your analytics account, then no action is required.
- If your measurement ID doesn’t match in both locations, then set up Google Analytics with your measurement ID in the Google & YouTube channel app.
Migrate a Meta pixel to the Facebook & Instagram channel
To migrate a Meta pixel from your Preferences page, you need to have the Facebook & Instagram channel app installed and set up on your store. The steps to migrate a Meta pixel depend on your current pixel configuration.
Check your current Meta pixel configuration
- From your Shopify admin, go to Online Store > Preferences.
- In the Facebook Pixel section, check your pixel ID.
- Optional: If you have an existing pixel connected to the Facebook & Instagram channel, then in a separate browser tab from your Shopify admin, go to Sales channels > Facebook & Instagram.
- Click Settings, and then in the Share data section, check your pixel ID.
- Compare the pixel IDs from your Preferences page and Facebook & Instagram channel to check if they're the same, and then proceed to migrate your Meta pixel accordingly.
Migrate your Meta pixel
Depending on your current Meta pixel configuration, take the following actions to migrate your pixel:
- If your pixel ID in both your Preferences page and the Facebook & Instagram Channel matches, then no action is required.
- If the pixel IDs in your Preferences page and the Facebook & Instagram channel are different, then follow the Different pixels in Preferences and Facebook & Instagram channel steps.
- If you only have a pixel ID in your Preferences page, and you don't yet have one connected to your Facebook & Instagram channel, then follow the Preferences only steps.
Different pixels in Preferences and Facebook & Instagram channel
If the pixel IDs in your Preferences page and Facebook & Instagram channel are different, then first decide which pixel ID you want to continue using.
To continue using the pixel ID that's connected to the Facebook & Instagram channel, delete the other pixel ID from your Preferences page:
- From your Shopify admin, go to Online Store > Preferences.
- In the Facebook Pixel section, click Remove to remove the pixel.
- Click Save.
To continue using the pixel ID in the Facebook Pixel section of your Preferences page, delete the other pixel ID from the Facebook & Instagram channel, and then replace it with the pixel from your Preferences page:
- Copy the pixel ID from the Facebook Pixel section of your Preferences page.
- Go to Sales channels > Facebook & Instagram > Settings.
- In the Share data section, click Change.
- Change the pixel ID to the pixel ID that displays in your Preferences page.
Pixel in Preferences Only
If you only have a pixel ID in your Preferences page, and you don't yet have one connected to your Facebook & Instagram channel, then copy the pixel from your Preferences page, and then create a Meta pixel in the Facebook & Instagram channel. In Step 7, paste in the pixel ID from your Preferences page.
Migrate an old pixel from your theme.liquid, checkout.liquid, or Additional scripts
You can do either of the following when migrating an old pixel from your theme.liquid, checkout.liquid, or Additional scripts:
To avoid duplicating or missing customer events, consider migrating your pixels during a less busy period for your store.
Preparing to migrate a pixel
Consider the following when deciding on your migration workflow:
- If you want to minimize missing any customer events, then connect your new custom pixel before you remove your old pixel.
- If you want to avoid duplicating customer event tracking, then connect your new custom pixel after removing your old pixel.
- In order to migrate an old pixel, you need to find your old pixel code so that you can remove or modify it. Most pixels have two components that you'll need to find:
- A base Javascript SDK: The Javascript SDK is often placed in your header, and can be found in the theme.liquid and Additional scripts in your checkout settings.
- Old pixel code for collecting customer events: You can usually find this code in your theme's liquid files, and Additional scripts in your checkout settings. Refer to your third-party pixel provider's documentation for how customer events are located so that you know what to search for. For example, Meta's pixel has a method called fbq(), and Google pixels often use gtag() or dataLayer.push().
Migrate an old pixel to be compatible with an app pixel
You might want to migrate an old pixel to be compatible with an app pixel if both of the following conditions apply:
- You've installed a Shopify app pixel that collects customer events automatically.
- You've also added some additional code for custom events that aren't tracked by the app pixel.
In this case, you should follow the app developer's instructions to migrate the old pixel.
Migrate an old pixel to a custom pixel
You might want to migrate an old pixel to a custom pixel if both of the following conditions apply:
- You have a previously installed pixel that you manually wrote code for, without any Shopify app installed.
- There is no Shopify app pixel that meets your requirements.
You can connect your new custom pixel before or after removing your old pixel code.
Steps:
- Create a custom pixel that subscribes to your required standard and custom customer events.
- Remove, or replace any previously added pixel code from your liquid files or Additional scripts in your checkout settings. This might include old pixel code that includes the Javascript SDK, collects standard events, or collects non-standard events.
- Add your custom pixel to your store.
- Connect your custom pixel.
Removing or replacing old pixel code
As you find your old pixel code, you need to either remove it, or replace it with Shopify's Shopify.analytics.publish() method, depending on what kind of event the pixel is tracking:
- You can remove all instances of the Javascript SDKs that you find.
- If the old pixel is tracking a standard customer event, and the custom pixel or app pixel that you want to add supports collecting the standard customer event, then you should remove its code.
- If the old pixel is tracking a custom customer event, and the custom pixel or app that you want to add supports collecting custom customer events, then you should replace its code.
This is an example of an old pixel code that tracks a non-standard customer event:
<script>fbq("trackCustom", "my_custom_event");</script>
This is an example of the equivalent code to replace it with:
<script>Shopify.analytics.publish("my_custom_event");</script>
If you're creating a custom pixel, then you should include code subscribing to the custom event, such as this example:
analytics.subscribe("my_custom_event", event => {
fbq("trackCustom", "my_custom_event");
});