Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Umami Analytics Support #482

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ These options set global values that some pages or all pages in the site use by
| baidu_analytics | string | no |
| plausible_analytics | boolean | no |
| matomo_analytics | boolean | no |
| umami_data_website_id | string | no |
| description | string | yes |
| keywords | array of strings | yes |
| introDescription | string | yes |
Expand Down Expand Up @@ -338,6 +339,10 @@ If using Matomo Analytics, configure the `matomo_analytics` global parameters in

`matomoSiteID` Default is set to 1, change this to the siteid being tracked

If using [Umami Analytics](https://umami.is/), uncomment and configure the `umami_data_website_id` global parameter in your site with the data website ID provided in the script by Umami. It should be in the form of a GUID (# characters): 8-4-4-4-12.

> NOTE: The head partial only loads analytics if the hugo environment is NOT `development`.

### Blog directory

Edit `params.toml` and change the `mainSections` key. Values will be directories where the blogs reside.
Expand Down
3 changes: 3 additions & 0 deletions exampleSite/config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,6 @@ enable = false # To enable matomo analytics change to `true`.
websiteDomain = "example.com" # Set the domain name of your website, in most cases same as your base URL this is required.
matomoDomain = "matomo.example.com" # Set to Matomo domain
matomoSiteID = "1" # Default is set to 1, change this to the siteid being tracked

# Umami Analytics -- https://umami.is/
# umami_data_website_id = "GUID-8-4-4-4-12" # Umami Analytics data website id - GUID format (8-4-4-4-12)
4 changes: 4 additions & 0 deletions layouts/partials/analytics.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,7 @@
<noscript><p><img src="//{{ $matomo.matomoDomain }}/matomo.php?idsite={{ default 1 $matomo.matomoSiteID }}&amp;rec=1" style="border:0;" alt="" /></p></noscript>
<!-- End Matomo Code -->
{{- end }}

{{- with $config.umami_data_website_id }}
<script defer src="https://cloud.umami.is/script.js" data-website-id="{{ . }}"></script>
{{- end }}