Merge pull request #6915 from adullact/feature/6872-matomo-domain-config

Configuration du domaine de Matomo
This commit is contained in:
Pierre de La Morinerie 2022-02-15 09:31:06 +01:00 committed by GitHub
commit cf1f92409c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 3 deletions

View file

@ -276,6 +276,8 @@ class ApplicationController < ActionController::Base
matomo = Rails.application.secrets.matomo
{
cookie_domain: matomo[:cookie_domain],
domain: matomo[:domain],
enabled: matomo[:enabled],
host: matomo[:host],
key: matomo[:client_key]

View file

@ -1,4 +1,4 @@
const { enabled, host, key } = gon.matomo || {};
const { cookieDomain, domain, enabled, host, key } = gon.matomo || {};
if (enabled) {
window._paq = window._paq || [];
@ -10,8 +10,8 @@ if (enabled) {
// Configure Matomo analytics
//
window._paq.push(['setCookieDomain', '*.www.demarches-simplifiees.fr']);
window._paq.push(['setDomains', ['*.www.demarches-simplifiees.fr']]);
window._paq.push(['setCookieDomain', cookieDomain]);
window._paq.push(['setDomains', [domain]]);
// Dont store any cookies or send any tracking request when the "Do Not Track" browser setting is enabled.
window._paq.push(['setDoNotTrack', true]);
// When enabling external link tracking, consider that it will also report links to attachments.

View file

@ -67,6 +67,8 @@ SENTRY_DSN_JS=""
# External service: Matomo web analytics
MATOMO_ENABLED="disabled"
MATOMO_COOKIE_DOMAIN="*.www.demarches-simplifiees.fr"
MATOMO_DOMAIN="*.www.demarches-simplifiees.fr"
MATOMO_ID=""
MATOMO_HOST="matomo.example.org"

View file

@ -54,6 +54,8 @@ defaults: &defaults
smtp_key: <%= ENV['SENDINBLUE_SMTP_KEY'] %>
api_v3_key: <%= ENV['SENDINBLUE_API_V3_KEY'] %>
matomo:
cookie_domain: "<%= ENV['MATOMO_COOKIE_DOMAIN'] %>"
domain: "<%= ENV['MATOMO_DOMAIN'] %>"
enabled: <%= ENV['MATOMO_ENABLED'] == 'enabled' %>
host: <%= ENV['MATOMO_HOST'] %>
client_key: <%= ENV['MATOMO_ID'] %>