Shopify - Google Analytics and Tag Manager Operations

Master seamless tracking of customer behavior and conversions with Shopify’s built-in GA4 and Pixel setup in minutes.

Ceyhun Enki Aksan
Ceyhun Enki Aksan Entrepreneur, Maker

Shopify related article, I previously discussed the platform’s launch and various features, and I will share separately an article on user behavior and conversion tracking.

Yes, as briefly mentioned, Shopify provides us with the ability to easily set up Google Analytics and Facebook Pixel tracking codes for our store. Simply following the Sales Channels > Preferences instructions is sufficient1.

warning

As of July 2023, Universal Analytics (UA) is being replaced by Google Analytics 4 (GA4). After this date, UA properties will no longer be able to process new data. They are expected to become inaccessible by the end of the year. For details on differences between property types and other operations, please refer to my article titled Universal Analytics (UA) to Google Analytics 4 (GA4). You may also request technical support at (https://calendly.com/dnomia/15min).

Shopify - Google Analytics Integration

As seen here, we can directly add the Google Analytics code and establish a connection with Facebook Ads via a button.

Shopify - Google Analytics
Shopify - Google Analytics

Simply paste the tracking (measurement) code corresponding to your desired Google Analytics property into the textarea field provided here and save it. Then, the [var]UA-[/var] value specified within the relevant field will be displayed for you. You can change this property ID at any time as needed.

Additionally, after the code is approved, the [var]Additional Google Analytics JavaScript[/var] and [var]Use Enhanced Ecommerce[/var] fields will appear under the [var]UA[/var] property section.

Shopify - Google Analytics
Shopify - Google Analytics

Additional Google Analytics JavaScript enables us to add Google Analytics parameters and events to online store pages. Use Enhanced Ecommerce allows the use of e-commerce events related to Shopify purchase transactions1.

Shopify supports Universal Analytics. GA4 installations can be performed via theme integration.

Google Analytics Funnel
Google Analytics Funnel

For more information on Shopify’s Google Analytics integration, see the article titled Shopify GA4 and GTM Setup.

Goals and Funnels

It enables the use of URL as a Shopify destination, allowing the creation of a funnel that covers six steps based on URL. This allows for the creation of a funnel that covers six steps based on URL2.

StepNameScreen/Page
1Product view[var]/products/*[/var] 3
2Add product to cart[var]/cart[/var]
3Address entry[var]/checkout/contact_information[/var]
4Shipping information entry[var]/checkout/shipping[/var]
5Payment information entry[var]/checkout/payment[/var]
6Payment confirmation page[var]/checkout/thank_you[/var]

Exclude Referral Traffic from Google Analytics Monitoring

As mentioned in the article titled Payment Gateways and Tracking, various redirects between pages and/or page fields related to payment steps or payment confirmation processes may occur4.

Excluding referrer domain - Google Analytics
Excluding referrer domain - Google Analytics

In such cases, data may be split between different sessions and sources. To avoid such issues, it is recommended to exclude referrals between domain names using the [var]Referral Exclusion List[/var] feature under Google Analytics’s property settings.

Shopify - Google Tag Manager Integration

While the integration process may vary depending on the specific account type, it can be implemented using the theme.liquid and checkout.liquid pages. A Shopify Plus account is required for Google Tag Manager operations related to the checkout page5 6 7 8.

Shopify Theme Customization
Shopify Theme Customization

Both pages feature separate <head></head> and <body></body> sections. This same approach applies to GA4 integration as well. As mentioned in the “Shopify - Google Analytics Integration” section, Shopify supports Universal Analytics.

Google Tag Manager
Google Tag Manager

Here’s an addition I’d like to make: you can add the Google Tag Manager setup code by selecting the “Additional Google Analytics JavaScript” option that appears after completing the Google Analytics integration. However, this is not recommended. After this action, both the Google Analytics and Google Tag Manager setup codes will be added to the page. In this case, you must ensure that the relevant Google Analytics property is excluded within Google Tag Manager. Additionally, if you wish to include an iframe code, you can use the theme.liquid page for this purpose.

Shopify Checkout
Shopify Checkout

In addition, if you have installed a code setup using the [var]Settings > Checkout > Order processing > Additional scripts[/var] field9, you must also update the relevant setup depending on the GA-GTM relationship.

Shopify GTM Apps
Shopify GTM Apps

In addition to the options mentioned above, you can obtain apps such as Elevar Tag Management Suite10, TrafficGuard Tag Manager, Google Tag Manager by Niddocks, and similar paid or free applications via the App Store.

Shopify Help Center

Footnotes

  1. Setting up Google Analytics. Shopify Help Center 2
  2. Setting up Google Analytics goals and funnels. Shopify Help Center
  3. You can add appropriate content based on the product definition instead of using *.
  4. Excluding referrer domains from Google Analytics tracking. Shopify Help Center
  5. Support for themes. Shopify Help Center, Editing theme code. Shopify Help Center
  6. GTM and Google Analytics data layer for Shopify
  7. Shopify Data Layer
  8. Shopify Custom Analytics
  9. [Customize the order status page.
  10. How to Set Up Google Tag Manager in Shopify — in Minutes