Contents:

  • Why do Shopify and Google Analytics Need to Be Connected?
  • A Complete Solution for Integrating Shopify and Google Analytics
  • How Able CDP Integrates Shopify and Google Analytics
  • 3 Steps to Connect Shopify with Google Analytics by Using Able

Shopify and Google Analytics

Why do Shopify and Google Analytics Need to Be Connected?

Shopify is the largest platform for e-commerce stores. Google Analytics is one of the most widely used web analytics services. Both offer a rich set of marketing data, but there are often significant discrepancies between them.

  1. 30-40% of conversions in Google Analytics often have direct or incorrect sources, as well as not being attributed to the actual landing page that the customer first saw or found in an organic search engine. This happens because Google Analytics creates a separate session for the returning customer when a different device is used or if browser privacy features block Google Analytics cookies. Stripe also does not enable track website visitors before they become customers and link purchases to the original lead source. 
  1. E-commerce funnels used to be amongst the simplest to track. New developments in e-commerce marketing made tracking and understanding customer journeys a lot harder for many types of funnels. Often, the lead may be first captured on a domain separate from the main store website. Or an external service can be used to capture the customer's email on the main website. Then, once a purchase eventually happens, neither the service used to run the store or traditional analytics services could attribute it to the source correctly as neither has ability to track the entire funnel. As a result, 30-50% of purchases don't have correct source in  analytics, as well as missing from the ad platforms' reports.

Many marketers see this as a natural technology limitation. It doesn't have to be this way. E-commerce sales can be tracked throughout the entire funnel: from the first interaction to the revenue. Attributing sales to leads and leads to marketing sources allows for accurate tracking of end-to-end marketing campaigns and understanding of ROI. The server-side Shopify and Google Analytics integration in combination with first-party attribution makes it possible to get a complete view of the customer journey.

A Complete Solution for Integrating Shopify and Google Analytics

Method 1.  Built-in Shopify's Google Analytics tracker

Both platforms use tracking cookies and are unable to use customer tracking data to attribute all subsequent revenue to the source. Sending data from Shopify to Google Analytics without first-party attribution does not provide a complete view of the customer journey and understanding of which marketing activities led to sales, and does not solve the problem of missing transactions or data discrepancies.

Method 2.  Via Google Tag Manager

It is very time-consuming to set up and may require an experienced developer. However, some customer events still happen offline independently of a page view and therefore are impossible to track with GTM. Only a server-side Google Analytics integration allows them to be sent to Google Analytics.

Method 3: Using Able CDP

Able Customer Data Platform is the ultimate Shopify and Google Analytics integration.

It combines browser tracking with server API integrations, linking website activity with purchases on the back-end to build a complete journey of each customer across Stripe and Google Analytics.

This allows to attribute 99% of sales to the correct marketing source, ad click and landing page and obtain data to inform strategy.

All of this without coding and complex manual set-up of the connection between Stripe and Google Analytics. Able already knows how to connect marketing data between Shopify and Google Analytics.

How Able CDP Integrates Shopify and Google Analytics

Able CDP Shopify purchase tracking attributes Shopify purchases to original customer sources, allowing Able to attribute them correctly.

Able Customer Data Platform combines browser and back-end tracking to:

  1. store Google Analytics Client Id for each lead form;
  2. add UTM parameters, referrer URL and landing page details to new leads;
  3. attribute successful deals in CRM or successful Stripe payment to the Google Analytics user id and send e-commerce transaction to Google Analytics.

3 Steps to Connect Shopify with Google Analytics by Using Able

Step 1. Sign up for a free account

Complete the sign up form to get instant access to your Able trial account. No credit card required.

Step 2. Connect Able to Shopify

1. Add the following code to the Settings — Checkout — Additional scripts in Shopify:

<script>
(function() {
var el = document.createElement('script');
el.src = 'https://app.formsable.com/ue.js';
el.async = 'true';
el.addEventListener('load', function() {
  uipe('init', "%%FUNNEL_MARK%%")
  uipe('track', 'Purchase', {
    deal_value: '{{ total_price | money_without_currency }}',
    deal_currency: "{{ currency }}",
    deal_items: [ {% for line_item in line_items %}
      {
        sku: "{{ line_item.sku }}",
        qty: {{ line_item.quantity }},
        price: '{{ line_item.line_price | money_without_currency }}',
      },
    {% endfor %} ],
    order_id: {{ order_number }},
    keys: {
      email: "{{ checkout.email }}",
      phone: "{{ checkout.customer.phone }}",
      client_id: "shopify:{{ checkout.customer.id }}",
    },
    lead: {
      firstName: "{{ checkout.billing_address.first_name }}",
      lastName: "{{ checkout.billing_address.last_name }}",
      city: "{{ checkout.billing_address.city }}",
      country: "{{ checkout.billing_address.country_code }}",
      state: "{{ checkout.billing_address.province_code }}",
      zip: "{{ checkout.billing_address.zip }}",
    },
  })
})
document.head.appendChild(el);
})();
</script>

(Where %%FUNNEL_MARK%% is the unique funnel identifier.)

2. It's strongly recommended to add Able CDP visitor tracking code to the rest of the website pages as well. It records Facebook and Google click ids when a visitor first comes to the website, and uses Google Analytics Client Id in addition ad platform browser ids to better track customers. (Google Analytics must be installed for this tracking script to work correctly.)

This code can be added to Shopify store by editing the theme.liquid template or using GTM.

Visitor tracking code example below supports tracking standard Shopify Lead and Contact forms. It needs to be extended if you're using additional lead generating plugins or landing pages.

<script>
(function() {
var el = document.createElement('script');
el.src = 'https://app.formsable.com/ue.js';
el.async = 'true';
el.addEventListener('load', function() {
  uipe('init', "%%FUNNEL_MARK%%");
  uipe('track', 'PageView');
  (function() {
  var leadForm = document.getElementById('contact_form');
  if (leadForm) {
  leadForm.addEventListener('submit', function () {
    var leadParams = {
      keys: {
  email: leadForm.elements['contact[email]'] && leadForm.elements['contact[email]'].value, phone: leadForm.elements['contact[phone]'] && leadForm.elements['contact[phone]'].value
      }, lead: {
 
      }
    };
    uipe('track', 'Lead', leadParams);
  });
  }
  })();  
});
document.head.appendChild(el);
})();
</script>


3. After Shopify purchases begin to appear in Able CDP under Customers — Purchases tab, set up one or a few of the supported outbound Purchase conversion integrations listed below. If you're currently sending Purchase events to the same service using another integration or tracking code, it's recommended to disable sending Purchase conversions with it and only send Purchase conversions using Able CDP Conversions API integration to prevent duplicates.

Step 3. Add Google Analytics Property Id to Able to send payments as Google Analytics e-commerce conversions

1. The first step is to locate the Google Analytics tracking id for the property you’d like to use for reporting.

Open Google Analytics, Admin – Property Settings page. Tracking Id should be the first item on the list. Record it.

2. Able Setup

Open ‘API Credentials’ tab in the Able CDP Dashboard. Select ‘Google Analytics’ service and enter Tracking Id in the Access Token field. Leave Refresh Token blank and enter arbitrary name you’d like to use as a reference (for example, corresponding Google Analytics property name). Press ‘Save’.

Open ‘Outbound’ tab. Select the Google Analytics Credential you’ve just saved and ‘Purchase’ event type. Press ‘Save’.

At this point required integration setup is complete and Able will start sending all Purchases that it attributed to Google Analytics visitors to Google Analytics Measurement API. Conversions will appear in all standard reports; additionally, Purchases will appear in the Conversions tab of E-commerce reports.

Learn More

E-Commerce Conversion Funnel Tracking
Able CDP helps to track modern multiple step e-commerce funnels where customers interact with multiple services prior to eventually making a purchase, resolving issues with incorrect Google Analytics attribution and conversions missing from Google Ads and Facebook Ads reports.

Send Purchases to Google Analytics

Send attributed Purchases to Google Analytics from any source, such as a sending a closed won CRM deal, a successful Stripe Invoice payment or an e-commerce purchase that has been successfully paid.

Send Purchases to Google Ads

Sending conversions to Google Ads is an extremely common integration scenario. Its used to add conversion value to Google Ads’ reports, allowing to report on ROI, as well as to use performance-based targeting and optimization capabilities.

Send Purchases to Facebook Conversions API

Attributing conversions to Facebook Ads is a common task, however doing it with sufficient precision is hard. Sales might happen in CRM, or, when they happen online, customer might not come back to the website, so tracking with Facebook Pixel JS produces substandard results. Able solves this problem with its Facebook Conversions API integration.

Google Analytics
+
Shopify
Start integrating Shopify and Google Analytics right now
“A valuable insight we've got because of using Able Customer Data Platform is that display ads aren't working for us at all... we've been wasting money for years on paid display ads.

Before Able we'd be excited about every lead or email that came through, but after the last year we've determined that those don't convert at all.

And so we've been focusing on paid search, which does have return on investment.”

Bryan Brinton, Co-Founder, Aluvii Software
Contact us for more help if you didn't find what you were looking for

Achieve results

Continuously improve marketing strategy with actionable data produced by Able tracking.

Drive sales
Understand how your customers buy and how segments perform across campaigns even on low volume experimental conversion data when you're still perfecting your pipeline.
Boost ad ROI
Stream back-end conversion data to Google Ads and Facebook Ads Conversion APIs to facilitate ad platforms' AI/ML ad delivery optimization and to create super effective lookalike audiences in real time.
Analyse
Use standard tools such as Facebook Ads, Google Analytics and CRM reports to see exact performance and revenue of each channel and landing page even when sales happen weeks after the initial ad click.