Parse Google Tag data into tag

Gold Contributor
Gold Contributor

We have Google ad tags on our site, and are trying to capture the value of "channel" to pass to a tag.  Any ideas?  Thanks.

 

googletag.defineSlot('/6031/reserveamerica.tan/camping//nosubchannel/content//homepage//nosubfeature2', [300,250],'med_rec_top')
.addService(googletag.pubads())
.setTargeting("position", "med_rec_top")
.setTargeting("channel","camping")
.setTargeting("subchannel","nosubchannel")
.setTargeting("feature","content")
.setTargeting("subfeature1","homepage")
.setTargeting("subfeature2","nosubfeature2");
googletag.defineSlot('/6031/reserveamerica.tan/camping//nosubchannel/content//homepage//nosubfeature2', [300,250],'med_rec_bottom')
.addService(googletag.pubads())
.setTargeting("position", "med_rec_bottom")
.setTargeting("channel","camping")
.setTargeting("subchannel","nosubchannel")
.setTargeting("feature","content")
.setTargeting("subfeature1","homepage")
.setTargeting("subfeature2","nosubfeature2");
googletag.enableServices();
googletag.pubads().enableSyncRendering();
</script>

2 REPLIES 2

Parse Google Tag data into tag

Employee Emeritus

@patrick_heavey

Thank you for your question.  I went to your webpage to dig around and I found the code you have referenced in your question.  This code is "hardcoded" on your site and not in a format that is easily reusable.  Here at tealium we highly recommend the use of a Data Layer, in fact it is all over our public websiter:

http://tealium.com/?s=data+layer

 

We also have some information about the the data layer on the community board:

https://community.tealiumiq.com/t5/1-Getting-Started-Documentation/Universal-Data-Object-Guide/ta-p/...

 

I am sure you could write some JavaScript that could scrape the DOM and get the value you are looking for, however this is going to complicated and error prone.

 

It would be better to define utag_data before the Google Publisher Tag, then reuse teh channel value in the publisher tag.  Or put the publisher tag inside of Tealium and map the value of channel to both Google Publisher Tag and all the other tags you want to use.

 

Does this help?

 

Brian

Parse Google Tag data into tag

Gold Contributor
Gold Contributor

@brian_kranson Thanks for the response.  I do understand that using a data layer and putting the Google tag in Tealium is the optimal solution.  Unfortunately, that's not my call, and that's unlikely to happen.

Public