Skip to content

[Bug] Umami analytics not working - config needs to move up in params.toml #511

@a492652

Description

@a492652

I confirm:

Hugo version

hugo v0.148.2+extended+withdeploy linux/amd64

Where is this bug showing up?

On the command line: Hugo won't build the site and shows warnings or errors.

Operating system

Artix Linux 6.12.40-1-lts

Browser (if applicable)

No response

Current behavior

When defining variables 'umami_data_website_id' and 'umami_script_url' in params.toml the umami analytics is not added to the website and the tracking script is not loaded when browsing the website (in production, not development).

Expected behavior

When defining variables 'umami_data_website_id' and 'umami_script_url' in params.toml the umami analytics should be added to the website and the tracking script should be loaded when browsing the website (in production, not development).

Steps to reproduce

Define variables 'umami_data_website_id' and 'umami_script_url' in params.toml and build the website.
Open browser with developer tools and see that the script is not loaded from the network.
Check the source code in the browser and see that the script is not in the section.

Relevant log output

Related code

https://github.com/chipzoller/hugo-clarity/blob/master/exampleSite/config/_default/params.toml

lines 171-173

# 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)
# umami_script_url = "https://cloud.umami.is/script.js" # Umami Analytics script URL

https://github.com/chipzoller/hugo-clarity/blob/master/layouts/partials/analytics.html

lines 55-57

{{- with $config.umami_data_website_id }}
<script defer src="{{ $config.umami_script_url }}" data-website-id="{{ . }}"></script>
{{- end }}

Preferred solution

Since the umami config in params.toml actually falls under '[matomo_analytics]' on line 165, the '$config.umami_data_website_id' and '$config.umami_script_url' in analytics.html are not defined.

Moving the umami lines in params.toml higher up, for example after line 22 fixes this issue.

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions