Google analytics with multiple subdomains - google-analytics

I've got a domain name lets call it example.com, which has multiple subdomains.
blog.example.com
shop.example.com
press.example.com
site.example.com
I'm trying to get these domains to all report properly in google analytics, first I'll share my current configuration then the issue that it caused.
Current configuration:
Under the Tracking Code tab in the admin.
What are you tracking? = One domain with multiple subdomains
The root domain, example.com's profile is set as follows.
A subdomain, blog.example.com's profile is set as follows.
These subdomain profiles show up all under one account like they should.
I am not using any filters, and I just tried to filter by subdomain and I can't get it to work, no matter what the content and the numbers are all the numbers for example.com.
Problem with this configuration
All of the profiles have the same data, the content from the root domain.
I previously was not using filters now I am one for each subdomain looks like this:

I haven't tried this, but setting up profiles could help as described here: http://www.ericmobley.net/guide-to-tracking-multiple-subdomains-in-google-analytics/

You need to understand the concept of "Accounts" and "Profiles" within Google Analytics.
Your account name is "Example site". If you want the data from subdomains in separate profiles, create separate accounts(not separate google accounts).
All profiles within the same account will have the same data.
Hint for you to find out account. All profiles within a folder group belong to the same account. Create separate top level folder groups.

I previously was not using filters now I am one for each subdomain looks like this:
Although I don't think this an issue with GA anymore.

Related

How to change the default Firebase Auth actions domain to my custom domain?

How to change the default Firebase Auth actions domain to my custom domain? I want to change it from reply#project-name.firebaseapp.com to reply#app.example.com but with another verification method for the domain rather than adding TXT & CName records to my DNS configuration.
I want something simple as adding a .txt file with the other project files and uploading it to the hosting. That's all because my current hosting doesn't support the TXT & CName records.
By the default Firebase Auth actions, I mean the password reset email, email verification, email address change, etc.
As a follow up to our discussion in the comments,
Since your project is being hosted on a Netlify subdomain, I found the following in their documentation:
To add a new DNS record:
Go to the Domains tab for your team.
Select the domain you want to edit.
At the bottom of the DNS records panel, select Add new record.
Choose the type of record to create from the menu and fill in the remaining options. The fields you need to fill out will depend on the
type of record you select.
Select Save to create the record and make the changes live. Remember, it may take up to a few hours for record changes to
propagate.
Note that you can host records for other services, such as your mail
provider or your backend API, with us as long as you host at least one
website with us that uses the domain.
If this isn't allowed, I would suggest getting a custom domain, and pointing both Firebase and Netlify to it. It's more professional than a hosted subdomain, and it'll stay yours forever. Doing a quick search, I found plenty of interesting and currently available domains relating to msk-apps.

Traffic from domain to sub-domain

We have a listing on domain x.com which has links to subdomain.x.com
Analytics settings Referral Exclusion List has domain x.com and subdomain.x.com.
AFAIK, this means that view under this same account shouldn't have referrals neither from x.com or subdomain.x.com. Also the session should stay the same.
Now the problem is that I cannot see traffic between these URLs. Is possible in any way?
Add a filter to the view to include the hostname: https://support.google.com/analytics/answer/1012243?hl=en
Another option is for you to create multiple views to only include a certain hostname. In your case, one view to include only traffic with hostname subdomain.x.com and another to include only x.com.

What approach to select for Tracking a Sub-Domain in Google Analytics

This is a new setup, no historical data.
My objective is to be able to track the domain, as well as sub-domain.
Setup that i have:
domain.com - User generated content site
sub.domain.com - E-Commerce Shop.
Create a New Property for sub.domain.com in addition to domain.com ?
Or Create a Different View in the Property ?
To be precise, i need to know which method to select and why ?
Yes, there are previously asked questions over SO relating to "How to track sub-domains" but none show describing the reason to select an approach.
Sub-domains are tracked automatically by Google Analytics you just need to set the Cookie-domain property to auto.
You can create a new view for your subdomain and analyze data only for that sub-domain that would be more efficient.
Let say you have a site named mydomain.com and have one blog for that also like blog.mydomain.com.So, for both you can have different views and one combined view then it's up to you how you want to analyze the data.
ga('create', 'UA-12345-1', 'auto');
// is the same as
ga('create', 'UA-12345-1', {'cookieDomain' : 'auto'});
Refer the below document for more information on tracking sub-domains.
[https://support.google.com/analytics/answer/1034148?hl=en][1]
This depends on your use case.
If the content of your subdomain is strongly connected to your main domain you probably want to use the same tracker for both without modifications. This will allow you to track user sessions that move between main domain and subdomain. You would either create a view to filter by subdomain, or simply create a filter that adds the subdomain to the page path (so you can discern Urls from the main and subdomain) and look at them in the same view.
If main domain and subdomain share a tracker and a cookie with the client id this has at least two implications. Users that have visited your main domain in one session and the subdomain in another will be recognized as recurring users. Also sampling in a free GA account happens on the property level, so if you track main domain and sub domain via the same tracking id sampling will occur more frequently (on sites with much traffic).
If you want to avoid either you should use separate GA properties for main domain and sub domain and maybe change the cookie domain for your subdomain (documentation for the current gtag.js is here).

Sub-domain tracking with Google Tag Manager

I'm trying to set up tracking with GTM between the main domain and its subdomain. I've read a lot on this topic already, including this Google guide (it's about different domains but not sub-domains) and guide from Lunametrics. But still I can't find the answer.
So what I have now:
site.com and blog.site.com
Two separate containers for each of them
Two different properties in Universal Analytics.
What I need is tracking the domain with it's subdomain. I assume I'll need to create a separate view with filters in GA. Please let me know how to configure that tracking right. I wouldn't like to use one single container for the domain and its subdomain.
What you need is a single property. Implement the same code on domain and subdomain.
Set the cookie domain to "auto" (or do not set it all). This means the Google code sets the cookie for the highest accessible "level" from the domain (i.e. Google cannot set a cookie for the .com TLD, so it will use the next level, in your example site.com). It also means the cookie is available on the subdomains for your url.
That's basically it - your property will report users from domain and subdomain and will maintain the session when they switch between domain and subdomain.
However if you have pages of the same name on both domain and subdomain - say site.com/index.html and blog.site.com/index.html - they will be lumped together in the reports. To separate them you can set the hostname as second dimension, or apply a filter to your data view that adds the hostname to the url path (here is randomly googled tutorial on how to do this).

Google Analytics track 2 domains (one with subfolder)

I want to get the GA data with this setup:
Main domain: mydomain.com
Second domain: subdomain.myotherdomain.com/myfolder
So basically I want the visits to the main domain and the visits to the second domain to count as one page. The reason for that second domain is to redirect user to a secure area. That secure area is located in a subfolder, not in the root of the second domain.
I thought that as long as I put the same tracking ID everywhere it would be fine, but donig some research I found this from Google: Set up cross-domain tracking for multiple domains
Do I need this in my case? If so, how do I tell GA about just tracking the specific folder in the second domain? I will have other folders in the future that will need to be tracked separately from this account, so that's why I only want that folder...
Yes, you do need this (or else visits from mydomain.com to myotherdomain.com will be counted as two different visitors with mydomain.com as refering site).
You can use _setCookiepath (in the code for myotherdomain.com ) to limit the Google Analytics cookie to your subdirectory:
_gaq.push(['_setCookiePath', '/myfolder']);
(https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiDomainDirectory#_gat.GA_Tracker_._setCookiePath)

Resources