2016-02-06 10:09:47 -05:00
|
|
|
---
|
|
|
|
date: 2016-02-06
|
|
|
|
linktitle: Analytics
|
|
|
|
menu:
|
|
|
|
main:
|
|
|
|
parent: extras
|
2016-09-18 13:10:11 -04:00
|
|
|
next: /extras/builders
|
2016-02-06 10:09:47 -05:00
|
|
|
prev: /extras/aliases
|
|
|
|
title: Analytics in Hugo
|
|
|
|
weight: 15
|
|
|
|
---
|
|
|
|
|
|
|
|
Hugo ships with prebuilt internal templates for Google Analytics tracking, including both synchronous and asynchronous tracking codes.
|
|
|
|
|
|
|
|
## Configuring Google Analytics
|
|
|
|
|
|
|
|
Provide your tracking id in your configuration file, e.g. config.yaml.
|
|
|
|
|
|
|
|
googleAnalytics = "UA-123-45"
|
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
Include the internal template in your templates like so:
|
|
|
|
|
|
|
|
{{ template "_internal/google_analytics.html" . }}
|
|
|
|
|
|
|
|
For async include the async template:
|
|
|
|
|
|
|
|
{{ template "_internal/google_analytics_async.html" . }}
|