How To Include Google Analytics As Hugo Theme

Google Analytics has long became the No.1 tool for web traffic analysis. Starting from version v1.12.0, depending on output format, Bissetii supports Google Analytics as per its specifications.

Based on the specification, Bissetii complies to its requirements by including its Javascript in the <head> section.

Adding Google Analytics ID

To enable Google Analytics, simply add your Google Analytics ID into docs/.data/bissetii/vendors/Google.toml data file inside your data/ directory.

The field you’re looking for is called [Analytics].ID. Here is an example:

1
2
3
4
# All Google Related Configurations

[Analytics]
ID = "UA-1234565789"  # GA-ID

Setting this field as blank results with not including Google Analytics into your website.

Google Analytics for AMP

At this point of time, Google Analytics for AMP is overly customized for Bissetii. We have yet to support this feature for Hugo.

Epilogue

That’s all for including Google Analytics into the page. If you have any query, please feel free to reach us at our Issues Section.