AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
3.1K members online now
3.1K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Subdomain not tracking right

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I have www.domain.com and blog.domain.com. They are both reporting traffic in the reports, which aggregate both sites as one. I have two issues:

 

#1 - Search Console reports do not include anything for blog.domain.com. On the Search Console (Webmaster Tools) website I do have www.domain.com and blog.domain.com as separate websites as per the recommendation it gave. Is that a bad idea? Is that causing the missing search data problem in GA? 

 

#2 - The page URL aggregation is confusing. Most URLs are different between them anyway, but for example with the page "/" (root) the aggregation is confusing. I've heard you can cause reports to add the domain prefix to all pages, but I'm unclear as to how.

 

1 Expert replyverified_user

Re: Subdomain not tracking right

[ Edited ]
Top Contributor
# 2
Top Contributor

GA isn't missing search data, you can only link one domain in Search Console to one Property in GA
That is a limitation of linking the two services.

 

Couple of suggestions..
1) With the current GA Property, the main domain is www.domain.com, leave it linked to Search Console for www.domain.com
Following 'best practices' for GA, leave the initial View with no filters applied.
Create a new View (it wont have past data in it, it will track going forward) and

apply the following filter to prepend the domain name to the Request URI in the content reports etc
Filter Type: Custom filter > Advanced
Field A: Hostname Extract A: (.*)
Field B: Request URI Extract: (.*)
Output To: Request URI Constructor: $A1$B1
Click Save to create the filter.

 

You can then also create a new Property just for the subdomain blog.domain.com

You will need to edit the tracking code on the blog only so as to work for two trackers

eg

<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXX-Y', 'auto');  // current property domain and blog
ga('create', 'UA-XXXXX-Z', 'auto', 'blogTracker'); // blog only
ga('send', 'pageview'); // current property domain and blog
ga('blogTracker.send', 'pageview'); // blog only
</script>
<!-- End Google Analytics -->

You can then link this 2nd Property in GA to the blog.domain.com in Search Console 

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

Re: Subdomain not tracking right

[ Edited ]
Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

I'm confused why I would create a new Property for the blog but have it report blog traffic on both its own property and the main site property?

So when I edit the new tracking code on the blog, the current code also has these lines in addition to what you posted. Should I add any similar lines for these?

__gaTracker('set', 'forceSSL', true);
__gaTracker('require', 'displayfeatures');
__gaTracker('require', 'linkid', 'linkid.js');

Is there a simpler way to track subdomains without editing the GA code? How does everyone else do it?

 

Can't I just delete the subdomain from Search Console and track everything under the www site there? I think that's how it used to work before I read the help section that says I absolutely must add a new Search Console site for each subdomain. As soon as I followed that advice it screwed me all up. If I delete it, is the traffic going to somehow start to be counted again for the main site?

 

I've read it seems like 50 different explanations about how to track subdomains, and every piece of advice is different. 

 

This thread says to create a new View for the subdomain, with a filter to only include traffic for it.

https://www.en.advertisercommunity.com/t5/Filters/Creating-Filters-to-Track-Subdomains/td-p/484731

 

This thread says to not do anything at all and use the exact same code on the main and sub domain.

https://www.en.advertisercommunity.com/t5/Filters/Creating-Filters-to-Track-Subdomains/td-p/484731

 

The visitors will be moving between my main and blog sites a lot, so I think it makes more sense to keep them under one Property. 

Re: Subdomain not tracking right

[ Edited ]
Top Contributor
# 4
Top Contributor

ok.. im editing my reply..in response to your edit.. otherwise this is going to get really confusing really fast.. 
biam with my edited reply

 

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

Re: Subdomain not tracking right

Top Contributor
# 5
Top Contributor

@squeebo wrote:

 

 

The visitors will be moving between my main and blog sites a lot, so I think it makes more sense to keep them under one Property. 



Yes it does and that is how it is usually done. just be aware though you can only link one GA Property to one verified domain in Search Console. This data is not data that is tracked by GA. It is tracked by Search Console which uses different tracking methods

and then it gets imported into GA.

 


squeebo wrote:

 

Can't I just delete the subdomain from Search Console and track everything under the www site there? I think that's how it used to work before I read the help section that says I absolutely must add a new Search Console site for each subdomain. As soon as I followed that advice it screwed me all up. If I delete it, is the traffic going to somehow start to be counted again for the main site?

I would not delete the blog subdomain from Search Console. I would want to be able to see how both domains are doing in relation to backlinks, organic search data etc Search Console tracks differently to GA, and relates specifically to Google 

 

You will be able to log into Search Console and look at the data for each of them if you dont delete the blog.domain.com,

 

Seeing as www.domain.com is the primary domain, I would follow usual conventions and link the Property to that one for that domain in Search Console.

**NB my suggestion regarding a seperate property for the blog was simply that . a suggestion, however it does also complicate the setup somewhat.


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

Re: Subdomain not tracking right

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭
If I don't delete the blog subdomain from SC, wouldn't the search data be unavailable in GA since it has no property to link to?

I can get a little data from SC, but for example I can't get a combined report showing both the queries and landing pages, which I can only get in GA.

Thanks for the help!

Re: Subdomain not tracking right

[ Edited ]
Top Contributor
# 7
Top Contributor

@squeebo wrote:
If I don't delete the blog subdomain from SC, wouldn't the search data be unavailable in GA since it has no property to link to?

I can get a little data from SC, but for example I can't get a combined report showing both the queries and landing pages, which I can only get in GA.

Thanks for the help!

If I don't delete the blog subdomain from SC, wouldn't the search data be unavailable in GA since it has no property to link to?

 

Yes, however you will still at least have that information re queries, pages, countries etc in GSC along with all the other information that GSC gives you, that GA does not, as opposed to not having that SEO info for blog.domain.com at all.
eg backlinks, crawl errors, structured data, queries, clicks, impressions or any of that other data that GSC tracks that GA doesnt give you.

Yes its a little bit more effort to get data out of GSC however if you go to Search Analytics and select say Pages for instances, you can drill down into the specific page and see the data for all the queries related to that particular page

If you need help with using GSC, then the Webmaster Central Help Forum that covers GSC can be found here:
https://productforums.google.com/forum/#!forum/webmasters


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

Re: Subdomain not tracking right

Top Contributor
# 8
Top Contributor
Are you able to possibly provide a link to the main site, I'd like to check something via browser in relation to the tracking code setup
since you mentioned the tracking code on the blog and that from the code example, I am thinking that is being inserted by a plugin
Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here