scratch/content/html/en/blog/2010-06-17-hide-yourself-to-analytics.md
2010-06-17 17:53:11 +02:00

2.8 KiB

isHidden menupriority kind created_at title author_name author_uri tags
false 1 article 2010-06-17T16:37:22+02:00 Hide Yourself to your Analytics Yann Esposito yannesposito.com
analytics
statistics
hide
blog
jquery
javascript

This is a way not to count your own visits to your blog. First you should look on how I handle analytics. All analytics are handled in one javascript file, this make things really convenient.

Then you need to know my method use the jquery-cookie module and of course jquery.

First before launching analysis, I check if the key admin is not set in the cookie.

var admin = $.cookie('admin'); if (! admin) { // put your analytics code here } else { console.log("[WARNING] you're HIDDEN to analytics"); }

then create two html files. One to hide:

<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr"> <head> </head>
</html>

the other to be visible again (it can be useful):

<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr"> <head> </head>
</html>

Now accessing these files with you browser you can hide or appear in your statistics. You just have to think to access these file from all you browser.