0

Using something that's forcing us to use the old Google Analytics code. And we're wanting to track some offline events using the measurement protocol and combining it with a userID so we can track keyword performance right through to user behaviour after they register.

So I want to know how to do this, if we can't do it through the ga.js then what can we do?

I know we can do this: _gaq.push(['_setCustomVar', 1, 'Section', 'Life & Style', 3]);

But not sure if this will work when we get to the measurement protocol part on server side to match sessions and users for analysing their entire life cycle and journey with their original referring keywords or landing pages when they first found the app.

Show if we can't do this using this version, then what else can we do? Or is there a better way to achieve the above>?

Thanks!

Stefan P
  • 1,013
  • 2
  • 18
  • 34
  • Can you describe in what way you are forced to use ga.js- e.g. do you use a hack like utm cookie evaluation that works only with ga.js, or is the code inserted automatically but you have otherwise access to the page code (in the latter case you could conceivably experiment with a solution that intercepts the push method and send the calls via analytics.js) ? – Eike Pierstorff Mar 26 '17 at 07:02
  • We're sitting behind Cloudflare and use their GA app which is using the old ga.js – Stefan P Mar 28 '17 at 02:47

1 Answers1

0

You cannot send the userId with ga.js. This is not a supported feature in that version of the tracking code.

You could set a custom variable in the ga.js code, a custom dimension via the measurement protocol, pull the respective data sets via the API and try to join the values in an external tool.

However this would not give you any of the advantages of the userId (no session unification in the interface etc.), it would be quite cumbersome and even for a moderately large site you would run into API limits pretty quickly.

Eike Pierstorff
  • 31,996
  • 4
  • 43
  • 62
  • Ok thanks Eike, I appreciate it. I'll maybe just have to consider updating all the tracking code then and switching over – Stefan P Mar 28 '17 at 02:47