Include Google Analytics into Hugo
Bissetii recognizes metric capturing is one of the important component for the web development and therefore facilitated a seamless way to include Google Analytics. This page guides you on how to do it with Hugo.
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:
|
|
Setting this field as blank results with not including Google Analytics into your website.
Google Analytics for AMP
Due to the fact that Javascript is not available in AMP pages and only certain AMP Javscript module is allowed, you need to add the triggers manually. Only you know where to add the trigger.
There is no easy way to do that except using the renderHTML shortcodes in each Markdown page. Bissetii recommends adding it in front of the page title. Here is an example:
|
|
Wrapping Up
That is all for including Google Analytics with Bissetii into Hugo. If you have any question to ask us directly, please feel free to raise it at our GitLab Issues Section. We will be happy to assist you.