Skip to content

Commit

Permalink
Added Matomo analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
dhjensen committed Oct 12, 2024
1 parent be9cd37 commit 24c667c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pelican-bootstrap3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ This theme honors the following standard Pelican settings:
* `GOOGLE_ANALYTICS` (classic tracking code)
* `GOOGLE_ANALYTICS_UNIVERSAL` and `GOOGLE_ANALYTICS_UNIVERSAL_PROPERTY` (Universal tracking code)
* `DISQUS_SITENAME`
* `PIWIK_URL`, `PIWIK_SSL_URL` and `PIWIK_SITE_ID`
* `PIWIK_URL`, `PIWIK_SSL_URL` and `PIWIK_SITE_ID` or
* `MATOMO_URL`, `MATOMO_SITE_ID`

It uses the `tag_cloud` variable for displaying tags in the sidebar. You can
control the amount of tags shown with: `TAG_CLOUD_MAX_ITEMS`
Expand Down
1 change: 1 addition & 0 deletions pelican-bootstrap3/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@
{% include 'includes/sidebar/github-js.html' %}
{% include 'includes/disqus_script.html' %}
{% include 'includes/piwik.html' %}
{% include 'includes/matomo.html' %}

{% if 'liquid_tags.notebook' in PLUGINS %}
{% include 'includes/liquid_tags_nb_footer.html' %}
Expand Down
17 changes: 17 additions & 0 deletions pelican-bootstrap3/templates/includes/matomo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% if MATOMO_SITE_ID and MATOMO_URL %}
<!-- Matomo -->
<script>
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//{{ MATOMO_URL }}/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '{{ MATOMO_SITE_ID }}']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
{% endif %}

0 comments on commit 24c667c

Please sign in to comment.