Frameworks
Hexo
Hexo 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 Hexo, with live visitors, goals and revenue attribution in one script.
Add the script
Create the injector
Hexo 5+ runs files in the root
scripts/folder. Create:/* global hexo */ hexo.extend.injector.register( "head_end", `<script defer data-site="YOUR_SITE_ID" data-domain="example.com" src="https://app.usestickybeak.com/_cfw/s.js" ></script>`, );Generate and deploy
Run
hexo generateand deploy normally.
Check it's working
Test the deployed site, then verify your install.
Track goals
Add data-goal in HTML inside Markdown. See Custom goals.
<a href="/newsletter/" data-goal="newsletter_click">Get new posts by email</a>
Track purchases
Put this on the confirmation page, replacing the example values:
<script>
window.stickybeak = window.stickybeak || function () { (window.stickybeak.q = window.stickybeak.q || []).push(arguments); };
window.stickybeak("purchase", { revenue: 49, currency: "USD", order_id: "ORDER_ID" });
</script>
See Revenue.
If it isn't working
- The injector requires Hexo 5 or later.
- If you edit
layout/_partial/head.ejsinstead, theme updates may overwrite it.
See Troubleshooting for the general list.