Tracking visits to a given website is a necessary SEO (Search Engine Optimization) function for many projects in order to determine “How I’m I doing” (for ROI) and “Where is everyone coming from” (for url referral and keyword).
A common problem is how not to track the visits of the developer team or the client themselves since these are are not the (generally) the people who interested in. (“Not the droids you’re look for”?) For this purpose, these would not be valid visitors to the web site.
Stopping tracking is usually implemented by either blocking a static IP addresses or by using a cookie. I also have a programming trick to provide a third solution.
One of the most popular products for tracking web traffic software is the free Google Analytics tool.
So how do you go about configure Google Analytics to filter out unwanted visitors from the traffic logs? Google Analytics does this by filtering on a static IP addresses.
1) First you need to know what your static IP address is (or get the static ip address is at the place your wish to block). Googlling “what is my ip address” will bring up many sites that will help you, but I’m going to use http://whatismyipaddress.com. Make a note of what that number is.
2) Next go to the Website Profiles page of your website in Google Analytics and edit the profile.
3) Next your going to “Add a Filter” to the profile. Your are okay to keep the “Add new Filter for Profile” option. The “Apply existing” lets you reuse filters (very handy if you are administrating many web sites). Give it a name that identifies the company or group who use that ip address. and then change the filter type to “Traffic from the IP addresses”, and enter the ip address you got in step 1. Then save the changes and Done!
IP blocking in Google Analytics will only work if you have a static ip address, but if your are not using a business grade internet connection, i.e. it a consumer account, your ISP usually does not guarantee a static address but assigns you a sticky dynamic address instead.
The other common method that third party (hosted) web traffic analytic software sometimes use is dropping a blocking cookie. This method has the major flaw that it must be done on every machine and every browser that might be used. And as a developer I often have multiple type of browsers open and every browser (and versions) installed.
I said I had a third method, didn’t I? Because I allow system users to log into the administrative back end system, I can check in my code to see if the are logged in (or authenticated) and not serve up the Google Analytics javasctipt code to them, when they are viewing the public side. No GA tracking. WordPress uses a similar method to disallow the trackng of logged in users. I have also used a similar approach to not serve up the tracking code in development mode, based on the host being either Local Host or the address of my staging box.