yannesposito.com/Scratch/fr/blog/2010-06-17-hide-yourself-to-analytics/index.html
Yann Esposito (Yogsototh) 83dda36094 publishing
2013-03-04 18:44:12 +01:00

173 lines
12 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>YBlog - Se cacher de ses statistiques web</title>
<meta name="keywords" content="analytics, statistiques, cacher, blog, jQuery, javascript">
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="../../../../Scratch/css/scientific.css" />
<link rel="stylesheet" type="text/css" href="../../../../Scratch/css/solarized.css" />
<!-- Font -->
<link href="http://fonts.googleapis.com/css?family=Inconsolata" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Droid+Sans:400,700" rel="stylesheet" type="text/css">
<link rel="alternate" type="application/rss+xml" title="RSS" href="http://feeds.feedburner.com/yannespositocomfr" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
</head>
<body lang="fr">
<script type="text/javascript">//
document.write('<div id="blackpage"><div>Bientôt<img src="/Scratch/img/loading.gif" alt="Chargement en cours"></img></div></div>');
//
</script>
<div id="content">
<div id="header">
<div id="choix">
<div id="choixlang">
<a href="../../../../Scratch/en/blog/2010-06-17-hide-yourself-to-analytics" onclick="setLanguage('en')">
English </a>
</div>
<script type="text/javascript">//
document.write('<div id="switchcss"><a href="#">Changer de theme</a></div>');
//
</script>
<div class="flush"></div>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/fr/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/fr/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/fr/about">About</a>
</div>
</div>
<div id="titre">
<h1>Se cacher de ses statistiques web</h1>
</div>
<div class="flush"></div>
<div id="afterheader">
<div class="corps">
<p>Voici un moyen très simple de ne plus être comptabilisé dans les visites de son propre site. Tout dabord, vous devriez jeter un coup dœil sur comment <a href="../../../../Scratch/fr/blog/2010-06-17-track-events-with-google-analytics">je gère les systèmes de récupération de statistiques</a>. Je centralise tout dans un seul fichier javascript ce qui facilite le travail.</p>
<p>Cette méthode nécessite lutilisation de <code>jquery-cookie</code>.</p>
<p>Avant de comptabiliser les visites, je vérifie que la clé <code>admin</code> nest pas utilisée dans mes cookies.</p>
<pre class="sourceCode javascript"><code class="sourceCode javascript"> <span class="kw">var</span> admin = $.<span class="fu">cookie</span>(<span class="ch">'admin'</span>);
<span class="kw">if</span> (! admin) {
<span class="co">// put your analytics code here</span>
} <span class="kw">else</span> {
<span class="kw">console</span>.<span class="fu">log</span>(<span class="st">&quot;[WARNING] you're HIDDEN to analytics&quot;</span>);
}</code></pre>
<p>et il suffit de créer deux fichier <sc>html</sc>. Un pour se cacher :</p>
<pre class="sourceCode html"><code class="sourceCode html"><span class="kw">&lt;?xml</span> version=&quot;1.0&quot; encoding=&quot;utf-8&quot;<span class="kw">?&gt;</span>
<span class="dt">&lt;!DOCTYPE </span>html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;
&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;<span class="dt">&gt;</span>
<span class="kw">&lt;html</span><span class="ot"> xmlns=</span><span class="st">&quot;http://www.w3.org/1999/xhtml&quot;</span><span class="ot"> lang=</span><span class="st">&quot;fr&quot;</span><span class="ot"> xml:lang=</span><span class="st">&quot;fr&quot;</span><span class="kw">&gt;</span>
<span class="kw">&lt;head&gt;</span>
<span class="kw">&lt;meta</span><span class="ot"> http-equiv=</span><span class="st">&quot;Content-Type&quot;</span><span class="ot"> content=</span><span class="st">&quot;text/html; charset=UTF-8&quot;</span> <span class="kw">/&gt;</span>
<span class="kw">&lt;script</span><span class="ot"> type=</span><span class="st">&quot;text/javascript&quot;</span><span class="ot"> src=</span><span class="st">&quot;jquery.js&quot;</span><span class="kw">&gt;&lt;/script&gt;</span>
<span class="kw">&lt;script</span><span class="ot"> type=</span><span class="st">&quot;text/javascript&quot;</span><span class="ot"> src=</span><span class="st">&quot;jquery.cookie.js&quot;</span><span class="kw">&gt;&lt;/script&gt;</span>
<span class="kw">&lt;script&gt;</span>
<span class="er"> $(document).ready(function(){</span>
$.<span class="fu">cookie</span>(<span class="ch">'admin'</span>,<span class="dv">1</span>);
$(<span class="ch">'#info'</span>).<span class="fu">html</span>(<span class="ch">'Analytics can no more see you.'</span>)
});
<span class="kw">&lt;/script&gt;</span>
<span class="kw">&lt;title&gt;</span>Hide to analytics<span class="kw">&lt;/title&gt;</span>
<span class="kw">&lt;/head&gt;</span>
<span class="kw">&lt;body&gt;</span>
<span class="kw">&lt;div</span><span class="ot"> id=</span><span class="st">&quot;info&quot;</span><span class="kw">&gt;&lt;/div&gt;</span>
<span class="kw">&lt;/body&gt;</span>
<span class="kw">&lt;/html&gt;</span></code></pre>
<p>et un autre pour redevenir visible (ça peut être utile) :</p>
<pre class="sourceCode html"><code class="sourceCode html"><span class="kw">&lt;?xml</span> version=&quot;1.0&quot; encoding=&quot;utf-8&quot;<span class="kw">?&gt;</span>
<span class="dt">&lt;!DOCTYPE </span>html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;
&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;<span class="dt">&gt;</span>
<span class="kw">&lt;html</span><span class="ot"> xmlns=</span><span class="st">&quot;http://www.w3.org/1999/xhtml&quot;</span><span class="ot"> lang=</span><span class="st">&quot;fr&quot;</span><span class="ot"> xml:lang=</span><span class="st">&quot;fr&quot;</span><span class="kw">&gt;</span>
<span class="kw">&lt;head&gt;</span>
<span class="kw">&lt;meta</span><span class="ot"> http-equiv=</span><span class="st">&quot;Content-Type&quot;</span><span class="ot"> content=</span><span class="st">&quot;text/html; charset=UTF-8&quot;</span> <span class="kw">/&gt;</span>
<span class="kw">&lt;script</span><span class="ot"> type=</span><span class="st">&quot;text/javascript&quot;</span><span class="ot"> src=</span><span class="st">&quot;jquery.js&quot;</span><span class="kw">&gt;&lt;/script&gt;</span>
<span class="kw">&lt;script</span><span class="ot"> type=</span><span class="st">&quot;text/javascript&quot;</span><span class="ot"> src=</span><span class="st">&quot;jquery.cookie.js&quot;</span><span class="kw">&gt;&lt;/script&gt;</span>
<span class="kw">&lt;script&gt;</span>
<span class="er"> $(document).ready(function(){</span>
$.<span class="fu">cookie</span>(<span class="ch">'admin'</span>,null);
$(<span class="ch">'#info'</span>).<span class="fu">html</span>(<span class="ch">'Analytics can see you.'</span>)
});
<span class="kw">&lt;/script&gt;</span>
<span class="kw">&lt;title&gt;</span>Hide to analytics<span class="kw">&lt;/title&gt;</span>
<span class="kw">&lt;/head&gt;</span>
<span class="kw">&lt;body&gt;</span>
<span class="kw">&lt;div</span><span class="ot"> id=</span><span class="st">&quot;info&quot;</span><span class="kw">&gt;&lt;/div&gt;</span>
<span class="kw">&lt;/body&gt;</span>
<span class="kw">&lt;/html&gt;</span></code></pre>
<p>Maintenant en accédant à ces fichiers depuis votre navigateur vous pouvez <em>disparaître</em> des systèmes danalyses ou bien être considéré comme tous les autres individus. Pensez à accéder à ces fichiers depuis tous les navigateurs que vous utilisez et vos visites ne seront plus comptabilisées.</p>
</div>
<div id="social">
<span>
<a class="rss" href="http://feeds.feedburner.com/yannespositocomfr">RSS</a>
</span>
<span>
<a href="https://twitter.com/share" class="twitter-share-button" data-via="yogsototh">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</span>
<span>
<div class="g-plusone" data-size="medium" data-annotation="inline" data-width="106"></div>
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
</span>
<div class="flush"></div>
</div>
<div class="corps" id="comment">
<h2 class="first">Comments</h2>
<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'yannesposito'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
</div>
<div id="bottom">
<div>
Published on 2010-06-17
</div>
<div>
<a href="https://twitter.com/yogsototh">Follow @yogsototh</a>
</div>
<div>
Yann Esposito©
</div>
<div>
Done with
<a href="http://www.vim.org">Vim</a>
<span class="nicer">&amp;</span>
<a href="http://jaspervdj.be/hakyll">Hakyll</a>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript" src="../../../../Scratch/js/jquery-1.3.1.min.js"></script>
<script type="text/javascript" src="../../../../Scratch/js/jquery.cookie.js"></script>
<script type="text/javascript" src="../../../../Scratch/js/index.js"></script>
<script type="text/javascript" src="../../../../Scratch/js/highlight/highlight.pack.js"></script>
<script type="text/javascript" src="../../../../Scratch/js/article.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
</html>