0
votes

I can't seem to get the datalayer variable to populate with a value. Unclear of what I've not done correctly.

I've set up a custom dimension, with index 9, in Google Analytics(GA), and I've got an ecommerce trigger which fires in Google Tag Manager(GTM) set up. In GTM I've created a data layer variable, called checkoutStep, which has a Data Layer Variable Name 'step', and in the ecommerce tag I've got the custom dimension mapping for index set to '9' and value set to {{checkoutStep}}.

To be consistent with GTM setup I am trying to leverage the data layer. I can see we already have a data layer push happening:

dataLayer.push({
      'checkoutOption': checkoutOption,
      'event': 'EECcheckoutOption',
          'ecommerce': {
              'checkout_option': {
              'actionField': {'step': 3, 'option': checkoutOption}

I was assuming that that once on the checkout page, that the 'step' value of 3 would get pushed into the datalayer variable, but when I preview the tag properties I see that the custom dimenions 9 is 'undefined' instead of 3.

1

1 Answers

0
votes

Have you used 'step' as dataLayer variable name, or the full reference in the ecommerce object, which would be 'ecommerce.checkout_option.actionField.step'? According to your code, this latter should be used to access the step value within the dataLayer.