Commit 0024b4e6 authored by Stan Hu's avatar Stan Hu

Merge branch 'rename-piwik-matomo' into 'master'

Rename Piwik to Matomo

See merge request gitlab-org/gitlab!45658
parents f4db04ef 49ed77a1
......@@ -88,5 +88,5 @@
= yield :meta_tags
= 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'
<!-- Piwik -->
<!-- Matomo -->
= javascript_tag nonce: true do
:plain
var _paq = _paq || [];
var _paq = window._paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//#{extra_config.piwik_url}/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', "#{extra_config.piwik_site_id}"]);
var u="//#{extra_config.matomo_url}/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', "#{extra_config.matomo_site_id}"]);
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>
<!-- End Piwik Code -->
<noscript><p><img src="//#{extra_config.matomo_url}/matomo.php?idsite=#{extra_config.matomo_site_id}" style="border:0;" alt="" /></p></noscript>
<!-- 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
## Google tag manager
# google_tag_manager_id: '_your_tracking_id'
## Piwik analytics.
# piwik_url: '_your_piwik_url'
# piwik_site_id: '_your_piwik_site_id'
## Matomo analytics.
# matomo_url: '_your_matomo_url'
# matomo_site_id: '_your_matomo_site_id'
rack_attack:
git_basic_auth:
......
......@@ -785,6 +785,8 @@ Settings.forti_authenticator['port'] = 443 if Settings.forti_authenticator['port
# Extra customization
#
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
......
......@@ -252,6 +252,7 @@ Markdown
markdownlint
matcher
matchers
Matomo
Mattermost
mbox
memoization
......
......@@ -31,7 +31,7 @@ GitLab's CSP is used for the following:
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 Google, Twitter, GitHub, etc. to allow OAuth authentication.
......@@ -66,7 +66,7 @@ Some resources on implementing Subresource Integrity:
## Including external resources
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
resources via `iframes` should never be used except in certain circumstances
such as with reCAPTCHA, which cannot be used without an `iframe`.
......
......@@ -86,21 +86,21 @@ RSpec.describe 'layouts/_head' do
end
end
context 'when a Piwik config is set' do
let(:piwik_host) { 'piwik.example.com' }
context 'when a Matomo config is set' do
let(:matomo_host) { 'matomo.example.com' }
before do
stub_config(extra: {
piwik_url: piwik_host,
piwik_site_id: 12345
matomo_url: matomo_host,
matomo_site_id: 12345
})
end
it 'add a Piwik Javascript' do
it 'add a Matomo Javascript' do
render
expect(rendered).to match(/<script.*>.*var u="\/\/#{piwik_host}\/".*<\/script>/m)
expect(rendered).to match(%r(<noscript>.*<img src="//#{piwik_host}/piwik.php.*</noscript>))
expect(rendered).to match(/<script.*>.*var u="\/\/#{matomo_host}\/".*<\/script>/m)
expect(rendered).to match(%r(<noscript>.*<img src="//#{matomo_host}/matomo.php.*</noscript>))
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