Hinode logo
  • About 
  • Docs 
  • Components 
  • Guides 
  • Releases 
  •  
  •    Toggle theme
    •   Light
    •   Dark
    •   Auto
  •  
    •   Light
    •   Dark
    •   Auto
Docs
    • Introduction
    • Commands
    • Hosting and deployment
    • Upgrading
    • Contribute
    • Troubleshooting
    • Content management
    • Content organization
    • Typography
    • Links and cross-references
    • Images and figures
    • Tables
    • Icons
    • Layout
    • Colors
    • Color modes
    • Fonts
    • Languages
    • Navigation
    • Documentation
    • Analytics
    • Modules
    • Abbr
    • Accordion
    • Alert
    • Animation
    • Badge
    • Breadcrumb
    • Button
    • Button group
    • Card
    • Card group
    • Carousel
    • Collapse
    • Command prompt
    • Docs
    • Example
    • File
    • Icon
    • Image
    • Kbd
    • Link
    • Map
    • Mark
    • Navbar
    • Navs and tabs
    • Release
    • Spinner
    • Spinner
    • Sub
    • Sup
    • Timeline
    • Toast
    • Tooltip
    • Overview
    • Styles
    • Scripts
    • Icons
    • Module development
    • Server headers
    • Server-side redirection
    • Credits
    • License
    • Introduction
    • Commands
    • Hosting and deployment
    • Upgrading
    • Contribute
    • Troubleshooting
    • Content management
    • Content organization
    • Typography
    • Links and cross-references
    • Images and figures
    • Tables
    • Icons
    • Layout
    • Colors
    • Color modes
    • Fonts
    • Languages
    • Navigation
    • Documentation
    • Analytics
    • Modules
    • Abbr
    • Accordion
    • Alert
    • Animation
    • Badge
    • Breadcrumb
    • Button
    • Button group
    • Card
    • Card group
    • Carousel
    • Collapse
    • Command prompt
    • Docs
    • Example
    • File
    • Icon
    • Image
    • Kbd
    • Link
    • Map
    • Mark
    • Navbar
    • Navs and tabs
    • Release
    • Spinner
    • Spinner
    • Sub
    • Sup
    • Timeline
    • Toast
    • Tooltip
    • Overview
    • Styles
    • Scripts
    • Icons
    • Module development
    • Server headers
    • Server-side redirection
    • Credits
    • License

Analytics

Share via
Hinode
Link copied to clipboard

Enable analytics for your website to view usage statistics and more.

On this page
 

  • Configuration
  • Default behavior
    • Anonymous users
    • Local development
  • Content Security Policy
    • Google Analytics 4
    • Universal Analytics (Google Analytics)

Configuration  

Hinode supports Google Universal Analytics and Google Analytics 4 out-of-the-box. Simply add your Google property (starting with G- or UA-) to the configuration in config/_default/hugo.toml.

 
Google has deprecrated Universal Analytics in favor of Google Analytics 4. On July 1, 2023, standard Universal Analytics properties will no longer process data. 360 Universal Analytics properties will receive a one-time processing extension ending on July 1, 2024.
[services]
  [services.googleAnalytics]
    ID = "G-xxxxxxxxxx"

Default behavior  

Review the next sections to understand the default behavior when dealing with web analytics.

Anonymous users  

Hinode anonymizes the visitor’s IP address when the client sends a Do Not Track request.

Local development  

By default, analytics is disabled when running on a local machine to prevent polution of the gathered insights. Modify the condition (not site.IsServer) as needed.

The file assets/js/analytics.js defines the JavaScript template that is ingested into the main bundle.

{{- $pc := .Site.Config.Privacy.GoogleAnalytics -}}
{{- if (and (not .Site.IsServer) (not $pc.Disable)) -}}
[...]
{{- end -}}

The partial layouts/partials/footer/scripts.html loads the Google Tag Manager if applicable (Google Analytics 4 only).

{{- if and (not site.IsServer) $header -}}
[...]
{{- end -}}

Content Security Policy  

Google Analytics requires several Content Security Policies  to be set in the server headers.

Google Analytics 4  

Hinode has enabled access for Google Analytics 4 by default. The following settings are added to config/_default/server.toml. Similar settings are defined in the netlify.toml file provided in the repository’s root when deploying to Netlify  .

script-src:  https://*.googletagmanager.com
img-src:     https://*.google-analytics.com https://*.googletagmanager.com
connect-src: https://*.google-analytics.com https://*.analytics.google.com https://*.googletagmanager.com

Universal Analytics (Google Analytics)  

Access for Universal Analytics is not enabled by default. Ensure the following settings are defined in config/_default/server.toml and netlify.toml when applicable.

script-src: https://www.google-analytics.com https://ssl.google-analytics.com
img-src: https://www.google-analytics.com
connect-src: https://www.google-analytics.com
Last updated: November 1, 2023 • Use Google Analytics ID (12644d3)
On this page
  • Configuration
  • Default behavior
    • Anonymous users
    • Local development
  • Content Security Policy
    • Google Analytics 4
    • Universal Analytics (Google Analytics)
Analytics
Analytics
Hinode is a clean documentation and blog theme for your Hugo site based on Bootstrap 5.
Code licensed MIT, docs CC BY-NC 4.0
Currently v0.21.8
 
Links
Home 
About 
Docs 
Components 
Releases 
Guides
Getting started 
Developing modules 
Optimization 
Versioning 
Community
Issues  
Discussions  
Contribute 
Hinode
Code copied to clipboard