issue with Google Analytics custom dimension persists between calls




we have GA (UA) tool setup in DTM. We set some custom dimensions and metrics in event rules. It seems that the custom dimensions are not cleared in between successive event calls.


Event call 1 only sets Custom Dimension 1 to value "A". The 'collect" call on GA contains a parameter "cd1=A".

Event call 2 only sets Custom Dimension 2 to value "B". In event call 2 we actually see that Custom Dimension 1 with value "A" is passed. So the "collect" call on GA contains both "cd1=A & cd2=B".

This seems to be wrong behavior? Is there a way to clear these settings in between calls (cfr clearVars for Adobe Analytics)

Kind regards


Accepted Solutions (1)

Accepted Solutions (1)



Hi stefanm38281801,

There isn't an equivalent to clearVars in GA, but the persistence of certain variables is treated differently in GA vs Adobe. What I assume you are doing is setting the Custom Dimension within the Custom Dimensions and Metrics section of the event based rule. What this section does is sets the dimension globally for any beacons that are sent from the page after the value is set. Setting a Custom Dimension here is the equivalent to calling:

     ga('set', 'dimension1', 'A');.

To have a more locally scoped Custom Dimension where it only applies to a specific GA Event you want to use the Parameters section of the Events area. Here you can set parameters such as Custom Dimensions, Custom metrics, etc. and those will only apply to that event beacon and shouldn't be inherited by any subsequent beacons. Equivalent code of what setting a CD in Parameters looks like:

     ga('send', 'event', 'eventCategory', 'eventAction', {
'dimension2': 'B'


GA documentation for reference: Custom Dimensions and Metrics  |  Analytics for Web (analytics.js)  |  Google Developers

Answers (2)

Answers (2)





Did Robert's response solve your issue?  If so, please mark his answer as correct.  If not, let's keep poking until we figure it out. 

Full disclosure: Robert and I work together at Search Discovery. I saw your question and though I didn't know the answer myself, I guessed that our resident GA/GTM expert, Robert, would know.