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
4.7K members online now
4.7K 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

Tracking across subdomains using campaigns

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello all,

 

You are probably sick and tired of seeing this question, but I've searched high and low and never found an answer to my issue.

 

I want to be able to track traffic across my www.example.com and info.example.com subdomains in one instance of my Google Analytics. Essentially, I want a visitor to be tracked as one across my subdomains.

 

Here's a specific example of what I'm trying to achieve.

 

I use info.example.com to create landing pages for specific content and activities, such as Facebook advertising. Naturally, I create a trackable URL so I can track the activity in 'Acquisition' --> 'Campaigns'.

 

However, when someone comes to my info.example.com page and then clicks a link on the page that takes them to www.example.com, I lose sight of the session. 

 

See here: http://i1172.photobucket.com/albums/r565/njdyer14/Campaign%20sub%20domain%20cross%20tracking_zpstgzu...

 

It says they only visited one page because it loses the visitor once they are passed to www.example.com. However, I don't want this. I want it to continue to track the visitor between info.example.com and www.example.com. So if they go from info.example.com to www.example.com it counts as 2 pages visited.

 

Am I missing a trick or am I trying to achieve the impossible? If i'm attempting the impossible is there another method that allows me to get close to achieving my objective? 

 

Thanks in advance for your help.

 

NJD

 

1 Expert replyverified_user

Re: Tracking across subdomains using campaigns

Top Contributor
# 2
Top Contributor

Hi Neal James :-)
Tracking code for the same Property ID needs to be used on the main domain
and subdomains
Tracking code snippet must be the same on each and the cookie domain must
be set to auto
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','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-1234567-1', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->

 

You also then need to create a new View and apply the following filter:
https://support.google.com/analytics/answer/1034342?hl=en#Next

By default, Google Analytics only includes the page path and page name, not the domains name. For example, you might see your pages appear in the Site Content report like this:

  • /about/contactUs.html
  • /about/contactUs.html
  • /products/buy.html

Because the domain names aren’t listed, it might be hard to tell which domain each page belongs to.

To get the domain names to appear in your reports you need to do two things: Create a copy of your reporting view that includes data from all your domains in it and add an advanced filter to that new view. The filter will tell Google Analytics to display domain names in your reports.

Follow this example to set up a view filter that displays domain names in your reports when you have cross domain tracking set up. For some fields, you need to select an item from the dropdown menu. For others, you need to input the characters here:

  • 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.

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

Re: Tracking across subdomains using campaigns

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
H Bronwyn V,

Many thanks for your reply.

Sadly, I'm still not getting the desired results. I've followed your feedback but I'm still only getting one page view from my campaigns, despite the fact I've gone onto to click a link on the info.example.com page which takes me to www.example.com. I can see in Acquisition --> Overview --> Referrals, that from info.example.com i've gone onto to visit two pages on www.example.com. Therefore my total number of page views on example.com is three.

However, I still only see 1 when looking in 'Campaigns': http://s1172.photobucket.com/user/njdyer14/media/Campaign%20sub%20domain%20cross%20tracking_zpstgzut...

Here's some more insight into a specific example of what I'm trying to achieve.

I use a landing page creator called Instapage (https://instapage.com/). For Instapage I've created the subdomain info.example.com. I use Instapage for certain features but I ultimately combine it together with www.example.com. From my standpoint they are the same. So therefore I want any traffic that goes between the two to be counted as a single session.

Perhaps someone can educate me on my terminology. As I understand it 'www.' and 'info.' are both subdomains. Am I correct?

Thanks

Neal

Re: Tracking across subdomains using campaigns

[ Edited ]
Top Contributor
# 4
Top Contributor

Hi Neal :-)

Just out of curiosity, you have created a new View with the applicable filter applied is that correct?
Regardless of how the sessions etc are appearing, and assuming you have no other filters applied to the View

apart from the one suggested


Are you seeing pageviews tracked on both the parent and subdomain domain, even if the session itself is not being recognized as a single session and not carrying over?

 

Are you able to possibly provide a link to landing page and main domain in order to allow us to look at the tracking code script via browser, in the actual pages? It often helps with debugging

eta: Specifying 'auto' as the cookieDomain enables automatic cookie domain configuration, which tells analytics.js to automatically determine the best cookie domain to use.

Automatic cookie domain configuration sets the _ga cookie on the highest level domain it can. For example, if your website address is blog.example.co.uk, analytics.js will set the cookie domain to .example.co.uk. In addition, if analytics.js detects that you're running a server locally (e.g. localhost) it automatically sets the cookieDomain to'none'.

https://developers.google.com/analytics/devguides/collection/analyticsjs/cookies-user-id#automatic_c...

 

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

Re: Tracking across subdomains using campaigns

[ Edited ]
Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Hi Bronwyn V,

Thank you for your continued support.

Yes I created the filter. I did copy a previous view as it suggested in the link you provided. There were two other filters present. One to exclude internal traffic data and one to exclude spam bots.

Are you seeing pageviews tracked on both the parent and subdomain domain, even if the session itself is not being recognized as a single session and not carrying over? Yes!

We use tag manager so the GA code isn't visible when looking at the website.

However, the tracking code is the following:

<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','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXXXX-1', 'auto');
ga('send', 'pageview');

</script>



Thank you

Neal

Re: Tracking across subdomains using campaigns

Top Contributor
# 6
Top Contributor

Hi Neal :-)

 

Did you remove the internal traffic filter and the spam bot filter from the View you copied?

 

This will ensure that filters are not preventing the tracking of the data 

 

 Also be sure to clear your browser cache and cookies before testing.

 

 

  We use tag manager so the GA code isn't visible when looking at the website

I didnt want to look at the code itself, isnt necessary, I was hoping to have a look at pages on each domain via browser while using javascript debugging and also Google Tag Assistant to check for any possible errors or inconsistencies with the installations or other code that may be installed that could affect either.  

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

Re: Tracking across subdomains using campaigns

[ Edited ]
Top Contributor
# 7
Top Contributor

If you are using tag manager, from your post above, i gather you are using a html tag with the analytics tracking

code inside it, rather than a GA Universal tag?

 

Also does Instapage support GTM? Only information i was able to find was in relation to GA,

and their platform adds the tracking code, all they require is the tracking id, the code snippet does

not get used.

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