ITADN

[Bug]: Missing full gtag.js script for Google Analytics in layouts/partials/head.html

#1835Closedcarmelolg 创建于 2026-02-16
bug
C
carmelolgcommented
### What happened? The current `layouts/partials/head.html` does not include the full Google Analytics gtag.js script, despite config support for `site.Params.analytics.google.SiteVerificationTag`. This prevents proper GA4 tracking without user overrides. Expected script in `head.html`: ``` <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id={{ site.Params.analytics.google.SiteVerificationTag }}"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '{{ site.Params.analytics.google.SiteVerificationTag }}'); </script> ``` ### Steps to reproduce 1. Set `params.analytics.google.SiteVerificationTag: "G-XXXXXX"` in config. 2. Build site in production. 3. Inspect `<head>`: no gtag script loaded. ### Hugo Version Hugo >= 0.146.0 (Recommended - Minimum version required for PaperMod) ### PaperMod Version master on commit: 6c5a8f6 ### What kind of devices are you seeing the problem on? _No response_ ### What browsers are you seeing the problem on? _No response_ ### Browser Version _No response_ ### Relevant log output ```shell No log available ``` ### Repository/Source Code link where this issue can be reproduced _No response_ ### Code of Conduct - [x] I agree to follow this project's Code of Conduct
关闭于 2026-02-17 1 条评论