google-analyticscustom-dimensions

Google Analytics Custom Dimensions Not Tracking


I want to split test different layouts on my site, and to track this I want to use a Custom Dimension which is named Split and equal to 1 or 2.

I've configured the Custom Dimension in Google Analytics and added the code like this:

// Google Analytics 
gtag('config', 'UA-70465331-1'), {
'custom_map': {'dimension3': 'Split'}
});

// Sends the custom dimension to Google Analytics.
gtag('event', 'SplitTest', {'Split': "2"});

However, when using the Google Tag Assistant, the Custom Dimension isn't appearing under Events.

The live page is: https://www.travelden.co.uk/mindblowing-new-hotels-in-the-maldives

Can anyone see where the error is?

Much appreciated!


Solution

  • It is coming through: enter image description here enter image description here

    You need to be careful to set the event to "non-interaction",

    I would also suggest you to not send an event if you don't need it...so something like this:

    gtag('config', ''UA-70465331-1', { 'dimension3': '2' });
    

    Doing it this way the dimension is applied when the page is loaded, which is really what you're testing, the layout.