592 members online now
592 members online now
Learn to identify referral spam traffic, as well as best practices to reduce referral spam in your Google Analytics account
Guide Me

Source / Medium overwrite manually for different sub directories?

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭



I have a website where, I am considering my 20 sub directories as separate websites.

(e.g) and it's sub directories like and more.


I am tracking my websites in GA via GTM (All sub-directories having different GTM container and GA Property). Now my concern is, I want to pass the first source and medium itself across all the other properties. If user A arrives to website via Google adwords and performs some action in site and visits then the source and medium should be as Google / CPC and the same for other source and medium.


In previous analytics forum, someone has posted a response to it like, 


with the document.referrer cookie, we can get the referring URL and save the source and medium based on the URLs and can be able to pass it to other sub directories also. I am checking for that thread which I am not able to access it. If anybody here can help with the URL classification and it's appropriate source and medium, It would be great help for me.


That was performed using If statement like



if URL contains gclid then it will be segmented as Google adwords / cpc and only contains google then Google / organic, likewise.


Thanks in advance,


Marked as Best Answer.
Accepted by topic author Kristopher
December 2015

Re: Source / Medium overwrite manually for different sub directories?

Follower ✭ ✭ ☆
# 2
Follower ✭ ✭ ☆

In the old days of GA with Classic analytics, this is actually how the default behavior of GA's cookies would work. However, with the advent of Universal Analytics, this all changed. You could start duct-taping things together with custom cookies, however that gets really messy.

What I would suggest as a more concise solution would be one property for GA where you then create filtered views for each of your sub-directories along with a "master view" sans the filters that limit its data to any single sub-directory. This approach would achieve the same effect as a distinct property per sub-directory but give you the flexibility of aggregated reporting to answer questions at the higher-level.

Hope this helps. Happy to hear your feedback on the idea.


-Caleb Whitmore

Re: Source / Medium overwrite manually for different sub directories?

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hi Caleb Whitmore, I apology for late reply and thanks for the suggestion. It's really good and I am already in it. The problem is, I am getting more than 10 million visits a week, which creates a data sampling by GA. To avoid it, I am trying this method.