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
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,7 +6,6 @@
|
|||
.vagrant
|
||||
app/assets/javascripts/i18n
|
||||
config/environments/*.local.yml
|
||||
config/piwik.yml
|
||||
config/settings.local.yml
|
||||
config/settings/*.local.yml
|
||||
coverage
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
//= require leaflet.locationfilter
|
||||
//= require i18n
|
||||
//= require oauth
|
||||
//= require piwik
|
||||
//= require matomo
|
||||
//= require richtext
|
||||
//= require qs/dist/qs
|
||||
//= require bs-custom-file-input
|
||||
|
|
|
@ -212,13 +212,13 @@ $(document).ready(function () {
|
|||
}
|
||||
});
|
||||
|
||||
if (OSM.PIWIK) {
|
||||
if (OSM.MATOMO) {
|
||||
map.on("layeradd", function (e) {
|
||||
if (e.layer.options) {
|
||||
var goal = OSM.PIWIK.goals[e.layer.options.keyid];
|
||||
var goal = OSM.MATOMO.goals[e.layer.options.keyid];
|
||||
|
||||
if (goal) {
|
||||
$("body").trigger("piwikgoal", goal);
|
||||
$("body").trigger("matomogoal", goal);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
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);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
|
@ -3,8 +3,8 @@
|
|||
//= require qs/dist/qs
|
||||
|
||||
OSM = {
|
||||
<% if defined?(PIWIK) %>
|
||||
PIWIK: <%= PIWIK.to_json %>,
|
||||
<% if defined?(Settings.matomo) %>
|
||||
MATOMO: <%= Settings.matomo.to_json %>,
|
||||
<% end %>
|
||||
|
||||
MAX_REQUEST_AREA: <%= Settings.max_request_area.to_json %>,
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
if (OSM.PIWIK) {
|
||||
$(document).ready(function () {
|
||||
var base = document.location.protocol + "//" + OSM.PIWIK.location + "/";
|
||||
var piwikTracker;
|
||||
|
||||
var piwikLoader = $.ajax({
|
||||
url: base + "piwik.js",
|
||||
dataType: "script",
|
||||
cache: true,
|
||||
success: function () {
|
||||
piwikTracker = Piwik.getTracker(base + "piwik.php", OSM.PIWIK.site);
|
||||
|
||||
if (OSM.user) {
|
||||
piwikTracker.setUserId(OSM.user.toString());
|
||||
}
|
||||
|
||||
piwikTracker.trackPageView();
|
||||
piwikTracker.enableLinkTracking();
|
||||
|
||||
$("meta[name=piwik-goal]").each(function () {
|
||||
piwikTracker.trackGoal($(this).attr("content"));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$("body").on("piwikgoal", function (e, goal) {
|
||||
piwikLoader.done(function () {
|
||||
piwikTracker.trackGoal(goal);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
|
@ -83,7 +83,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
if current_user.save
|
||||
flash[:piwik_goal] = PIWIK["goals"]["signup"] if defined?(PIWIK)
|
||||
flash[:matomo_goal] = Settings.matomo["goals"]["signup"] if defined?(Settings.matomo)
|
||||
|
||||
referer = welcome_path
|
||||
|
||||
|
|
|
@ -20,6 +20,6 @@
|
|||
<%= tag.link :rel => "search", :type => "application/opensearchdescription+xml", :title => "OpenStreetMap Search", :href => asset_path("osm.xml") %>
|
||||
<%= tag.meta :name => "description", :content => "OpenStreetMap is the free wiki world map." %>
|
||||
<%= opengraph_tags(@title) %>
|
||||
<% if flash[:piwik_goal] -%>
|
||||
<%= tag.meta :name => "piwik-goal", :content => flash[:piwik_goal] %>
|
||||
<% if flash[:matomo_goal] -%>
|
||||
<%= tag.meta :name => "matomo-goal", :content => flash[:matomo_goal] %>
|
||||
<% end -%>
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
<body class="<%= body_class %>">
|
||||
<%= render :partial => "layouts/header" %>
|
||||
<%= render :partial => "layouts/content" %>
|
||||
<% if defined?(PIWIK) -%>
|
||||
<noscript><p><img src="<%= request.protocol %><%= PIWIK["location"] %>/piwik.php?idsite=<%= PIWIK["site"] %>" class="piwik" alt="" /></p></noscript>
|
||||
<% if defined?(Settings.matomo) -%>
|
||||
<noscript><p><img src="<%= request.protocol %><%= Settings.matomo["location"] %>/matomo.php?idsite=<%= Settings.matomo["site"] %>" class="matomo" alt="" /></p></noscript>
|
||||
<% end -%>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"I18n": "readonly",
|
||||
"L": "readonly",
|
||||
"OSM": "writable",
|
||||
"Piwik": "readonly",
|
||||
"Matomo": "readonly",
|
||||
"Qs": "readonly",
|
||||
"updateLinks": "readonly"
|
||||
},
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
require "yaml"
|
||||
|
||||
if File.exist?(piwik_file = File.expand_path("../piwik.yml", __dir__))
|
||||
PIWIK = YAML.load_file(piwik_file)
|
||||
end
|
|
@ -18,9 +18,9 @@ csp_policy = {
|
|||
:report_uri => []
|
||||
}
|
||||
|
||||
csp_policy[:connect_src] << PIWIK["location"] if defined?(PIWIK)
|
||||
csp_policy[:img_src] << PIWIK["location"] if defined?(PIWIK)
|
||||
csp_policy[:script_src] << PIWIK["location"] if defined?(PIWIK)
|
||||
csp_policy[:connect_src] << Settings.matomo["location"] if defined?(Settings.matomo)
|
||||
csp_policy[:img_src] << Settings.matomo["location"] if defined?(Settings.matomo)
|
||||
csp_policy[:script_src] << Settings.matomo["location"] if defined?(Settings.matomo)
|
||||
|
||||
csp_policy[:img_src] << Settings.avatar_storage_url if Settings.key?(:avatar_storage_url)
|
||||
csp_policy[:img_src] << Settings.trace_image_storage_url if Settings.key?(:trace_image_storage_url)
|
||||
|
|
|
@ -138,3 +138,5 @@ smtp_tls_verify_mode: "none"
|
|||
smtp_authentication: null
|
||||
smtp_user_name: null
|
||||
smtp_password: null
|
||||
# Matomo settings for analytics
|
||||
#matomo:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue