Frameworks

Jekyll
Jekyll 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 Jekyll, with live visitors, goals and revenue attribution in one script.
Add the script
Add your site ID to _config.yml
stickybeak_site_id: "YOUR_SITE_ID"Create an include for the tag
{% if jekyll.environment == "production" and site.stickybeak_site_id %} <script defer data-site="{{ site.stickybeak_site_id }}" data-domain="example.com" src="https://app.usestickybeak.com/_cfw/s.js" ></script> {% endif %}Include it in the head
Add
{% include stickybeak.html %}inside<head>. Where depends on your theme:- Minima 3: create
_includes/custom-head.htmland put the include line in it. - Minima 2.5 and most other themes: copy the theme's
_includes/head.htmlinto your site's_includes/folder (runbundle info --path minimato find it) and add the line before</head>. - Your own layouts: add it to the layout every page uses, usually
_layouts/default.html.
- Minima 3: create
Build for production
Jekyll treats every build as development unless you say otherwise. Build with
JEKYLL_ENV=production bundle exec jekyll build. GitHub Pages sets this for you.
Check it's working
Test the deployed site, then verify your install.
Track goals
Add data-goal in layouts or HTML inside Markdown. See Custom goals.
<a href="/newsletter/" data-goal="newsletter_click">Get the newsletter</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.