Search code examples
google-tag-manageruniversal-analytics

Universal Analytics tag with custom event and custom variables


I want to create a Universal Analytics tag (with enhanced e-commerce enabled) in Google Tag Manager, firing on custom event, ex.: uaEvent with two custom variables, ex.: uaVar1 and uaVar2.

I already created Data Layer Variables (uaVar1 and uaVar2) and the custom event trigger uaEvent in my GTM container. I'm pushing following data:

dataLayer.push({
  'event': 'uaEvent',
  'uaVar1': 'value',
  'uaVar2': 'value'
});

and firing uaEvent on form submit.

Question

How should I configure my tag in Google Tag Manager container so that 'uaVar1' and 'uaVar2' will be visible and connected to uaEvent in Universal Analytics panel ?


Solution

  • Custom variables have been deprecated in Universal Analytics, so you should now use and configure Custom Dimensions under the Properties column in the GA interface. You will need to define the index and scope. Once you have done that, then for the tag that you want to associate your custom data with in GTM, you will need to specify, under the Custom Dimensions section of that tag, the name of the dataLayer variable for your particular Custom Dimension as well as the index.

    enter image description here