Cookie Filter In Asynchronous Code!! Google Analytics

Well I have found many people having dynamic ip and getting problem setting up cookie filtering in Google analytic so i came up with a small tutorial.

How to setup cookie filtering in asynchronous code:-

1) Setup a new page named example.html on your server and paste the code below

<script type=”text/javascript”>

var _gaq = _gaq || [];
_gaq.push([‘_setAccount’, ‘UA-XXXXXXX-X’]);

(function() {
var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘’;
var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);


Change UA-XXXXXXX-X with your unique property ID.

Next , create a filter —> click on edit profile and add filter

Name of Filter – Exclude me
Filter Type: Custom filter > Exclude
Filter Field: User Defined
Filter Pattern: cookie_filter
Case Sensitive: No

Now you are done just visit the page named example.html and you are done…:)


A company providing web hosting solutions around globe...