Social Media Magazine

Make A Google Analytics Exclude Visit Cookie For Blogger

Posted on the 04 October 2011 by Chillpete @geekmeblog

Make A Google Analytics Exclude Visit Cookie For BloggerOne of the problems with Google Analytics is it will track your visits to your website or blog. This is not a big problem if you are having hundreds or thousands of hits per day, but if you are a new site or blog you will want to exclude you visits from the count.
The problem is that Blogger uses a template that applies the Google Analytics code to all your pages and posts. This is a work around the problem.
The first thing to do is log into Blogger Dashboard > Posting > Edit Pages. Create a new page called "Exclude Me" or some similar name . Once you have a new page select the Edit HTML tab and place the following code in the post box:
 <body onLoad="javascript:_gaq.push(['_setVar','exclude_me'])"> click publish page and chose the No Gadget option when asked and then finish publishing.
A word to note, please make sure that you bookmark this page before you hide it, otherwise if you need to activate or reactivate the cookie you won't be able to. If this option is not available, open your blog while you are still logged into Blogger and select the crossed tool image for the Pages Tool bar, then deselect the page in the "Pages to Show" option.
While you are in Blogger Dashboard click on the Design > Edit HTML and find the following line of code:
<b:include data=’blog’ name=’all-head-content’/>
Then directly underneath this add the following code:
<b:if cond='data:blog.url == ""'>
<meta content='noindex' name='robots'/>
Change the code in yellow to the URL of the page with the bit of javascript in. Save the Template then you are finished with Blogger.
Now you need to log into Google Analytics and select Filter Manager from the Website Profile Overview Page and select Add Filter.
Create the filter with the following settings:
Filter name - Make it something that's easy to remember
Filter Type - Custom > Exclude
Filter Field - User Defined
Filter Pattern - exclude_me
Case sensitive - No
Then click Save Changes. Once this is done simply open the new page that you have bookmarked called Exclude Me on all the browsers that you want to exclude from the Google Analytics count. A word of warning, if you leave this page so that all your visitors can access it they will also be excluded from the Google Analytics count, so make sure that you follow the earlier steps to hide the page from visitors.
Please subscribe to this blog for regular updates.
If you have any comments to make or would like help with anything on this post please visit our Forum and I will try my best to help

Back to Featured Articles on Logo Paperblog

Paperblog Hot Topics