Pregunta

I have analytics.js deployed through GTM using standard fields (no custom html) just macros in assigning the field values for a standard pageview. I am attempting to set the clientId as a custom Dimension in GTM but it doesn't seem to work.

Steps taken:

Tag 1 - Custom html with Firing rule = {{event}} equals gtm.load

<script>
 var clientId = ga.getAll()[0].get('clientId'); 
 dataLayer.push({'UAID': clientId});
</script>

Tag 2 - Standard GTM fields using Universal Beta, Track type = event, and Custom Dimensions index = 1 and Dimension = {{MYMACRO}}

Firing rule = {{event}} equals UAID

MYMACRO = Macro Type as Data Layer Variable, with UAID as the Macro name.

Any thoughts why this is failing? I didn't want to set as pageview to not double count pages, and not as an event (I can push this as an event) but it makes sense to be a Custom Dimension.

¿Fue útil?

Solución

You do not seem to have an event called UAID. Not every variable in the datalayer automatically becomes an event, you need to use the "reserved" varibale name "event":

<script>
 var clientId = ga.getAll()[0].get('clientId'); 
 dataLayer.push({
    'UAID': clientId,
    'event': 'UAID'
 });
</script>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top