2 $(document).ready(function () {
3 var base = document.location.protocol + "//" + OSM.MATOMO.location + "/";
6 var matomoLoader = $.ajax({
7 url: base + "matomo.js",
10 success: function () {
11 matomoTracker = Matomo.getTracker(base + "matomo.php", OSM.MATOMO.site);
14 matomoTracker.setUserId(OSM.user.toString());
17 matomoTracker.trackPageView();
18 matomoTracker.enableLinkTracking();
20 $("meta[name=matomo-goal]").each(function () {
21 matomoTracker.trackGoal($(this).attr("content"));
26 $("body").on("matomogoal", function (e, goal) {
27 matomoLoader.done(function () {
28 matomoTracker.trackGoal(goal);