Best way to set up Google Analytics for domain, subdomain and subdirectories - google-analytics

I have a website with following domain and folder structure:
Main Website: www.ry.com
Subdomain1: mobile.ry.com
Subdomain2: speed.ry.com
Directory1: www.ry.com/mobile
Directory2: www.ry.com/blog
I have just started setting up Google Analytics for this and I am totally confused as to what are the best practices that should be followed? Should I consider them as individual properties or just 1 property. Should I be setting up a different GA code for each one of these?
Ideally, I would like to track all of it at one place but at the same time, using some filters be able to see the traffic on any one of the subdomains/subdirectories.
I started reading up about Universal Analytics but got totally confused and some of the posts were outdated as GA and UA seems to have changed significantly in the recent times.
Please advise me about how to set this up or point me to any good blogs or urls that are a rich resource.

This is one of the most complete answers I've found for this question.
http://moz.com/blog/cross-domain-subdomain-tracking-in-google-analytics

Related

google analytics is mixing up my two websites when showing reports

google analytics is mixing up my two websites when showing reports. Eg. the top 5 pages include 3 pages from one website and 2 from the other website.?? Can anyone help me, please?
I dont know what to try and I can't find a help page for google analytics
The most common way for this to happen is if your tracking code is present on the both the sites in question (it is possible spam a GA account and achieve the same effect, but as you own both the sites I do not believe this to be the case.).
I suggest:
- check the audience > technology > network > hostname report. This will tell you all the sites that your code is present on and should confirm that your code is also present on an additional site.
- check the source code of the other site. Is the code present? look for either GA code or a GTM container. If you're using GTM then check to see whether it is the same container or a different container injecting the same GA code.

How does amp analytics affect multiple sessions on the same property?

Essentially, I'm concerned that a single user can be counted twice. Is there a best practice, etc. I've tried googling and I'm not sure if I'm just not asking the right question with the right words. Platform is on sitecore.
Using the same property to track AMP and non-AMP pages will result in multiple users. See here for Google's recommendation.
Though looks like you can use the Google AMP Client ID API to work around this.

Tracking links within my site

I want to track particular links on my site to see where they come from. For example, I want to know which links on my navigation are being clicked, so if something is not being clicked I could potentially remove it.
I have been using UTM's, super easy, but results in skewed analytics data.
I looked into Google Tag Manager, but I don't want to slow down my website. I can change the site easily, so not sure if this is the best solution.
I found an article dated 2008 that says I can do this:
https://www.example.com/?from=topnav
Is that still valid? Is there a better way. I can't seem to find any information on this and assume somebody wants to acquire this information.
Thank you.
I have been using UTM's, super easy, but results in skewed analytics
data.
UTM codes are meant to track inbound traffic. Don't use them to track internal/outbound navigation, as it will seriously mess up your reporting.
I looked into Google Tag Manager, but I don't want to slow down my
website.
GTM is loading async, just like GA, so performance-wise they are equivalent.
I found an article dated 2008 that says I can do this:
https://www.example.com/?from=topnav
By default GA will not track link clicks. You can indeed add parameters to URLs and then use those to build custom reports and see which links are being clicked.
Since what you're trying to do is custom implementation, you won't find a single best answer, it's up to you to implement something that fits your needs. These are some examples:
https://analytical42.com/2017/track-internal-links-google-analytics-gtm/
https://www.gravitatedesign.com/blog/can-google-analytics-track-link-clicks/

Google Analytics reporting data before tag is even up

So I've been working on a website for a while. GA account has been up for a couple months but I waited for the website to be finished before putting up the actual JS tag.
In the meantime, the website is being HTTP password restricted (basic authentication) so it isn't even accessible unless you know the user/pwd combination.
To my surprise, I realized today that GA has logged several hundred views to the root of my website. Paths are mostly things like:
/
/?from=http://social-widget.xyz/
/?from=http://www.traffic2cash.xyz/
Bounce% and exit% both at 100% for all of them.
I realize this looks like referral spam, and there are ways to prevent it. Came across this upon googling:
http://botcrawl.com/block-social-widget-xyz-referral-spam-in-google-analytics/
My question is: how can GA log anything anyway when no tag is up and the website isn't even accessible?
Thank you very much in advance
Because it's spam. They hit Google Analytics directly with random GA codes and don't even go through your website.
GA can't tell if these are real hits (from website visits) or fake hits (from spam bots who hit GA directly calling the same ode as they would if on the website). Though arguably they should do more about this.
Massively annoying - particularly when first starting out as this can be a heavy proportion of your "traffic".
It's easy to set up a filter rule is to catch a lot of this by filtering on hostname. As they are randomly hitting GA and don't even know what website they are hitting GA for, they don't usually set this correctly. Real traffic should only come from yourwebsitedomain.com so add a filter for that.
STRONG piece of advice: abandon the default UA-########-1 tracking code of your new website -- simply do not use it!
Create a second and third property on the Admin screen, then use the tracking code for the third property. You will immediately see a lot less spam. No filters or segments necessary!
If you want the whole sad story about spam visits in GA, I have been maintaining the Definitive Guide article for over a year now:
http://help.analyticsedge.com/spam-filter/definitive-guide-to-removing-google-analytics-spam/

Tracking displays of iframe component in Google Analytics

Site A gives their affiliates an interactive component (traffic map based on Google Maps), which they in turn put on their sites (Site B) in an iframe. The component is dynamic, doesn't change the URL of parent site, and has an id for each affiliate site.
What I would like to do is track the displays of the component. (Price of using Google Maps for the component depends on number of views).
At the moment the component is in <iframe src="http://SiteA.com/q?cp=43.520,18.910,10&cm=1"></iframe>.
I have looked at the other topics but didn't found a solution to that problem. I would really appreciate any help, I had no experience with cross-site tracking yet.
You as siteA owner want to count number of displays of iframe on other sites, correct?
The basic way to do it is logs analysis — every time your server returns page http://SiteA.com/q?cp=43.520,18.910,10&cm=1 or similar it adds an entry to your server's log files. The can be count when. There is a number of solutions for analyzing log data. Some of them opensource and free, other are paid services. For exmaple: http://awstats.sourceforge.net/
There is other ways to count it, but it's probably easiest way of all.

Resources