0

Is it possible to know, what campaign source, media, etc are set for current session in google analytics? Is there some javascript method on Tracker instance maybe? or some serverside code? Or does google analytics work as a blackbox, and not queriable per user?

I have a lot of e-commerce data, which is serverside tracked, by my server code. So I'm looking for a way to pass utm values to server, so it could track them too. I understand that I could pass more e-commerce information to analytics.js from serverside, but can I have dataflow in another direction too?

1

UTM values are in the query string. Just get those URL parameters!

google.com/?utm_source=the_source&utm_medium=the_medium&utm_term=the_term&utm_content=the_content&utm_campaign=the_name

In PHP, you can inspect the values using $_GET['utm_source'] for example.

  • this is what I did before. And yet, some traffice sources are given their utm sources in google analytics, but do not have utm_source= parameter in query string. Google adwords, for example. Also google analytics can parse utm_source= parameter after #anchor part, and I'm not even mention google tag manager, which looks like it can tag campaign sources on google analytics server side, without any query parameters whatsoever! – codesnik May 15 '15 at 19:19
  • Use Javascript to POST the variables on document load stackoverflow.com/questions/901115/… – alekstrust May 16 '15 at 20:09
  • Actually, as I see it, you can't be 100% synchronized with google analytics on campaign parameters, if you're using Universal Analytics. It would work ok, if you still using older google analytics counter. – codesnik May 18 '15 at 15:18
  • Correct, Universal analytics passes a single id parameter that is mapped to the rest of the values on Google's servers. – Stephen Ostermiller Dec 11 '15 at 2:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.