跳转到内容

📊 Analytics

此内容尚不支持你的语言。

Choose one of these integrations to analyse your site traffic with Hugo Blox:

Pirsch

This is the recommended analytics provider. It’s privacy-first, German-engineered, highly efficient (super-fast page load), and best value for money compared with other privacy-first analytics providers.

Signup to Pirsch Analytics and include the provided tracking ID in config/_default/params.yaml:

marketing:
analytics:
pirsch: 'YOUR_ID'

Fathom

Signup to Fathom Analytics and include the provided tracking ID in config/_default/params.yaml:

marketing:
analytics:
fathom: 'YOUR_ID'

Plausible

Signup to Plausible Analytics and include the provided tracking ID in config/_default/params.yaml:

marketing:
analytics:
plausible: 'YOUR_ID'

Google

Google Analytics

If you wish to use Google Analytics, include your associated tracking ID (e.g. G-12345) in config/_default/params.yaml:

marketing:
analytics:
google_analytics: 'YOUR_ID'

Google Tag Manager

Tag Manager gives you the ability to easily add and update your own tags for conversion tracking, site analytics, remarketing, and more.

If you wish to use Google Tag Manager, include your associated tracking ID in config/_default/params.yaml:

marketing:
analytics:
google_tag_manager: 'YOUR_ID'

Microsoft

If you wish to use Microsoft Clarity, include your associated tracking ID in config/_default/params.yaml:

marketing:
analytics:
microsoft_clarity: 'YOUR_ID'

百度统计

If you wish to use 百度统计 (Baidu Tongji), include your associated tracking ID in config/_default/params.yaml:

marketing:
analytics:
baidu_tongji: 'YOUR_ID'

Troubleshooting

The integrated analytics track users on your live production website and not your own views on your development site, if you have one.

Hugo’s default environments are development when running the hugo serve command and production when running the hugo command. You can explicitly set the environment to production with HUGO_ENV or Hugo’s --environment option.

If you deploy with Netlify, the production environment should already be setup in your netlify.toml file, but if not, check that your Netlify settings in netlify.toml match those in the latest version of the template that your site is based on.

If you choose to use Google Tag Manager, you can configure alternative analytics solutions, or even Google Analytics, in the Google Tag Manager admin panel.

We recommend testing that your analytics are working as expected. If they are not, check that your production environment is as described above and check that your site URL in your Google/Microsoft admin panel matches your site’s URL. Furthermore, Google and Microsoft provide troubleshooting guides to help with any issues.