-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Matomo open web analytics (#3405)
This adds the possibility for a site to use the Matomo open web analytics (a.k.a. Piwik) for their web analytics instead of, or along with, Google Analytics. It can be enabled in the core config by setting the two required parameters `config.matomo_analytics_server` and `config.matomo_analytics_site_id`. It works analogue to the code for enabling Google Analytics and as such is pretty straightforward.
- Loading branch information
1 parent
4f3e43c
commit 13048b1
Showing
4 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<% server = Refinery::Core.matomo_analytics_server.to_s.strip %> | ||
<% site_id = Refinery::Core.matomo_analytics_site_id.to_s.strip %> | ||
<% unless local_request? or admin? or server =~ /^(analytics.example.org)?$/ or site_id =~ /^$/ -%> | ||
<!-- Matomo --> | ||
<script type="text/javascript"> | ||
var _paq = _paq || []; | ||
_paq.push(['trackPageView']); | ||
_paq.push(['enableLinkTracking']); | ||
(function() { | ||
var u="//<%= server %>/"; | ||
_paq.push(['setTrackerUrl', u+'piwik.php']); | ||
_paq.push(['setSiteId', '<%= 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); | ||
})(); | ||
</script> | ||
<!-- End Matomo Code --> | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters