Add Matomo tracking code

This commit is contained in:
Chaïb Martinez 2018-11-02 14:55:59 +01:00 committed by gregoirenovel
parent 86fcf9cf23
commit 3187b5b05a
3 changed files with 22 additions and 0 deletions

View file

@ -0,0 +1,15 @@
:javascript
var _paq = _paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(["setCookieDomain", "*.www.demarches-simplifiees.fr"]);
_paq.push(["setDomains", ["*.www.demarches-simplifiees.fr"]]);
_paq.push(["setDoNotTrack", true]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//stats.data.gouv.fr/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', '73']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();

View file

@ -16,10 +16,13 @@
= javascript_include_tag 'application', defer: true, 'data-turbolinks-track': 'reload'
= csrf_meta_tags
= render partial: "layouts/matomo"
:javascript
DATA = [{
sentry: #{raw(sentry_config)}
}];
%body{ class: browser.platform.ios? ? 'ios' : nil }
= render partial: 'layouts/outdated_browser_banner'
= render partial: 'layouts/pre_maintenance'

View file

@ -21,10 +21,14 @@
- if Rails.env.development?
= stylesheet_link_tag :xray
- if !current_user
= render partial: "layouts/matomo"
:javascript
DATA = [{
sentry: #{raw(sentry_config)}
}];
%body{ class: browser.platform.ios? ? 'ios' : nil }
.page-wrapper
= render partial: "layouts/outdated_browser_banner"