You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
GA client script does not send proper analytics metrics to Google.
This happens if one uses the anatole template and sets a Google Analytics v4 tracking Id in the config file.
As shown in the picture, a client side script is run but does not send any metrics via Post ("Kein Inhalt für diese Anfrage" = "No content for request").
To Reproduce
Go to config.toml
Set googleAnalytics = 'G-MEASUREMENT_ID'
Start hugo server hugo server -D
Start a Webbrowser of choice and browse to lokal instance
Check POST messages to google-analytics.com via Webdev Tools of your Browser
Expected behavior
According to Hugo Docs setting a GA v4 ID is sufficient to configure the internal template properly.
The client side GA script should transmit some metrics to Google via POST messages.
Desktop (please complete the following information):
OS: macOS 12.2.1
Browser: Safari, Firefox (doesn't matter)
Version of the Theme: 1.8.0
Version of Hugo: 0.95.0
Additional context
My current work around is a custom partial for footer.html which uses _internal/google_analytics.html template instead of _internal/google_analytics_async.html as specified in Hugo Docs.
The text was updated successfully, but these errors were encountered:
@vladimirdoroch If I read the docs correctly, we would need to distinguish between a GAv4 and the v3. In case of the former we should load google_analytics.html and not _internal/google_analytics_async.html. Right now, I am not sure how this distinction could be made programmatically.
Maybe one can load the appropriate template based on the prefix of the tracking Id.
As I understand v3 (UA-XXXXXXX-X) and v4 (G-XXXXXXXX) tracking Ids can by identified that way.
This could be catched by something like {{ if hasPrefix . "G-"}}. What do you think?
Describe the bug
GA client script does not send proper analytics metrics to Google.
This happens if one uses the anatole template and sets a Google Analytics v4 tracking Id in the config file.
As shown in the picture, a client side script is run but does not send any metrics via Post ("Kein Inhalt für diese Anfrage" = "No content for request").
To Reproduce
config.toml
googleAnalytics = 'G-MEASUREMENT_ID'
hugo server -D
POST
messages togoogle-analytics.com
via Webdev Tools of your BrowserExpected behavior
According to Hugo Docs setting a GA v4 ID is sufficient to configure the internal template properly.
The client side GA script should transmit some metrics to Google via POST messages.
In the example above:
Desktop (please complete the following information):
Additional context
My current work around is a custom partial for
footer.html
which uses_internal/google_analytics.html
template instead of_internal/google_analytics_async.html
as specified in Hugo Docs.The text was updated successfully, but these errors were encountered: