Google analytics
  • 16 Sep 2020
  • 1 Minute to read
  • PDF

Google analytics

  • PDF

Article Summary

Introduction

There are several ways to have tracking on ConnectID page. One of them is to configure Google Analytics only on ConnectID. Another is to configure together with other domains and with cross domain tracking by using Google Analytics Plugin.

Google Analytics only on ConnectID page

In order to configure Google Analytics on ConnectID page, you have to configure:

ConfigDescription
GOOGLE_ANALYTICS_TRACKING_IDUA-code from Google for tracking
GOOGLE_ANALYTICS_PLUGIN_LINKERA list of domains use for cross domain tracking in format 'domene1', 'domene2', 'domene3' etc.
GOOGLE_ANALYTICS_ANONYMIZE_IPSet the config to:
  • true if it should anonymize IP
  • false if it should not anonymize IP
  • Set Google tracking id and Google Linker Plugin

    If you would like to set the configurations GOOGLE_ANALYTICS_TRACKING_ID and GOOGLE_ANALYTICS_PLUGIN_LINKER, then following code will be inserted on ConnectID page based on config:

     <script src="https://connectid.se/user/v1/script/google-analytics-script.js"></script>
     <script>
     ga('create', 'UA-12345678-1', 'auto', {allowLinker: true, 'cookieFlags': 'secure;samesite=none'});
     ga('require', 'linker');
     ga('linker:autoLink', ['avis.domene', 'order.page.domene', 'connectid.domene']);  
     </script>
    

    This means that all domains are linked together and gets information about the same user.

    Tracking between domains

    Tracking between domains

    You need only to read this if you want tracking between the domains.

    We can not use the configuration GOOGLE_ANALYTICS_PLUGIN_LINKER if we also going to have tracking between other domains eg. login with Facebook, login with Google or redirect to Payment provider. In order to track the same user between the domains, we need to add _ga-parameter (between the domains) in the full integration in additional to return url and error url.

    We can not set tracking on external parties, therefore we need to send a _ga-parameter.

    URL-format

    The URL when the tracking is active.

    URL format before adding _ga-parameter:

    https://[domain]&returnUrl=[url]&errorUrl=[url]
    

    URL format after adding a _ga-parameter:

    https://[domain]&returnUrl=[url]%26_ga%[value]&errorUrl=[url]%26_ga%[value]&_ga=[value]
    

    Guides for Google Analytics

    For more details about Google Analytics configuration you may get on Google Analytics Page or Google Linker Plugin page.

    Just now also has found quite nice site with introduction to Google Analytics Cross Domain Tracking Explained Like Never Before.