Collapse Menu
Documentation
FastSpring App
Contact Support

Google Universal Analytics

Overview

Set up Google Analytics integration with your FastSpring Store.

If you use Google Tag Manager to manage Google Analytics, do not integrate Google Analytics with your FastSpring Storefront. Instead, follow instructions to integrate Google Tag Manager.

Set up Google Analytics in the FastSpring App and configure Google Analytics settings for time zone, ecommerce, cross-domain tracking, and referral exclusions.

Prerequisites

Set up Google Analytics Integration

For all Storefronts:

  1. In the FastSpring App, navigate to Integrations > Extensions > Google Analytics.
  2. Click Setup
  3. Enter your Google Analytics Tracking ID in the Google Analytics Property ID field and click Enable.

For Individual Storefronts:

Only configure custom Google Analytics integration for individual Storefronts if you need to use different IDs for different Storefronts. Otherwise, configure Google Analytics integration for all Storefronts following the steps above.

  1. In the FastSpring App, navigate to Storefront you want to modify and click Settings.
  2. Within the Storefront Settings, click Analytics Integration in the left menu.
  3. In the Google Analytics Integration Behavior drop-down, select Use custom Google Analytics property ID for this storefront.
  4. Enter your Google Analytics Tracking ID in the Google Analytics > Custom Google Analytics property ID for this storefront field and click Save at the top right-hand corner of the page.
If you experience data issues, use Google to Troubleshoot Data in your Reports or Troubleshoot Tag Setup and no-data Issues. Alternatively, use Chrome Extensions Google Analytics Debugger and Tag Assistant.

Ad-blocking tools may cause as many as 10 to 15 percent of transactions to not be reported to Google Analytics. However, ad blockers also similarly impact the traffic reported to Google Analytics. Therefore, relative analyses (such as conversion rates) are unaffected while absolute numbers (such as visitors and pageviews) are affected. Google Measurement Protocol is a server-side tracking alternative to browser-based customer interaction tracking.

Configure Google Analytics Settings

Time Zone

Align the time zone used by FastSpring (GMT +0) with the time zone used by your Google Analytics account to make it easier to compare reports from both sources. Navigate to your Google Analytics View Settings and set the Time zone country or territory to United Kingdom and GMT +00:00.

Ecommerce

  1. Go to Ecomerce Settings for each Google Analytics view in which you want to see data (see Google Analytics instructions to enable ecommerce for a view).
  2. Select On for Enable Ecommerce.
  3. Select On for Enable Enhanced Ecommerce Reporting.
  4. Create the following checkout funnel steps:
    • Payment Option Selected
    • Name Entered
    • Email Entered
    • Payment Data Entered
    • "Buy Now" Button Clicked
  5. Click Save.

Cross-Domain Tracking for Web Storefronts

Cross-domain tracking ensures that tracking is not lost between your site and FastSpring store. Do not complete this step if you are using Google Tag Manager.

Copy and paste the following code in the Google Analytics code placed on your website, replacing both occurrences of 'yourcompany' in the code with the base URL for your Web Storefront:

  •   ga('require', 'linker');
      ga('linker:autoLink', ['yourcompany.onfastspring.com','yourcompany.test.onfastspring.com']);

Example of Google Analytics linker plugin code for use on your website

  • <script>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','https://www.google-analytics.com/analytics.js','ga';);
    
      ga('create', 'UA-93623912-1', 'auto');
      ga('require', 'linker');
      ga('linker:autoLink', ['yourcompany.onfastspring.com','yourcompany.test.onfastspring.com']);
      ga('send', 'pageview');
    </script>

If you are using global site tag (latest) version:

Cross-domain measurement with gtag.js adds a linker parameter to URLs that point to the destination domain. The linker parameter is identified in URL query parameters with the key _gl:

  • https://www.example.com/?_gl=1~abcde5~

On the destination domain, gtag.js is configured to check for linker parameters in the URL. If a valid linker parameter is found, gtag.js extracts the 1st party measurement cookie and stores it. (https://developers.google.com/gtagjs/devguide/linker)

  • gtag("config", 'GA_MEASUREMENT_ID', { 
    linker: { 
    domains: ['yourcompany.onfastspring.com',
                'yourcompany.test.onfastspring.com'],
    }, cookie_flags: "max-age=2592000;secure;samesite=none" 
    });

Example of gtag linker plugin code for use on your website:

  • <script async src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
      gtag('config', 'GA_MEASUREMENT_ID',{ 
    linker: { 
    domains: ['yourcompany.onfastspring.com',
                'yourcompany.test.onfastspring.com'],
    }, cookie_flags: "max-age=2592000;secure;samesite=none" 
    });
    </script>

Cross-Domain Tracking for Store Builder Library

When using Store Builder Library or a Popup Storefront, include the following attribute in the script that loads the FastSpring library:
data-decorate-callback="decorateURL"

Example of loading the FastSpring library with the data-decorate attribute included:

  • <script
        id="fsc-api"
        src="https://d1f8f9xcsvx3ha.cloudfront.net/sbl/0.8.3/fastspring-builder.min.js"
        type="text/javascript"
        data-storefront="yourexamplestore.onfastspring.com/popup-yourexamplestore"
        data-decorate-callback="decorateURL">
    </script>
Copy and paste the following code into your page:
  • <script>
        function decorateURL(url) {
    var linkerParam = null;
    if (typeof ga === 'function' && ga) {
                    ga(function()  {
                                    var trackers = ga.getAll();
                                    linkerParam = trackers[0].get('linkerParam');
    });
    }
                    return (linkerParam ? url + '?' + linkerParam : url);
        }
    </script>

Set up Referral Exclusions in your Google Analytics Account

Prevent issues with tracking being lost when customers are redirected or referred to other domains. 

Follow Google Analytics instructions to set up referral exclusions and add the following domains to the Referral Exclusion list:

  • onfastspring.com
  • <storename>.onfastspring.com (where <storename> is the name of your Storefront, e.g. yourexamplestore.onfastspring.com)
  • paypal.com
  • sofort.com