Google Analytics

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

The current version of Google analytics is GA4. This documentation page is written to be used with GA4 and Fastspring Popup, Embedded and Web Storefronts. For information about migrating from Universal Analytics, please refer to Migrating from Universal Analytics to GA4.

Prerequisites

  • Create your Google Analytics account and copy your Google Analytics Measurement Id.
  • Set up the google analytics snippet code into your website according to the google documentation.
  • Cross-Domain Tracking for Popup/Embedded Storefronts

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 Measurement ID in the Google Analytics Measurement 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 the 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 Measurement 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.

Cross-Domain Tracking for Web Storefronts

Enable the cross-domain measurement and further define which links on your site do not trigger Outbound Click events when using enhanced measurement.

  1. Open your Google Analytics account. Go to the Admin menu.
  2. Choose the GA4 property that you want to modify. Then select Data Streams.
  3. Choose the data stream to modify.
  4. Under the Google tag section, select Configure tag settings.
  5. Under the Settings section choose Configure your domains.
  6. In the form add a new row with the following data (as the following image):
    a. Match type: Contains
    b. Domain: onfastspring.com

  1. Repeat the previous steps to also include the domains paypal.com and sofort.com.

Cross-Domain Tracking for Popup and Embedded Storefronts

When using SBL (Store Builder Library) to start a popup or embedded checkout, 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.9.2/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, please replace the <MEASUREMENT_ID> with your own:

function decorateURL(url) {
      window.clsid = {
         client_id: '',
         session_id: ''
      };
      gtag('get', '<MEASUREMENT_ID>', 'client_id', function(r) {
         window.clsid.client_id = r
      });
      gtag('get', '<MEASUREMENT_ID>', 'session_id', function(r) {
         window.clsid.session_id = r
      });
      var _pl = '&clientId=' + window.clsid.client_id + '&sessionId=' + window.clsid.session_id;
      return url + '?' + _pl;
}