How To Implement Google Analytics & GA4 Server-Side Tracking with Shopify

Elevar powers your data layer and server-side tracking needed to connect GA4 and Shopify.

beginner Implementation Difficulty
How To Implement Google Analytics & GA4 Server-Side Tracking with Shopify

Integration Specs

  • Channel Accuracy Monitoring
  • Requires Elevar Data Layer
  • GTM server-side client customizable
  • Chrome Extension

  • Elevar Server-Side
  • GTM Server-Side
  • GTM Web Container

What's Included

Events

What customer events are tracked in this integration

  • Pageview
  • Product View
  • Add To Cart
  • Initiate Checkout
  • Search
  • Listing Page
  • Purchase
  • Base Tag
  • Email Signup

Customer Parameters

What customer parameters are tracked in this integration

  • customer id
  • customer status
  • click id
  • promo code
  • order id
  • discount amount
  • line items

Step 1: Overview

Elevar offers two ways to implement Google Analytics and GA4 server-side tracking:

  1. Elevar’s server-side tracking
  2. GTM server-side container (via Elevar)

If you are using your own GTM server-side container connected to Google Cloud then you can follow our related guide on this setup here.

Please note that you have complete control over how your data is being sent to GA including:

  • How to manage recurring subscription orders
  • Order and product ID type
  • What additional channels you want to send to GA — like Facebook and TikTok Shop, Draft Orders, Global orders from third party apps, etc

You can configure each of these in the steps below without modifying any code on your website.

Step 2: Prerequisites

Before you can enable your Google Analytics Destination, you will need to:

  • Install Elevar’s Data Layer on your store
  • Enable Data Layer Listener Source in Server-Side settings in your Elevar dashboard
  • Enable Shopify Notifications Source in Server-Side settings in your Elevar dashboard

You can follow Step 2 from the client-side guide for more details on the data layer installation process.

Step 3: Import your Pre-Built Google Analytics Web Tags to Google Tag Manager

Currently, the server-side integration sends only the purchase event via the server. The rest of the GA events come from your browser.

To set up your Universal Analytics Analytics non-purchase events:

  1. Click here to be taken to the Pre-Built Universal Analytics (for Server-Side) tags.
  2. Add in your Google Analytics Property ID > Select Download Container
  3. Log into Google Tag Manager > Select your desired Web GTM Container
  4. Navigate to Admin > Import Container > Upload the file you just downloaded from Elevar
  5. Select New under Choose Workspace > titled it Elevar GA Server-Side
  6. Select Merge > Then select Overwrite > Then Confirm
  7. [Optional] QA the newly uploaded tags using Google Tag Manager’s Preview Mode

To set up your GA4 Non-Purchase events via the browser:

  1. Click here to be taken to the Pre-Built GA4 (for Server-Side) tags.
  2. Add in your GA4 Measurement ID > Select Download Container
  3. Log into Google Tag Manager > Select your desired Web GTM Container
  4. Navigate to Admin > Import Container > Upload the file you just downloaded from Elevar
  5. Select New under Choose Workspace > titled it Elevar GA4 Server-Side
  6. Select Merge > Then select Overwrite > Then Confirm
  7. [Optional] QA the newly uploaded tags using Google Tag Manager’s Preview Mode
  8. Once you’re ready to publish, navigate to the Elevar GA4 Server-Side Workspace > Select Submit at the top right > Then Publish

Step 4: Add Google Analytics as a Server-Side Destination

1. In your Elevar App, navigate to Server-Side > Select Add Destination > Find and select Google Analytics.
Server-Side Elevar 2022-04-21 at 1.27.15 PM

2. You’ll be taken to an Overview Page, select Get Started

Step 5: Select your Events

Currently the Elevar Server-Side integration just sends purchase conversions & refunds server-side. We will be releasing our sitewide server-side events into beta soon.

Most likely, you won’t need to adjust anything and can just select Save to continue to the next step.

Server-Side Elevar 2022-04-21 at 1.43.31 PM

Note: if you want to send refund data please select order ID in the next step.

 

Step 6: Select your Transaction Identifier

The Order Name is the most commonly used Transaction ID, so you likely won’t need to adjust anything and can just select Save to continue to the next step.
Server-Side Elevar 2022-04-21 at 1.48.28 PM

Step 7: Select your Product Identifier

Product SKU is almost always used as the primary product ID in Google Analytics integrations, but you can override this for your purchase events.
If you change this, just be sure you update all ecommerce events to use this new product identifier (e.g. add to cart, etc). Without this, your Shopping Behavior and product performance reports will not match up due to different IDs.
The native Shopify <> GA integration uses SKU so it’s best to keep SKU to maintain historical consistency.
Server-Side Elevar 2022-04-21 at 1.59.24 PM

Select Save to continue to the next step!

Step 8: Block Transactions

This step allows you to control exactly what purchase events are sent to Google Analytics. You can block orders based on Source Channel Names, Order Tags or Order Gateways.

For Google Analytics, instead of blocking orders from being sent, we’d recommend implementing Source / Medium overrides in the Google Analytics ID Step. This will allow your orders in GA to match Shopify better & allow you to bucket offline orders like Recurring Orders or POS orders into their own designated Source / Medium.

You can then create different Views in GA to show “Website Only (No Recurring) Orders” vs “All Orders”.

However, if you do want to block orders from being sent to Google Analytics, here’s how you can do so!

Server-Side Elevar 2022-04-21 at 2.53.34 PM

 

Step 9: Subscription Management

If you sell subscriptions then you have the ability to:

  • Send first time orders only
  • Send first time and recurring orders where the recurring orders use the attribution from the first order
  • Send first time and recurring orders where you can send a custom source/medium/campaign for recurring orders (e.g. “recharge / recurring order”)

Start by Selecting your Shopify Subscription App

Choose if you are using Recharge/OrderGroove or another software.

Screen Shot 2022-05-19 at 1.53.34 PM

If you are using another Subscription software that we don’t have listed, here is how to find your Recurring Order tag applied on orders:

  1. Go to your Shopify Order grid
  2. Filter the orders by the channel that powers your subscriptions
  3. Look for orders that have the recurring order tag (this differs by app). For example ReCharge sets “Subscription” and “Subscription Recurring Order” on all recurring orders.

Screen Shot 2022-05-19 at 1.54.27 PM

Then Choose to Send Only First Time Orders or Both First & Recurring Orders

If you only want to send first time orders only, select No, block.

If you want to send both first time & recurring orders, select Yes, send all.

Screen Shot 2022-05-19 at 1.57.04 PM

If You do Send Recurring Orders, Choose your Desired Recurring Order Attribution Method

Select Yes to use the attribution of the original order for your recurring order. [How does this work?]

Select No, customize attribution, to specify the Source, Medium, & Campaign name for your recurring orders.

Screen Shot 2022-05-19 at 1.59.59 PM

Step 10: Select Attribution Method

This setting allows you to override the default last-click UTM parameters from a user visit.

If you are using the Shopify checkout then in many cases Shopify will store attribution data from the user in their path to purchase. It typically looks something like this:

Screen Shot 2021-11-02 at 2.31.23 PM

When Shopify has UTM data on the “1st session” and Elevar has UTM data on the session the user converted on then you can choose which UTMs you want sent to Google Analytics.

And if you choose “first touch” but no UTMs exist on Shopify, then Elever will fallback to using UTMs that Elevar stores (and vice versa).

These are all connected to the same user through the GA cookie stored on the order as well.

Yes – this can be quite confusing or mind-blowing to analytics enthusiasts.

However we found that in some cases the UTM data stored on Shopify helped improve the accuracy of transactions.

This article contains a deep dive on the differences that you could see for your own store.

Plus you’ll see how attribution changes unexpectedly.

Step 11: Add Universal Analytics Property ID

Step 12: Add in your GA4 Measurement ID & Secret

Add your GA4 Measurement ID

Screen Shot 2022-04-26 at 1.39.44 PM

Add your GA4 Secret

Screen Shot 2022-04-26 at 2.01.40 PM

Step 13: Setup Source / Medium Overrides

Check to see what Sales Channels you currently use. If you are using Sales Channels beyond the standard Shopify Checkout, (i.e. POS orders, Draft Orders, etc) then you can add source / medium overrides to bucket these orders into their own group in GA.

1. In the Google Analytics ID step, Select Advanced Options.

Server-Side Elevar 2022-04-21 at 3.10.39 PM

2. Select Customize by Channel (But you can also customize based on a specific Order Tag or Payment Gateway!)

Server-Side Elevar 2022-04-21 at 3.10.52 PM

3. Find the Channel Code (a.k.a. Source_name) for your Sales Channel

4. Input the Channel Code > And input what you’d like to appear as the Source, Medium, & Campaign in Google Analytics.

Server-Side Elevar 2022-04-21 at 3.13.38 PM

5. You can press Add Another to add another Override or press Save to continue.

Step 14: Going Live

It’s time to go live!

1. Select Go Live on the Overview Step

Server-Side Elevar 2022-04-21 at 3.22.23 PM

2. Be sure your Elevar GA Server-Side workspace in Step 1 is published.

3. Remove your pre-existing GA integration

4. Monitor your GA property via real time reports and/or your standard reports

 

If you have any questions please don’t hesitate to reach out to ask us for help.

 

Step 1: Install Data Layer to Your Store

In order to deploy Google Analytics via Google Tag Manager tags, you need to have a data layer implemented on your Shopify store that pushes customer, product, and order data that Facebook tags require.

installdatalayer

If you don’t have a data layer for your Shopify store yet, then you can utilize Elevar’s data layer for Shopify. It’s a 1-click installation into your theme.

Step 2: Download Pre-Built Google Analytics Tags

Navigate to your Pre-Built Tag Library & search for Universal Analytics.

Screen Shot 2022-01-04 at 8.49.22 AMDownload the container titled Universal Analytics (for Client-Side only)Screen Recording 2022-01-04 at 08.52.28 AM

Repeat this for the GA4 (Client-Side) container.

Step 3: Import Pre-Built Tags into Google Tag Manager Web Container

In Google Tag Manager, navigate to Admin > Import Container.

Choose the Universal Analytics (for Client-Side) container that you downloaded in Step 1.

Import it into a new Workspace. You can title this workspace whatever you’d like. I titled mine Elevar Implementation.

Select Merge > Then elect to Overwrite conflicting tags, triggers, and variables.

Screen Recording 2022-01-04 at 09.14.37 AM (3)

Step 4: Update UA Variable in GTM

Update your Universal Analytics variable if you did not enter it when downloading from your Elevar Dashboard.

Screen Shot 2022-01-04 at 9.27.28 AM

Screen Recording 2022-01-04 at 09.30.31 AM

Step 5: QA & Publish GTM Workspace

Once you’re ready to publish, select the Submit button in GTM.

Screen Shot 2022-01-04 at 9.33.30 AM

Then select Publish.

Screen Shot 2022-01-04 at 9.35.47 AM

Step 6: Remove your Existing Google Analytics Tracking

If you are using the same Universal Analytics or GA4 property IDs then you’ll need to remove your pre-existing IDs to prevent duplicate tracking.

If you’re using the native Shopify/GA Integration, navigate to Online Store > Preferences > then disable the Google Analytics tracking located under the Google Analytics Section.

Shopify Preferences

If you’ve hard coded your Google Analytics tracking, remove the hard coded script from your Shopify liquid, Shopify Checkout Settings, additional checkouts, and any other locations that Google Tag Manager will be firing on.

Compatible Data Sources

Data Layer

Complete data layer for Google Tag Manager including all native events and variables for Shopify.
Learn More

Shopify Webhooks

Used for our server-side integrations for 100% purchase capture rate.
Learn More

FAQs

View common integration questions

  • Please contact [email protected] and we will enable this setting for you.
  • On average you should expect to see at least 10% more transactions in GA than the native Shopify integration.
  • We typically see 10-20% change in attributed orders in our server-side integration. This means more attribution to paid channels like Google Ads and Facebook and less attribution to direct, organic search, or referrals.