Frameworks
Hugo
Hugo analytics with Stickybeak starts by adding its script to your rendered pages; this guide shows you where it belongs and how to track page views, goals and purchase revenue. It is a lighter alternative to Google Analytics for Hugo, with live visitors, goals and revenue attribution in one script.
Add the script
Add the script
Add your site ID to the config
[params] stickybeakSiteId = "YOUR_SITE_ID"Add the tag to your head partial
Create a partial for it:
{{ with site.Params.stickybeakSiteId }} {{ if hugo.IsProduction }} <script defer data-site="{{ . }}" data-domain="example.com" src="https://app.usestickybeak.com/_cfw/s.js" ></script> {{ end }} {{ end }}Hugo 0.146 and later uses
layouts/_partials/. On an older Hugo release, create the file inlayouts/partials/instead.Include it in the head
Add
{{ partial "stickybeak.html" . }}inside<head>in your base template. Current Hugo useslayouts/baseof.html; releases before 0.146 usually uselayouts/_default/baseof.html.Build and deploy
hugobuilds for production by default, so the tag is included;hugo serverruns in development, so it isn't.
Using a theme
Do not edit themes/. Add {{ partial "stickybeak.html" . }} through the theme's custom-head hook, or override its head/base template under your project's layouts/.
Check it's working
Test the deployed site, then verify your install.
Track goals
Add data-goal in templates or shortcode HTML. See Custom goals.
<a href="/contact/" data-goal="contact_click" data-goal-from="footer">Get in touch</a>
Track purchases
After confirming an order in the browser, send:
window.stickybeak?.("purchase", { revenue: 49, currency: "USD", order_id: "ORDER_ID" });
Use real values; see Revenue.
If it isn't working
Check the production site ID and domain, then see Troubleshooting.