alexweberk
alexweberk

Reputation: 1031

Google Analytics Get Custom Dimension After Setting One

In Google Analytics, after setting a custom dimension via:

var tracker = ga.getAll()[0];
tracker.set('dimension1', 'myCustomValue');
tracker.send('pageview');

I'd like to then GET the custom dimension value for that user when a user navigates to another page, via something like:

var tracker = ga.getAll()[0];
var dimension1_value = tracker.get('dimension1');  // 'myCustomValue'

Is there a way to do this?

Upvotes: 1

Views: 264

Answers (1)

Eike Pierstorff
Eike Pierstorff

Reputation: 32760

There is no way native to Google Analytics to do this. Values are not stored in cookies anymore and there is no backchannel to the analytics server, get after set only works on the same page.

But of course nothing stops you from setting your own cookie/session storage and store the value(s) there (but then you knew that).

Upvotes: 1

Related Questions