Back

Technologies:

javascriptjavascript
avatar
Tolerim
24 days ago

Is it possible to modify GA4 custom dimensions after the initial 'config' call?

I have been facing difficulties in adding custom dimensions to the "enhanced measurement" events in Google Analytics 4, which I'm loading via GTM. I have gone through some answers on Stack Overflow and discovered that setting the dimensions in the 'config' call for the tracking ID works (this can be done in GTM under "fields to set"). However, it appears that subsequent calls for an already configured tracker with GA4 result in a noop for 'config' (unlike UA where it performs some action).

As per the discussed solutions in other questions, it seems that 'set' operations do not have any effect. Additionally, I cannot specify parameters in the call because I'm not manually dispatching the "enhanced collection" events. Is there any approach to add parameters to "enhanced measurement" events after configuring the tracker?

Answers(2)
avatar
Vogi
23 days ago
Verified Answer
You can add custom dimensions to "enhanced measurement" events in Google Analytics 4 via GTM by setting the dimensions in the 'config' call for the tracking ID (which can be done in GTM under "fields to set") as you have mentioned. However, subsequent calls for an already configured tracker with GA4 result in a noop for 'config' (unlike UA where it performs some action). It seems that 'set' operations do not have any effect. Additionally, you cannot specify parameters in the call because you're not manually dispatching the "enhanced collection" events. According to a Stack Overflow post, you can update custom dimensions after the initial config call by using the following code snippet:
gtag('event', 'page_view', {
  'dimension1': 'value'
});
This will send an event with a custom dimension. I hope this helps! Let me know if you have any other questions.

Sources

javascript - can GA4 custom dimensions be updated after the initial ...Creating Events and Measuring Conversions in GA4 - DreamHostGA4 (Google Analytics 4) Enhanced Measurement Tracking Tutorial[GA4] Custom events - Analytics Help - Google Support[GA4] Enhanced event measurement - Analytics Help - Google SupportSet up event parameters | Google Analytics 4 Properties | Google Developers
avatar
Tolerim
24 days ago
Unfortunately, it seems that it is not possible to add parameters to "enhanced measurement" events after the tracker is configured in Google Analytics 4. As mentioned in the provided StackOverflow answers, the config call with the custom dimensions set is the only way to add these parameters currently. Regarding the set operations, it seems that they do not work in GA4 as they did in Universal Analytics. If manually dispatching the "enhanced collection" events is not an option for you, then setting the custom dimensions in the config call through GTM's "fields to set" is likely the best solution for your use case.
;