Google Analytics filter to show visits to your website domain
15 August, 2013 by Tom Elliott
I recently came across an issue with my Google Analytics website tracking whereby other websites had (probably accidentally) installed my tracking code (in the format UA-XXXXXXXX-X). This meant I could see visitor statistics for other sites in my profile, giving a false impression of a greater number of visitors to Web Dev Door.
There are a number of reasons why your Analytics tracking code may be used on other websites:
- People copy and paste code from your site. On this site for example, there are a number of demos that people can copy and paste from the source code which includes Analytics tracking.
- Try and acquire visits. I’ve seen questionable websites randomly use many tracking codes in the hope that they’ll get visits when other people see traffic spikes with their website hostname appearing in Analytics.
- Websites scrape your website or page content and don’t change the tracking code.
To setup a filter so only visits to your website are recorded in Google Analytics is straight forward. These steps use the new admin panel introduced in August 2013.
- From the main Analytics Dashboard for your site, select ‘Admin’ in the top right
- Under the ‘account column’ select ‘All filters’
- Click ‘New filter’ and enter the information as below, giving a filter name, including only traffic to the hostname that contains youwebsite.com
- Make sure to add ‘All Web Site Data’ for the selected profile and save.
Entering your website domain without the ‘www’ in the hostname text box will mean traffic to any sub domain on your site along with the www will also be included in your Analytics.
Preventing Analytics referral spam and fake visits »