]> git.openstreetmap.org Git - rails.git/blob - app/assets/javascripts/piwik.js
Prefer hash to other methods of determining location
[rails.git] / app / assets / javascripts / piwik.js
1 if (OSM.PIWIK_LOCATION && OSM.PIWIK_SITE) {
2   $(document).ready(function () {
3     var base = document.location.protocol + "//" + OSM.PIWIK_LOCATION + "/";
4
5     $.ajax({
6       url: base + "piwik.js",
7       dataType: "script",
8       cache: true,
9       success: function () {
10         var piwikTracker = Piwik.getTracker(base + "piwik.php", OSM.PIWIK_SITE);
11       
12         piwikTracker.trackPageView();
13         piwikTracker.enableLinkTracking();
14       
15         $("meta[name=piwik-goal]").each(function () {
16           piwikTracker.trackGoal($(this).attr("content"));
17         });
18       }
19     });
20   });
21 }