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);
13 if (OSM.user && OSM.MATOMO.set_user) {
14 matomoTracker.setUserId(OSM.user.toString());
17 if (OSM.MATOMO.visitor_cookie_timeout) {
18 matomoTracker.setVisitorCookieTimeout(OSM.MATOMO.visitor_cookie_timeout);
21 if (OSM.MATOMO.referral_cookie_timeout) {
22 matomoTracker.setReferralCookieTimeout(OSM.MATOMO.referral_cookie_timeout);
25 if (OSM.MATOMO.session_cookie_timeout) {
26 matomoTracker.setSessionCookieTimeout(OSM.MATOMO.session_cookie_timeout);
29 matomoTracker.setSecureCookie( true );
30 matomoTracker.trackPageView();
31 matomoTracker.enableLinkTracking();
33 $("meta[name=matomo-goal]").each(function () {
34 matomoTracker.trackGoal($(this).attr("content"));
39 $("body").on("matomogoal", function (e, goal) {
40 matomoLoader.done(function () {
41 matomoTracker.trackGoal(goal);