Google Universal Analytics tag - Document referrer option

Bronze Contributor
Bronze Contributor

Hello,

 

I want to use the Document Referrer option of a Google Universal Analytics tag as described into the Google Analytics Developers documentation. My goal is to map a cookie variable to override the referrer captured by the GUA tag (because of a redirection on the site landing page that prevents GUA tag to fire).

 

But unfortunately I don't see this option into the "campaign" mapping options of the Tealium GUA tag. Is there any valid option to setup my request?

 

Many thanks in advance for the precious help!

 

Kind Regards,

 

Julien.

3 REPLIES 3

Google Universal Analytics tag - Document referrer option

Gold Contributor
Gold Contributor

What you can do for now is to edit the Google Analytics tag template, @JulienLegras. Look for these 3 lines and add the 4th:

 

"campaignMedium" : {"name" : "campaignMedium", "type" : "exists", "reset" : true},
"campaignContent" : {"name" : "campaignContent", "type" : "exists", "reset" : true},
"campaignKeyword" : {"name" : "campaignKeyword", "type" : "exists", "reset" : true},
"referrer" : {"name" : "referrer", "type" : "exists", "reset" : true},

 

Then look for these 3 lines, and add the 4th:

 

if (u.data.campaignMedium) {u.all("set", "campaignMedium", u.data.campaignMedium);}
if (u.data.campaignContent) {u.all("set", "campaignContent", u.data.campaignContent);}
if (u.data.campaignKeyword) {u.all("set", "campaignKeyword", u.data.campaignKeyword);}
if (u.data.ref) {u.all("set", "referrer", u.data.ref);}

 

The last line contains "ref" and should be the name of the corresponding datalayer parameter. In my case I have a "ref" query parameter I use for this.

Freelance Web Analist

Google Universal Analytics tag - Document referrer option

Tealium Employee

Hi @JulienLegras

 

So the way to do this without modifying the template is through a mapping.

There is an option for Custom Set Command:

 

setcmd.png

This will allow you to map the anything you want onto the set command.

 

Adrian

Ask me anything Tealium related or TypeScript/JavaScript, or NodeJS.
Please remember to mark solutions as accepted for future searchers.

Google Universal Analytics tag - Document referrer option

Bronze Contributor
Bronze Contributor

Hi @AndreScholten and @adrian_browning,

 

Thanks a lot for your help on this. Indeed, the "Custom Set Command" mapping is the easiest solution, but it wasn't obvious for me to look into the "Standard" mapping category (I went through the "Campaign" category where I didn't found the "set.referrer" documented into GA developers guide).

 

Anyway, that is good to know and thanks again.

 

Julien.

Public