Google Universal Analytics

Last modified June 29, 2017


Setting up Google Analytics and Google Tag Manager in FastSpring

Each Storefront has its own setup for Google Analytics and Google Tag Manager. You can use either Google Tag Manager or Google Analytics separately or both together. If you use both together and your Tag Manager setup contains Google Analytics, you should not set Google Analytics up in FastSpring separately. In the Dashboard, select the Storefronts menu and click SETTINGS for the Storefront you want to edit; then, click the Analytics Integration link on the left-hand side of the Storefront Settings page.

In the Google Tag Manager custom container ID for this storefront field, type your Google Tag Manager Container ID. This should have a format similar to GTM-XXXX.

In the Custom Google Analytics property ID for this storefront field, type the property ID for your Google Analytics account. This should have a format similar to UA-NNNNNN-N. Note: If your Google Tag Manager setup contains Google Analytics, you should skip this field and specify only the Google Tag Manager container.

After you specify the IDs for one or both of these fields, there are additional steps you need to perform in your Google accounts.
 

Tip

If you need to troubleshoot your Google Analytics or Google Tag Manager implementation, the  GA Debugger  extension for the  Google Chrome  Web browser can be a useful tool. This tool, which can be toggled on or off in  Chrome , prints helpful information - such as error messages and warnings - to the JavaScript Console. This may help you identify problems with the way your tracking code has been implemented.

Note about ad blockers

Due to the increasing popularity of ad blocking software / browser add-ins on customers' systems, as many as 10% to 15% of transactions might not be reported to Google Analytics.  This can influence reporting accordingly.  However, ad blockers also directly impact the traffic you see on your website; it will also be underrported by the same amount. Therefore, relative analysis such as conversion rates will not be affected - but absolute numbers of visitors, page views, etc., will be.

As an alternative to browser-based customer interaction tracking, you might consider implementing server-side tracking via Google Measurement Protocol.


Google Analytics

After you have set the Google Analytics property ID in the FastSpring Analytics Settings, it is best to align the time zones used by FastSpring (GMT +0) with the time zone used by your Google Analytics account. Matching time zones makes it easier to compare reports from both sources. To align the time zones, log in to your Google Analytics account, and navigate to Admin > View > View Settings. Choose "United Kingdom" for the Time zone territory. Leave the GMT +00:00 setting as it is.

Next, open Ecommerce Set-up in your Google Analytics Property view. Choose to enable Ecommerce and Enhanced Ecommerce Reporting.

Then, create the following 5 checkout steps:

  1. Payment Option Selected
  2. Name Entered
  3. Email Entered
  4. Payment Data Entered
  5. "Buy Now" Button Clicked

Your Ecommerce setup must look like this:

Click Save. Your Google Analytics account is set up and ready to receive data.


Cross-Domain Tracking Through the Use of the Linker Plugin

You must use the linker plugin from Google in order to ensure that tracking is not lost between your site and FastSpring's store.  There are a couple ways you can implement this on your website, depending upon what kind of Storefront you are linking to.

For Web Storefronts

Include the following lines in the Google Analytics code placed on your website:

Copy and paste the following code to your site:

  ga('require', 'linker');

  ga('linker:autoLink', ['mywebsite.com', 'fastspring.com']);

Note

Replace 'mywebsite.com' in the above code with your own domain (e.g. acme.com). Do not include the protocol or a full URL.
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('send', 'pageview');
  ga('require', 'linker');
  ga('linker:autoLink', ['acme.com', 'fastspring.com']);
</script>


For Popup Storefronts

Include the following decoration attribute in the script that loads the FastSpring library:

Copy and paste the following into the script that loads your FastSpring Storefront / 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.7.4/fastspring-builder.min.js"
    type="text/javascript"
    data-storefront="furiousfalcon.onfastspring.com/popup-furiousfalcon"
    data-decorate-callback="decorateURL">
</script>


Then, add the following script to your page, just before the closing </body> tag:

Copy and paste the following code into your page:

<script>

    function decorateURL(url) {

                var linkerParam = null;

                ga(function() {

                                var trackers = ga.getAll();

                                linkerParam = trackers[0].get('linkerParam');

                });

                return (linkerParam ? url + '?' + linkerParam : url);

    }

</script>


Setting up Referral Exclusions in your Google Analytics account

To prevent issues with tracking being lost when customers are redirected or referred to other domains (e.g. for payment), it is important to set up referral exclusions in your Google Analytics account.

Step-by-step instructions for doing this can be found at https://support.google.com/analytics/answer/2795830?hl=en.

We recommend that you add the following domains to the Referral Exclusion list:

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