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’]);
_gaq.push([‘_setVar’,’cookie_filter’]);
_gaq.push([‘_trackPageview’]);
(function() {
var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
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…:)