Commit 49ed77a1 authored by Kate Grechishkina's avatar Kate Grechishkina Committed by Stan Hu

Rename Piwik to Matomo

This currently will fall back to the legacy Piwki settings (`piwiki_url`
and `piwik_site_id`) if the new Matoma settings are not defined.
parent c0c3f829
...@@ -88,5 +88,5 @@ ...@@ -88,5 +88,5 @@
= yield :meta_tags = yield :meta_tags
= render 'layouts/google_analytics' if extra_config.has_key?('google_analytics_id') = render 'layouts/google_analytics' if extra_config.has_key?('google_analytics_id')
= render 'layouts/piwik' if extra_config.has_key?('piwik_url') && extra_config.has_key?('piwik_site_id') = render 'layouts/matomo' if extra_config.has_key?('matomo_url') && extra_config.has_key?('matomo_site_id')
= render 'layouts/snowplow' = render 'layouts/snowplow'
<!-- Piwik --> <!-- Matomo -->
= javascript_tag nonce: true do = javascript_tag nonce: true do
:plain :plain
var _paq = _paq || []; var _paq = window._paq = window._paq || [];
_paq.push(['trackPageView']); _paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']); _paq.push(['enableLinkTracking']);
(function() { (function() {
var u="//#{extra_config.piwik_url}/"; var u="//#{extra_config.matomo_url}/";
_paq.push(['setTrackerUrl', u+'piwik.php']); _paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', "#{extra_config.piwik_site_id}"]); _paq.push(['setSiteId', "#{extra_config.matomo_site_id}"]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; 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); g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})(); })();
<noscript><p><img src="//#{extra_config.piwik_url}/piwik.php?idsite=#{extra_config.piwik_site_id}" style="border:0;" alt="" /></p></noscript> <noscript><p><img src="//#{extra_config.matomo_url}/matomo.php?idsite=#{extra_config.matomo_site_id}" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code --> <!-- End Matomo Code -->
---
title: Rename Piwik config items and layout file after rebranding to Matomo
merge_request: 45658
author: Kate Grechishkina @kategrechishkina
type: changed
...@@ -1216,9 +1216,9 @@ production: &base ...@@ -1216,9 +1216,9 @@ production: &base
## Google tag manager ## Google tag manager
# google_tag_manager_id: '_your_tracking_id' # google_tag_manager_id: '_your_tracking_id'
## Piwik analytics. ## Matomo analytics.
# piwik_url: '_your_piwik_url' # matomo_url: '_your_matomo_url'
# piwik_site_id: '_your_piwik_site_id' # matomo_site_id: '_your_matomo_site_id'
rack_attack: rack_attack:
git_basic_auth: git_basic_auth:
......
...@@ -785,6 +785,8 @@ Settings.forti_authenticator['port'] = 443 if Settings.forti_authenticator['port ...@@ -785,6 +785,8 @@ Settings.forti_authenticator['port'] = 443 if Settings.forti_authenticator['port
# Extra customization # Extra customization
# #
Settings['extra'] ||= Settingslogic.new({}) Settings['extra'] ||= Settingslogic.new({})
Settings.extra['matomo_site_id'] ||= Settings.extra['piwik_site_id']
Settings.extra['matomo_url'] ||= Settings.extra['piwik_url']
# #
# Rack::Attack settings # Rack::Attack settings
......
...@@ -252,6 +252,7 @@ Markdown ...@@ -252,6 +252,7 @@ Markdown
markdownlint markdownlint
matcher matcher
matchers matchers
Matomo
Mattermost Mattermost
mbox mbox
memoization memoization
......
...@@ -31,7 +31,7 @@ GitLab's CSP is used for the following: ...@@ -31,7 +31,7 @@ GitLab's CSP is used for the following:
Some exceptions include: Some exceptions include:
- Scripts from Google Analytics and Piwik if either is enabled. - Scripts from Google Analytics and Matomo if either is enabled.
- Connecting with GitHub, Bitbucket, GitLab.com, etc. to allow project importing. - Connecting with GitHub, Bitbucket, GitLab.com, etc. to allow project importing.
- Connecting with Google, Twitter, GitHub, etc. to allow OAuth authentication. - Connecting with Google, Twitter, GitHub, etc. to allow OAuth authentication.
...@@ -66,7 +66,7 @@ Some resources on implementing Subresource Integrity: ...@@ -66,7 +66,7 @@ Some resources on implementing Subresource Integrity:
## Including external resources ## Including external resources
External fonts, CSS, and JavaScript should never be used with the exception of External fonts, CSS, and JavaScript should never be used with the exception of
Google Analytics and Piwik - and only when the instance has enabled it. Assets Google Analytics and Matomo - and only when the instance has enabled it. Assets
should always be hosted and served locally from the GitLab instance. Embedded should always be hosted and served locally from the GitLab instance. Embedded
resources via `iframes` should never be used except in certain circumstances resources via `iframes` should never be used except in certain circumstances
such as with reCAPTCHA, which cannot be used without an `iframe`. such as with reCAPTCHA, which cannot be used without an `iframe`.
......
...@@ -86,21 +86,21 @@ RSpec.describe 'layouts/_head' do ...@@ -86,21 +86,21 @@ RSpec.describe 'layouts/_head' do
end end
end end
context 'when a Piwik config is set' do context 'when a Matomo config is set' do
let(:piwik_host) { 'piwik.example.com' } let(:matomo_host) { 'matomo.example.com' }
before do before do
stub_config(extra: { stub_config(extra: {
piwik_url: piwik_host, matomo_url: matomo_host,
piwik_site_id: 12345 matomo_site_id: 12345
}) })
end end
it 'add a Piwik Javascript' do it 'add a Matomo Javascript' do
render render
expect(rendered).to match(/<script.*>.*var u="\/\/#{piwik_host}\/".*<\/script>/m) expect(rendered).to match(/<script.*>.*var u="\/\/#{matomo_host}\/".*<\/script>/m)
expect(rendered).to match(%r(<noscript>.*<img src="//#{piwik_host}/piwik.php.*</noscript>)) expect(rendered).to match(%r(<noscript>.*<img src="//#{matomo_host}/matomo.php.*</noscript>))
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment