Analytics
5.3K members online now
5.3K members online now
Learn how to set up goals and Ecommerce tracking, verify accuracy of attribution traffic sources, and discuss funnel visualization, Multi-Channel Funnels, the Goal Flow Report, and Enhanced Ecommerce
 
Guide Me
star_border
Reply

GTM - Extracting Source / Medium Values

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

With Google Tag Manager is there a way to extract or place source / medium  as custom variable in the data layer?

 

More importantly the solution must be able to capture these values from I traffic sources that do not place UTM tracking information in the URL (For example: Organic or Referral Traffic).

 

I heard that this might be possible by using regular expressions in order to extract this information from the cookie (called "__utmz") that Google Analytics stores on the client side, but I am not sure if that is fully accurate. 

Reference: https://productforums.google.com/forum/#!topic/tag-manager/VIgRiSAK32Q;context-place=topicsearchin/t...

1 Expert replyverified_user

GTM - Extracting Source / Medium Values

Top Contributor
# 2
Top Contributor

Hi :-)
For help with GTM related questions, you may also want to ask on the Official GTM Forum

https://productforums.google.com/forum/#!forum/tag-manager

 

I've not used it with GTM however I have used the following script in the past with success

https://github.com/dm-guy/utm-alternative

I've not used it for some time though, so not sure if the current version works well.

 

 

 

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here