A Word on Google Analytics
Spent a nice couple of weeks on holiday in Texas visiting Austin, San Antonio, and Del Rio. In between catching up, eating, and general merrymaking, I learned a neat little trick to better interpret and protect Google Analytics (GA) data and traffic.
Most of the time you want your site to only record outside hits, in other words traffic that is not from your own (possibly numerous) visits. Naturally this applies to businesses as well as blogs. Secondly you also want to make sure your site is the only one actually generating the hits to your tracking code.
The solution to both of these issues is to set up custom filters1 in GA.
Exclude internal traffic2
- Find your IP address. (Google “My IP” for your public IP address).
- Log into your GA dashboard.
- Select Admin tab and select the account you wish to manage.
- Under Account column, select “All Filters”.
- Press the “+ Add Filter” button.
- Name your new filter,
Own IP
or something similar. - Filter type should be left “Predefined”.
- Select filter type “Exclude” from dropdown.
- From the “Select source or destination” dropdown menu, select “traffic from the IP addresses”.
- From “Select expression” dropdown, select “that are equal too”.
- Finally, enter your IP address and save.
If you have a larger company or website, naturally you would wish to set up a domain-type of filter3.
Include only real traffic
A second type of filter that may be advisable in order to prevent possible tomfoolery is one that makes sure only actual traffic from your site is being recorded.
It is well known that you can easily find and read the GA tracking code using the developer console of any modern browser, unless, you know, it is hidden as an environmental variable. Although there is little real danger from having this code publicly available, it is possible that some Internet ne’er-do-wells may utilize it to spike traffic at you. It sounds outlandish, but this fake traffic could ostensibly screw up your reporting and possibly induce the webmaster (i.e. you) to investigate the sites that are generating the hits, (a very poor advertising tactic indeed)4.
I actually saw this type of activity on a previous blog I held, mostly from Russian and Chinese sites, so there you have it.
To make sure your traffic data is clean and accurate, simply create a new custom filter that only accepts hits from your desired domain.
- Again, (from Admin on GA dashboard,) select your site.
- Click “+ New Filter”.
- Name it
Defence against the Dark Arts
or something similar. - Select “Custom filter”.
- Select “Include”.
- Under “Filter Field” dropdown select “Hostname”.
- Enter your desired domain name. Use backslash to escape special characters, like so:
nchristiny\.github\.io
- Save your awesome new filter.
Enjoy your clean GA data.
As always, any feedback or questions are most welcome. Feel free to contact me via Twitter or email. Thanks for reading.