As a web developer I'm interested in the visitor statistics for any site that I manage, but with this new blog I find that my own visits are swamping the results. On commercial sites I've used IP address filtering to exclude employee visits, since they are usually coming from a limited number of access points related to company offices, but in this case I view my blog from several difference devices with dynamic IP addresses.
Trawling the web I found a solution using
_setVar on googlelytics.net but this approach is now deprecated.
Firstly, I assume you have the standard Google Analytics tracking code somewhere on your pages, like this:
Then create a simple page with the following additional script:
<script> var _gaq = _gaq || ; _gaq.push(['_setCustomVar', 1, 'Me', 'yes', 1]); </script>
(It doesn't matter where the script goes, although I put it just below my tracking script which means I can also remove the
var _gaq = _gaq || ; line).
The page content doesn't matter (I just show a message saying my own visits are now excluded), but it shouldn't be linked by other pages in the site or your sitemap, and should have a URL you can remember.
To exclude your own visits you simply access this page from every browser you use, and it sets the custom variable in a cookie that is used in the next step. If you clear your cookies or use a different browser you need to visit the page again before accessing the rest of your site.
To use this cookie, we create an "Advanced Segment" that will filter tracking based on it.
View the Dashboard report for the site you are interested in (the one associated with the UA-????????-? in the tracking code).
In the top right corner there is a dropdown labeled Advanced Segments:, select this and it gives you the option to manage Advanced Segements.
Select the Create a new advanced segment link which gives you a report builder interface.
Expand the Visitors dimension in the green part on the left, and drag the Custom Variable (Key 1) entry onto the report dimension or metric area.
For the Condition enter "Does not match exactly" and for the Value enter the name from your _setCustomVar call (in this case Me). Note it's the name that you enter, not the value. It should look like this:
Save the segment as "Exclude own visits" and you can now apply this to your reports by using the Advanced Segments selection screen as accessed in point 2.
You can create the opposite filter by using Condition "Matches exactly" instead, and name it "Own visits".
One thing I haven't yet discovered is how to set an Advanced Segment to be the default view on the dashboard, comments on how to solve this would be very welcome.