Does google analytics keep custom dimensions value over time?

1.3k views Asked by At

Does a "user scope" dimension will keep track on the changed to the dimension value? Will it remember the value that was set to the dimension on a past period even if it was already being updated? Will the dimension value it always correlated to the report time period or that it is being overwrite every update?

1

There are 1 answers

0
Eike Pierstorff On

To back up DalmTo's comment with some evidence I did the science and built a very small test page:

<html>
<head>
<title>Test</title>
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-XXXXXX-XX', 'auto');


 var d = new Date();
 var currentTime = d.toLocaleTimeString();

  var dimensionValue = 'I am userscope' + d + " - " + currentTime;
  ga('set', 'dimension1', dimensionValue);

  var dimensionValue = 'I am sessionscope' + d + " - " + currentTime;
  ga('set', 'dimension2', dimensionValue);

  var dimensionValue = 'I am hitscope' + d + " - " + currentTime;
  ga('set', 'dimension3', dimensionValue);

 ga('send', 'pageview');
</script>
</head>
<body>
</body>
</html>

So this sends a stupid message plus the datetime as dimension value.

The purpose of the test case was to make sure that nobody but me accesses the site and that all calls come from the same client id/user (albeit in multiple sessions). As an added benefit with just a few hits processing time in GA is just a few minutes, so I got to see the results quickly.

I called this a few times around 12 o'clock and then again a few minutes ago.

Results:

  • hit scoped custom dimensions are set per hit (no suprise here)
  • session scoped dimensions get the last value in the session (dito)
  • user scoped dimensions get the last value in the session. But they are assigned per session, not per user.

Potentially relevent screenshot:

enter image description here

These are two sessions for the same user which nonetheless show two different values for a user scoped custom dimension. So it's like Daimto said, only now you have a test case you can reproduce and do not need to rely on anyone's experience :-)

Of course that means you should take care yourself not to set user scoped dimensions more than once per user (else you might get inconsistencies in your segments).

(For completeness sake this would probably need to be repeated in a UserId view with session stitching enabled, but I doubt that it'll make much of a difference).