diff --git a/doc/templates/layout.html b/doc/templates/layout.html
index 781a09fa641a3ab2de49ef6c7b13e38ae4c5a931..ce31adb9bb54abb477037a47d44d42385f10b6cb 100644
--- a/doc/templates/layout.html
+++ b/doc/templates/layout.html
@@ -209,5 +209,25 @@
     {%- endif %}
     </div>
 {%- endblock %}
+{%- if website_deploy %}    
+    <!-- Piwik -->
+    <script type="text/javascript">
+      var _paq = _paq || [];
+      _paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
+      _paq.push(["setCookieDomain", "*.kwant-project.org"]);
+      _paq.push(["trackPageView"]);
+      _paq.push(["enableLinkTracking"]);
+
+      (function() {
+      var u=(("https:" == document.location.protocol) ? "https" : "http") + "://piwik.kwant-project.org/";
+      _paq.push(["setTrackerUrl", u+"piwik.php"]);
+      _paq.push(["setSiteId", "1"]);
+      var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
+      g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
+      })();
+    </script>
+    <noscript><img src="http://piwik.kwant-project.org/piwik.php?idsite=1&amp;rec=1" style="border:0" alt="" /></noscript>
+    <!-- End Piwik Code: Analytics are used by us to improve the site, and not sent to anyone. -->
+{%- endif %}
   </body>
 </html>