Set up Google Analytics to track Fuse experiments

Set up Google Analytics to track Fuse experiments

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

The steps for a publisher are:

  1. Setup Fuse UUID Custom Dimension in Google Analytics

  2. Update Google Analytics to record Fuse UUID

Setup Fuse UUID Custom Dimension

You need 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: https://support.google.com/analytics/answer/2709829?hl=en

You then need to record:

  • Index of new custom dimension

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

Update Google Analytics initialization 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 initialized.

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

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

 

GA4

The setup for GA4 is shown below

  1. <script async src="fuse.js"></script>
  2. <!-- Google tag (gtag.js) -->
  3. <script async src="https://www.googletagmanager.com/gtag/js?id=G-ZZZZZ"></script>
  4. <script>
  5.   var fusetag = window.fusetag || { que: [] };
  6.   window.dataLayer = window.dataLayer || [];
  7.   function gtag(){
  8.     dataLayer.push(arguments);
  9.   }
  10.   
  11.   fusetag.que.push(function() {
  12.     // Initialise GA Here with custom dimension
  13.     gtag('js', new Date());

  14.     // Set UUID custom dimension on config
  15.     gtag('config', 'G-ZZZZZ', { 'fuse_uuid': fusetag.fuseUUID });
  16. </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.

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

 

Google Analytics (analytics.js)

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

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

 

Google Analytics (ga.js)

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

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