]> git.openstreetmap.org Git - rails.git/blob - app/assets/javascripts/piwik.js
Allow GET as well as POST for oauth#request_token and oauth#access_token
[rails.git] / app / assets / javascripts / piwik.js
1 if (OSM.PIWIK) {
2   $(document).ready(function () {
3     var base = document.location.protocol + "//" + OSM.PIWIK.location + "/";
4     var piwikTracker;
5
6     var piwikLoader = $.ajax({
7       url: base + "piwik.js",
8       dataType: "script",
9       cache: true,
10       success: function () {
11         piwikTracker = Piwik.getTracker(base + "piwik.php", OSM.PIWIK.site);
12       
13         piwikTracker.trackPageView();
14         piwikTracker.enableLinkTracking();
15       
16         $("meta[name=piwik-goal]").each(function () {
17           piwikTracker.trackGoal($(this).attr("content"));
18         });
19       }
20     });
21
22     $("body").on("piwikgoal", function (e, goal) {
23       piwikLoader.done(function () {
24         piwikTracker.trackGoal(goal);
25       });
26     });
27   });
28 }