All Projects → holehan → hugo-component-matomo

holehan / hugo-component-matomo

Licence: MIT license
Matomo user tracking and optout scripts for Hugo

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to hugo-component-matomo

matomo-mediawiki-extension
www.mediawiki.org/wiki/Extension:Piwik_Integration
Stars: ✭ 18 (-52.63%)
Mutual labels:  piwik, matomo
matomo-for-wordpress
Get a fully functioning Matomo Analytics for your WordPress. Star us on Github? +1. Matomo is the leading open alternative to Google Analytics that gives you full control over your data. Privacy is built-in. 100% data ownership, no one else can see your data. We love Pull Requests!
Stars: ✭ 90 (+136.84%)
Mutual labels:  piwik, matomo
matomo-tracker
Stand alone library for using matamo tracking in frontend projects
Stars: ✭ 138 (+263.16%)
Mutual labels:  piwik, matomo
DSGVO-Liste
Informationen und Ressourcen zur Datenschutz-Grundverordnung
Stars: ✭ 51 (+34.21%)
Mutual labels:  gdpr, dsgvo
hugo-cloak-email
A Hugo theme component to cloak email adresses
Stars: ✭ 71 (+86.84%)
Mutual labels:  hugo, hugo-theme-component
pganonymize
A commandline tool for anonymizing PostgreSQL databases
Stars: ✭ 20 (-47.37%)
Mutual labels:  gdpr, dsgvo
nodejs-piwik
Access a Matomo (Piwik) API from node.js
Stars: ✭ 37 (-2.63%)
Mutual labels:  piwik, matomo
ngx-matomo
Matomo (aka. Piwik) web analytics for Angular applications
Stars: ✭ 83 (+118.42%)
Mutual labels:  piwik, matomo
hugo-search-fuse-js
Hugo theme component for implementing static site search using Fuse.js
Stars: ✭ 52 (+36.84%)
Mutual labels:  hugo, hugo-theme-component
hugo-notice
A Hugo theme component to display nice notices
Stars: ✭ 138 (+263.16%)
Mutual labels:  hugo, hugo-theme-component
bootstrap-cookie-consent-settings
A modal dialog (cookie banner) and framework to handle the German and EU law about cookies in a website. Needs Bootstrap.
Stars: ✭ 25 (-34.21%)
Mutual labels:  gdpr, dsgvo
hugo-shortcodes-netlify-cms
Shortcodes of Hugo for Netlify CMS Text Editor
Stars: ✭ 50 (+31.58%)
Mutual labels:  hugo, hugo-theme-component
cookie-consent-js
A simple dialog and framework to handle the German and EU law about cookies in a website (December 2021)
Stars: ✭ 55 (+44.74%)
Mutual labels:  gdpr, dsgvo
database-anonymizer
CLI tool an PHP library to anonymize data in various databases
Stars: ✭ 23 (-39.47%)
Mutual labels:  gdpr, dsgvo
Matomo
Liberating Web Analytics. Star us on Github? +1. Matomo is the leading open alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. We love Pull Requests!
Stars: ✭ 15,711 (+41244.74%)
Mutual labels:  piwik, matomo
hugo-atom-feed
Hugo theme component for ATOM feed custom Output Format
Stars: ✭ 29 (-23.68%)
Mutual labels:  hugo, hugo-theme-component
gatsby-plugin-matomo
🥂 Gatsby plugin to add Matomo (formerly Piwik) onto a site.
Stars: ✭ 56 (+47.37%)
Mutual labels:  piwik, matomo
Netlify Statuskit
Netlify StatusKit is a template to deploy your own Status pages on Netlify.
Stars: ✭ 216 (+468.42%)
Mutual labels:  hugo
Forestry.io
Forestry.io website
Stars: ✭ 233 (+513.16%)
Mutual labels:  hugo
Hugo Theme Codex
A minimal blog theme for Hugo 🍜
Stars: ✭ 212 (+457.89%)
Mutual labels:  hugo

About

Matomo tracking and optout scripts for Hugo.

Requirements

Install component as a submodule

git submodule add https://github.com/holehan/hugo-components-matomo.git themes/matomo

Update component

git submodule update --remote themes/matomo

Usage

  • Add the matomo components to your Hugo project's config.toml:

    theme = ["YOURTHEME", "matomo"]
  • Include the tracking partial in your Hugo templates, e.g. in footer.html

    {{ partial "matomo-tracking" . }}
  • Add the optout shortcode to your privacy page

    {{< matomo-optout >}}

Configure tracking (mandatory)

Add the matomo server url and your site's tracking id to your Hugo project's params within your config.toml. If e.g. your matomo server is located at example.org and your Hugo project's site id is 1, add the following:

[params.matomo]
url = "https://example.org"
id = 1

The scripts and styles are fingerprinted, and SRI is applied by default. If you want to disable SRI (e.g. in case your webhoster optimzes your assets automagically), add the following to your matomo config in config.toml:

[params.matomo]
disableSRI = true

Configure optout

Customize the optout message and button text by adding the following to your config.toml. The message text supports markdown, the button text does not.

[params.matomo.track]
button = "Datenerhebung zulassen"
message = "Ihre Sitzungsdaten werden erhoben."
[params.matomo.block]
button = "Datenerhebung abstellen"
message = "Ihre Sitzungsdaten werden *nicht* erhoben."

Alternatively use the page's frontmatter to customize the optout message and button text. The message text supports markdown, the button text does not.

matomo:
  track:
    button: Allow tracking
    message: You are being watched. The government has a secret system, a machine that spies on you every hour of every day.
  block:
    button: Disallow tracking
    message: You are **not** tracked.

Style the Matomo Optout component

The generated HTML will look like below.

<div class="MatomoOptout">
  <script ...></script>
  <div class="MatomoOptout-message MatomoOptout-message--track is-hidden">
    You are being watched.
  </div>
  <div class="MatomoOptout-message MatomoOptout-message--block">
    You are not tracked.
  </div>
  <button class="MatomoOptout-button MatomoOptout-button--track">
    Allow tracking
  </button>
  <button class="MatomoOptout-button MatomoOptout-button--block">
    Disable tracking
  </button>
</div>

The matomo component comes with a very limited set of css styles that toggles between the messages. The style file is located at themes/matomo/assets/css/matomo-optout.css. If you want to use your own style file, create a file called assets/css/matomo-optout.css in your Hugo project's or your theme's root folder. Hugo will then pick this file instead of the one shipped with the matomo component.

In case you want to use your own build pipeline, set styleFromAssets = false within [params.matomo]. It's up to you then to add the css styles to one of your own style files.

Use the following classes to style the optout component to your heart's desire.

MatomoOptout
MatomoOptout-message
MatomoOptout-message--track
MatomoOptout-message--track.is-hidden
MatomoOptout-message--block
MatomoOptout-message--block.is-hidden
MatomoOptout-button
MatomoOptout-button--track
MatomoOptout-button--block
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].