3

I'm migrating from UA to UA inside of GTM, and working on re-creating the custom events that I need using the dataLayer.

I've got GTM installed, UA linked, and a trigger linked to a UA Event tag.

I can see the tag working when I visit Google Analytics -> Real Time -> Events, however the event category, action and label, are all coming through as either undefined, or not set.

Racking my brain here, so any assistance would be gratefully received.

My current code is below:

window.dataLayer.push({
    'event'         : 'Search',
    'eventLabel'    : 'Foo',
    'eventValue'    : 'Bar'
});
2
  • 1
    We would need to see how your GA tag ist set up - the datalayer does not turn automatically into Google Analytics, so we need to know how you mapped the values to the available fields. Commented Jun 28, 2018 at 15:38
  • Hi @EikePierstorff - You set me off on a train of thought that worked. This is now where I understand variables come from. I created them to the names I made in my array that was pushed to the dataLayer, and mapped them to the areas in the Tag. All working perfectly. Thanks for that little tip which led me on the right path! Commented Jun 28, 2018 at 15:54

1 Answer 1

1

This was resolved by not realising that the objects you pass into the array have to be added to GTM as a dataLayer variable.

i.e from my code above, eventLabel, eventValue, would be made as GTM data layer variables.

Then, you have to map these created variables to the event tag that you have made.

Combine that with a trigger and you're good to go!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.