How to override Source and Medium for Google Analytics?

Silver Contributor
Silver Contributor
I'm looking to Override the source and medium values for google analytics when our sales reps are logged in as a user, otherwise to have it just do source and medium as usual. I've already set up the variables with "set data values" extensions containing the right conditions to identify when it's a rep session. However, there doesn't seem to be a way to map them to the google analytics tag. And, I can't set it up as a separate javascript tag because the call to set those values needs to happen after the google javascript file loads, but before the send call. Help pretty please!
4 REPLIES 4

How to override Source and Medium for Google Analytics?

Tealium Employee
Hi Sarah, Unfortunately Google Analytics does not allow users to set campaign details by default using JavaScript, therefore our UI cannot handle this. These two links below describe this in detail: http://blog.intlock.com/_setcampvalues-for-google-analytics/ http://blog.intlock.com/setting-google-analytics-campaign-tracking-using-javascript/ The links do provide an option to manually overwrite but it's not an easy solution and will take considerable testing to ensure this is configured correctly. If you want to go this route please contact your Account Manager and discussions can be held to determine feasibility.

How to override Source and Medium for Google Analytics?

Employee Emeritus
Going off what Dan said, as an alternative, we are recommending users migrate to Google Universal Analytics if possible. It supports setting values for campaign variables by default. Google has a lot of documentation on the migration process available, and we are preparing an informational post from a Tealium perspective. EDIT: It's done, you can view it here: https://community.tealiumiq.com/posts/649921-transitioning-from-google-analytics-ga-to-google-univer...

How to override Source and Medium for Google Analytics?

Silver Contributor
Silver Contributor
I actually found a way to make it work. It was a bit hacky, but I simply replaced out the values I wanted in the google cookie being set by our site, and voila! We are using both versions of Google Analytics for now because that is the recommendation from our reps, so I need both versions to be populating. Thanks for your help.

How to override Source and Medium for Google Analytics?

Employee Emeritus
That would make sense, since GA had most information stored in cookies client-side, and sent it all along with every request. GUA is different in that it does all the processing server-side, so it only has one cookie value: the visitor's UID. Glad you got it to work though!
Public