]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/layouts/_piwik.html.erb
Don't show "Browse Map Data" when we're not on the map view
[rails.git] / app / views / layouts / _piwik.html.erb
index 0b719932d1caf004123e73db3f53a505e3d54d84..0ba307437c53393fc5ecc04110014314a199b142 100644 (file)
@@ -1,15 +1,14 @@
-<!-- Piwik -->
 <script type="text/javascript">
-var pkBaseURL = (("https:" == document.location.protocol) ? "https://<%= PIWIK_LOCATION %>/" : "http://<%= PIWIK_LOCATION %>/");
-document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
-</script><script type="text/javascript">
-try {
-var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", <%= PIWIK_SITE %>);
-piwikTracker.trackPageView();
-piwikTracker.enableLinkTracking();
+var _paq = _paq || [];
+(function(){ var u="<%= request.protocol %><%= PIWIK_LOCATION %>/";
+_paq.push(['setSiteId', <%= PIWIK_SITE %>]);
+_paq.push(['setTrackerUrl', u+'piwik.php']);
+_paq.push(['trackPageView']);
+_paq.push(['enableLinkTracking']);
 <% if flash[:piwik_goal] -%>
-piwikTracker.trackGoal(<%= flash[:piwik_goal] %>);
+_paq.push(['setSiteId', <%= flash[:piwik_goal] %>);
 <% end -%>
-} catch( err ) {}
-</script><noscript><p><img src="http://<%= PIWIK_LOCATION %>/piwik.php?idsite=<%= PIWIK_SITE %>" style="border:0" alt="" /></p></noscript>
-<!-- End Piwik Tracking Code -->
+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><p><img src="<%= request.protocol %><%= PIWIK_LOCATION %>/piwik.php?idsite=<%= PIWIK_SITE %>" style="border:0" alt="" /></p></noscript>