Backends

Grav
Grav 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 Grav, with live visitors, goals and revenue attribution in one script.
Add the script
Set the site ID for your live domain
Grav 1.7 reads extra config from
user/env/{host}/config/when the request is for that host.stickybeak: site: YOUR_SITE_IDUse the host exactly as visitors type it:
user/env/www.example.com/if you serve fromwww.Add it to your base template
In Quark (and themes based on it), that's
templates/partials/base.html.twig.<script>window.stickybeak = window.stickybeak || function () { (window.stickybeak.q = window.stickybeak.q || []).push(arguments); };</script> {% if config.site.stickybeak.site %} <script defer data-site="{{ config.site.stickybeak.site }}" data-domain="example.com" src="https://app.usestickybeak.com/_cfw/s.js" ></script> {% endif %}Clear the cache
bin/grav clearcacheOr use Clear Cache in the Admin plugin. Then open your live site and you should appear on the wall within a few seconds.
Check it's working
Publish and clear Grav’s cache.
See Verify your install.
Track goals
For clicks, add data-goal to links and buttons in your templates. See Custom goals.
For forms, have the Form plugin send people to a thank-you page:
form:
name: contact
# ...fields...
process:
- email: { ... }
- redirect: /thank-you
{% if page.header.stickybeak_goal %}
<script>window.stickybeak("{{ page.header.stickybeak_goal|e('js') }}");</script>
{% endif %}
---
title: Thanks!
stickybeak_goal: contact_form
---
Put redirect last in process, because it happens immediately.
Track purchases
Render window.stickybeak("purchase", { revenue, currency, order_id }) on the checkout confirmation page.
See Revenue.
If it isn't working
- Use the exact hostname under
user/env/and clear the cache.
See Troubleshooting.