GA Integration

Summary

This page describes how to set up Google Analytics to track engagement for fuse tag multivariate testing.

Each fuse configuration has a unique ID that can be set as a custom dimension in GA. The ID will be available to set in Google Analytics at window.fusetag.fuseUUID

Customer Setup

Steps for the customer are:

  1. Setup Fuse UUID Custom Dimension in Google Analytics
  2. Update Google Analytics to record Fuse UUID

Setup Fuse UUID Custom Dimension

The customer needs to set up a custom dimension in Google Analytics with scope ‘Hit’. Steps for setting up a custom dimension in Google Analytics can be found here

The customer needs to record

  • Index of new custom dimension
  • Name of new custom dimension e.g. Fuse UUID

Update Google Analytics initialisation to record Fuse UUID

We would like the Fuse UUID to be captured in all GA events. To ensure this happens, the new custom dimension value should be set when GA is initialised.

The Fuse UUID is only available after the fuse script has loaded, so GA setup should be done after the fuse script is loaded

<script async src="fuse.js"
<script type="text/javascript">
  var fusetag = window.fusetag || { que: [] };
  fusetag.que.push(function() {
    // Initialise GA Here with custom dimension
    // Example for gtag
    gtag('config', 'UA-XXXXX-Y'
      'custom_map': { 'dimension1': 'fuse_uuid' },
      'fuse_uuid': fusetag.fuseUUID
    );
  });
</script>

Google Tag Manager

Configuration of Google Tag manager to set the fuse UUID on start up can be done below. Here the index of the custom dimension is 1.

gtag('config', 'UA-XXXXX-Y'
  'custom_map': { 'dimension1': 'fuse_uuid' },
  'fuse_uuid': fusetag.fuseUUID
);

Google Analytics (analytics.js)

The fuse UUID can be set in custom dimension index 1 as:

ga('set', 'dimension1', fusetag.fuseUUID);

Google Analytics (ga.js)

The fuse UUID can be set in custom dimension index 1 as:

window._gaq.push([_setCustomVar', 
  1, // custom dimension index
  'fuse_uuid',
  window.fusetag.fuseUUID
]);