Hinode logo
  • About 
  • Docs 
  • Components 
  • Guides 
  • Releases 
  •  
Docs
  • Getting Started
    • Introduction
    • Commands
    • Hosting and Deployment
    • Upgrading
    • Private Modules and Packages
    • Contribute
    • Troubleshooting
  • Content
    • Content Management
    • Content Organization
    • Typography
    • Links and Cross-References
    • Images and Figures
    • Tables
    • Icons
  • Configuration
    • Layout
    • Colors
    • Color Modes
    • Fonts
    • Languages
    • Navigation
    • Documentation
    • Analytics
    • Modules
    • Cookie Consent
    • Digital Asset Managers
  • Components
    • Abbr
    • Accordion
    • Alert
    • Animation
    • Args
    • Badge
    • Breadcrumb
    • Button
    • Button Group
    • Card
    • Card Group
    • Carousel
    • Collapse
    • Command Prompt
    • Docs
    • Example
    • File
    • Icon
    • Image
    • Ins
    • Kbd
    • Link
    • Map
    • Mark
    • Navbar
    • Navs and Tabs
    • Persona
    • Release
    • Spinner
    • Sub
    • Sup
    • Table
    • Timeline
    • Toast
    • Tooltip
    • Video
  • Advanced Settings
    • Overview
    • Styles
    • Scripts
    • Icons
    • Partial Development
    • Module Development
    • Server Headers
    • Server-Side Redirection
  • About
    • Credits
    • License
  • Getting Started
    • Introduction
    • Commands
    • Hosting and Deployment
    • Upgrading
    • Private Modules and Packages
    • Contribute
    • Troubleshooting
  • Content
    • Content Management
    • Content Organization
    • Typography
    • Links and Cross-References
    • Images and Figures
    • Tables
    • Icons
  • Configuration
    • Layout
    • Colors
    • Color Modes
    • Fonts
    • Languages
    • Navigation
    • Documentation
    • Analytics
    • Modules
    • Cookie Consent
    • Digital Asset Managers
  • Components
    • Abbr
    • Accordion
    • Alert
    • Animation
    • Args
    • Badge
    • Breadcrumb
    • Button
    • Button Group
    • Card
    • Card Group
    • Carousel
    • Collapse
    • Command Prompt
    • Docs
    • Example
    • File
    • Icon
    • Image
    • Ins
    • Kbd
    • Link
    • Map
    • Mark
    • Navbar
    • Navs and Tabs
    • Persona
    • Release
    • Spinner
    • Sub
    • Sup
    • Table
    • Timeline
    • Toast
    • Tooltip
    • Video
  • Advanced Settings
    • Overview
    • Styles
    • Scripts
    • Icons
    • Partial Development
    • Module Development
    • Server Headers
    • Server-Side Redirection
  • About
    • 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  

Configuration  

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

[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 pollution 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.

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

Content Security Policy  

Google Analytics Requires Several Content Security Policies  to be set in the Server Headers. 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
• Adapt notation required by render hook for markdown links (a1606f0)
On this page:
Configuration   Default Behavior   Anonymous Users   Local Development   Content Security Policy  
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.29.3
Privacy | Cookies
 
Links
Home 
About 
Docs 
Components 
Releases 
Guides
Getting Started 
Developing Modules 
Optimization 
Versioning 
Community
Issues   
Discussions   
Contribute 
Hinode
Code copied to clipboard