Contents

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.

5 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 for free.

Step 2. Install Able tracking code on the website

After signing up for a free account, Able CDP will prompt you to add code to your website. The tracking code is necessary to allow Able to link further Stripe conversions with the original visitor and TikTok click Id.

Add lead form URLs to the HTML Forms Tracking section to let Able automatically recognize the sign-up and lead forms you're using. Any standard lead form widgets that we could detect during the account setup will appear in the Dynamic Lead Forms Tracking section.

Press "Generate" in the Get Code section to generate a unique tracking code to add to your site.

Able CDP page view tracking doesn't install its own cookies and relies on third-party identifiers such as Google Analytics Client Id to connect customer activity between website pages. Please enable cross-domain measurement in Google Analytics if your landing and lead/order pages are hosted on different domains.

Step 3. Connect Able to Shopify

Attribute Shopify purchases to original customer sources to report marketing sources of all purchases, as well as to understand individual customer journeys.

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 4. Add Google Analytics Property Id to Able to send leads 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. Second, you'll be prompted to save a Google Analytics Tracking ID in Able

3. Enable Outbound Integration

Select the Google Analytics Credential you’ve just saved and ‘Lead’ event type. Press ‘Save’.

Enabled for the following event types:

Step 5. Send purchase info to Google Analytics

Following the above process for sending leads, you will be prompted to set up the purchase integration to 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.

The first step is to check Google Analytics reporting settings and investigate that the property is set up correctly to display e-commerce conversions.

On Google Analytics, Admin – Ecommerce Settings. Enable Ecommerce should be on, Enhanced Ecommerce – off.

There’s also a setting that configures for how long GA attributes purchases to the user after the conversion sources. It is located under Admin – Tracking Info – Session Settings – Campaign timeout.

To connect Google Analytics with Able, locate the Google Analytics tracking id for the property you’d like to use for reporting.

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

2. Save Google Analytics Tracking ID to Able

3. Enable Outbound Integration

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.

Example of attributed Shopify conversions appearing in a Google Analytics 4 report.

We offer integration with the new Google Analytics 4. Universal Analytics will shut down in July 2023, so we recommend beginning the process of sending data to GA4 now so you have time to familiarize yourself with the platform and begin accumulating data there.

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.

Shopify
+
Google Analytics

Start integrating Shopify and Google Analytics right now

Don't just take our word for it

Software companies, e-commerce stores and various types of digital businesses around the world are using Able CDP to fundamentally improve their marketing strategy.

As the owner of Placówkowo, Poland's premier educational listing site, having detailed insights into our transactions is paramount. Able CDP's integration of Stripe with Google Analytics 4 e-commerce has been a game-changer. With their expertise, every Stripe transaction now seamlessly reflects in GA4, providing us with invaluable insights into our financial performance and user behavior. This fusion not only enhances our data clarity but also streamlines our business operations. Able CDP's responsiveness and customer-centric approach have made this integration smooth and efficient. We wholeheartedly endorse their services and appreciate their commitment to excellence.

Łukasz Ostrowski
Łukasz Ostrowski
Owner of Placówkowo
Placówkowo