Frameworks

Eleventy
Eleventy 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.
Add the script
Add production data
Create this global data file and set
STICKYBEAK_SITE_IDfor production builds.ELEVENTY_RUN_MODErequires Eleventy 2+.export default { siteId: process.env.STICKYBEAK_SITE_ID, enabled: process.env.ELEVENTY_RUN_MODE === "build" && Boolean(process.env.STICKYBEAK_SITE_ID), };Add it to the base layout
Put this before
</head>in_includes/base.njkor your shared layout. The same conditional works in Liquid.{% if stickybeak.enabled %} <script defer data-site="{{ stickybeak.siteId }}" data-domain="example.com" src="https://app.usestickybeak.com/_cfw/s.js" ></script> {% endif %}Build and deploy
Run your normal production build and publish its output.
Check it's working
Test the deployed site, then verify your install.
Track goals
Add data-goal in templates or HTML inside Markdown. See Custom goals.
<a href="/subscribe/" data-goal="subscribe_click">Subscribe</a>
Track purchases
On your confirmation page, send the final total and unique order ID:
<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>
Render real order values and see Revenue.
If it isn't working
- CommonJS projects need
module.exportsinstead ofexport default. - Confirm
STICKYBEAK_SITE_IDexists during the production build.
See Troubleshooting for the general list.