I have google analytics 4 being loaded via GTM, and i've been struggling with adding custom dimensions to the "enhanced measurement" events. after reading some other answers i've determined that yes, the dimensions work when set in the 'config'
call for the tracking id (which i can do in GTM under "fields to set"), but 'config'
seems like it noops on subsequent calls for an already configured tracker with GA4 (with UA it does something).
as discussed in the other questions, 'set'
operations don't seem to do anything, and i'm not manually dispatching the "enhanced collection" events so i can't manually specify the parameters in the call.
is there any way to add parameters to "enhanced measurement" events after the tracker is configured?
a minimal example:
gtag('set', {'dimension1': 'test1'})
gtag('config', 'G-XXXXX', {dimension2: 'test2'})
gtag('set', {'dimension3': 'test3'})
gtag('event', 'test', {send_to: 'G-XXXXXX', foobar: 'baz'})
the debugger shows the event parameters: en: test _ee: 1 ep.dimension2: test2 ep.foobar: baz
on a page navigation the automatic enhanced collection event looks like this: en: page_view ep.dimension2: test2 _et: 922
however when using an old GA account:
gtag('config', 'UA-XXXXXX')
gtag('event', 'test', {send_to: 'UA-XXXX', foobar: 'baz'})
it shows all the set dimensions: "dimension1": "test1" "dimension3": "test3" "&jsscut": "1" "hitCallback": [function] "hitType": "event" "eventCategory": "general" "eventAction": "test"
why does the G4 integration not pick up on set dimensions? and is there any way to modify dimensions after the tracker is configured other than including them on the event call
config
again doesn't seem to do anything or affect future events, with or withoutsend_page_view
specified – Spinescent