Backends

Umbraco
Umbraco 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 Umbraco, with live visitors, goals and revenue attribution in one script.
Add the script
Add the site ID to your production settings
Copy the ID from Settings in the dashboard. Add it to
appsettings.Production.json, or setStickybeak__SiteIdas an environment variable on your production host:{ "Stickybeak": { "SiteId": "YOUR_SITE_ID" } }Find your master template
In the backoffice, open Settings → Templates and pick the template the others sit under (the one with
@RenderBody()in it).Add the tag
Put this before
</head>:@inject Microsoft.Extensions.Configuration.IConfiguration Configuration <script>window.stickybeak = window.stickybeak || function () { (window.stickybeak.q = window.stickybeak.q || []).push(arguments); };</script> <environment include="Production"> @if (Configuration["Stickybeak:SiteId"] is { Length: > 0 } siteId) { <script defer data-site="@siteId" data-domain="example.com" src="https://app.usestickybeak.com/_cfw/s.js" ></script> } </environment>
Check it's working
Publish first, then follow Verify your install.
Track goals
- Clicks: add
data-goalto links and buttons in your templates or partial views. - Umbraco Forms: in the form's workflow, set Submit message / Go to page to a thank-you page.
- Your own controllers: store the goal in
TempDataand render it on the next page, as in the ASP.NET Core guide.
See Custom goals.
Track purchases
Render window.stickybeak("purchase", { revenue, currency, order_id }) on the checkout confirmation page.
See Revenue.
If it isn't working
- Check
ASPNETCORE_ENVIRONMENT=Productionand the production setting. Exclude your browser when editing the live site.
See Troubleshooting.