How to stop Google Analytics Hacks? - google-analytics

What people are doing is basically taking the UA-XXXXXX code that you normally get with analytics, and they are generating calls against it. This is skewing my analytics stats. On top of that, in Google WebMaster tools, it's also causing this:
It looks like somehow these pages, with my code on or at least with the generated code on, is making Google Webmaster tools think I have lots of 404's. This can't possibly be good for my rankings.
Anyone know if there is anything you can do to stop this?

Try making async call from your server end using CURL.That way you will never expose your GA code.
I have not implemented it, but it might work as per theory

Since you can filter by custom dimensions you can set a "token" in a custom dimension on every page and filter out any traffic in your view settings that does not include the token.
Obviously this will not help against people who use the code from your website (unless you also implement shahmanthan9s suggestion - which is a lot of work but will give you cleaner data), but it will work against drive-by shooters who randomly select UAIDs to send data to (which is the situation you refer to in your comment).

Related

Know what the user does when a specific error happens using Google analytics?

I have a website that sells products and I'm using google analytics to know some statistics about the website. Sometimes, errors happens for various reasons and purchases doesn't go through. You then have to refresh the page and try again, then everything works. The website displays the message telling the user to refresh and try again. I'm curious how many people actually do that. My question is, is it possible to know what users do when this error happens? Do they refresh and try again? Do they close the tab or do they do something else?
The question is quite broad at this moment, but there are a couple of improvements to your measurement setup, that can help you to investigate this customer behavior.
What I would do, is to implement an event tracking to indicate, that this error has occurred. You can find details about event tracking in this guide. Although I suppose, that your users are not likely to enter the website at this page, it might be a good practice to set the non-interaction flag of the event, as it is not actually generated by a user interaction.
I'd also create tracking for page reload, either by creating an other event for this, or by adding -reload suffix to these repeated pageview URLs. You can find good resources for this on SO as well, e.g. this one.
If you have a special URL for this error page (e.g. purchase-error.html instead of purchase-success.html), it is also easy to track the exit rate specific to this page.
Besides of Google Analytics, you might also want to set up heatmap or screen recording tools to understand this behavior. Hotjar, Lucky Orange are a few examples. (No affiliation.)

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/

Add Analytics to account of someone other than the one who set it up?

I have been requested to get involved with a family member's site.
To date, they have been paying an SEO outfit, which I believe has been feeding them lies and milking them for money.
I can see that all pages in the site have Google Analytics. However, the SEO outfit refuses to let us see the Analytics page, and has always just forwarded them some (presumably doctored) slideshows.
The only tracking service that lists their site is Compete, which shows a number of visitors far from what they are paying for.
I would like to add their site to my own Analytics account. I have ftp access to their server, and permission from the site owners to modify any files I want.
However, I don't want to do anything that might destroy the entire existing history of analytics data, or even that would interfere with the current SEO outfit [until I have something concrete in-hand].
Does anyone know:
Can I add Analytics to my own account when it was originally setup by someone else?
Will there be any negative results of attempting this?
Any other ideas?
Thanks
Edit: Can anyone suggest a better title - I can tell mine is not good?
I've put two Google Analytics tracking codes from different accounts on the same site without issues. It may cause the site to be a tiny bit slower (as it communicates twice with Google) but it'll do nothing that would delete old data or impede collection of new data.
In short, what you're doing sounds like a good first step.
You will not, however, be able to access past data by doing this. You will be able to compare their numbers with the numbers you're getting, though, which should be valuable.
I don't know if you can add the same domain to two different Google Analytics accounts (easy enough to try, though), but you can always add another service's Javascript snippet, e.g. Woopra. Google and Woopra produced very similiar results in my experiments.
You may want to leave their Google Analytics tracking in place while adding your own Google Analytics tracking. In that case, your numbers should be identical to whatever is being tracked by this third party.
You'll need to set up your own account and then add in the creation of your pagetracker object and your own track page view. You don't need to recreate the entire page code. You can do it with two more lines. It would look something like:
var pageTracker =
_gat.getTracker("UA-XXXXXXXX-1"); //EXISTING pageTracker._trackPageView();
var secondTracker =
_gat.getTracker("UA-XXXXXXXX-1"); //YOUR TRACKING ACCOUNT secondTracker._trackPageView();

Resources