Skip to content

Commit

Permalink
Adding Umami Analytics Support
Browse files Browse the repository at this point in the history
Adding support for https://umami.is/ analytics.

Signed-off-by: Robert Terakedis <[email protected]>
  • Loading branch information
rterakedis committed Sep 22, 2024
1 parent 174847b commit 4e2d3fb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
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 @@ -337,6 +338,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 @@ -149,3 +149,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 }}

0 comments on commit 4e2d3fb

Please sign in to comment.