Backends

Statamic
Statamic 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 the site ID to config
Copy the ID from Settings in the dashboard and add it to your production
.envasSTICKYBEAK_SITE_ID. Then read it inconfig/services.php:'stickybeak' => [ 'site_id' => env('STICKYBEAK_SITE_ID'), ],Add it to your layout
Put this before
</head>:<script>window.stickybeak = window.stickybeak || function () { (window.stickybeak.q = window.stickybeak.q || []).push(arguments); };</script> {{ if environment == 'production' }} <script defer data-site="{{ config:services:stickybeak:site_id }}" data-domain="example.com" src="https://app.usestickybeak.com/_cfw/s.js" ></script> {{ /if }}environmentis yourAPP_ENV.
Check it's working
Deploy first. If data-site is empty, clear and rebuild Laravel’s config cache. Follow Verify your install for the full check.
Track goals
Add data-goal to links and buttons in your templates. See Custom goals.
<a href="/pricing" data-goal="view_pricing">Pricing</a>
Fire a goal when a form is submitted
After a successful submission, Statamic sends the visitor back to the form with submission_created set.
{{ form:contact }}
{{ if submission_created }}
<p>Thanks, we'll be in touch.</p>
<script>window.stickybeak("contact_form");</script>
{{ else }}
{{# your fields #}}
{{ /if }}
{{ /form:contact }}
If you use static caching, the form needs to be inside {{ nocache }} anyway (for its CSRF token), which also keeps the goal out of the cached page.
Using redirect="/thanks" on the form tag instead? Skip the code and add a goal for a page visit to /thanks under Manage goals in Stickybeak.
Track purchases
Statamic doesn't sell things by itself.
See Revenue.
If it isn't working
- Live Preview uses an iframe and is not counted. Static-cached forms must remain inside
{{ nocache }}.
See Troubleshooting.