Stickybeak Docs Dashboard Get early access

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

  1. 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>`,
    );
  2. Generate and deploy

    Run hexo generate and 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.ejs instead, theme updates may overwrite it.

See Troubleshooting for the general list.