Expand my Community achievements bar.

SOLVED

issue with Google Analytics custom dimension persists between calls

Avatar

Level 5

Hi,

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.

E.g.

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

Stefan

1 Accepted Solution

Avatar

Correct answer by
Level 2

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'
     });

1548458_pastedImage_2.png

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

View solution in original post

3 Replies

Avatar

Correct answer by
Level 2

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'
     });

1548458_pastedImage_2.png

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

Avatar

Community Advisor

stefanm38281801,

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.

Avatar

Level 5

Hi Stewart, Robert,

yes it did solve our issue... just needed to verify with my colleagues.. I marked the question as answered.

Thanks

Stefan