Rename piwik to matomo and merge configuration into settings
This commit is contained in:
parent
4f74a67f6c
commit
e9f62a8c30
13 changed files with 49 additions and 53 deletions
32
app/assets/javascripts/matomo.js
Normal file
32
app/assets/javascripts/matomo.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
if (OSM.MATOMO) {
|
||||
$(document).ready(function () {
|
||||
var base = document.location.protocol + "//" + OSM.MATOMO.location + "/";
|
||||
var matomoTracker;
|
||||
|
||||
var matomoLoader = $.ajax({
|
||||
url: base + "matomo.js",
|
||||
dataType: "script",
|
||||
cache: true,
|
||||
success: function () {
|
||||
matomoTracker = Matomo.getTracker(base + "matomo.php", OSM.MATOMO.site);
|
||||
|
||||
if (OSM.user) {
|
||||
matomoTracker.setUserId(OSM.user.toString());
|
||||
}
|
||||
|
||||
matomoTracker.trackPageView();
|
||||
matomoTracker.enableLinkTracking();
|
||||
|
||||
$("meta[name=matomo-goal]").each(function () {
|
||||
matomoTracker.trackGoal($(this).attr("content"));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$("body").on("matomogoal", function (e, goal) {
|
||||
matomoLoader.done(function () {
|
||||
matomoTracker.trackGoal(goal);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue