In the browser
The script exposes the function named in Settings › Tracking › Function name for custom calls (nq by default). Calls made before the script has loaded are queued. The WordPress connector plugin also installs window.NahnuAnalytics, so plugins need not know the name.
// A custom event, with properties and revenue
nq('Signup', { p: { plan: 'pro' }, m: { a: 9.9, c: 'USD' } });
window.NahnuAnalytics.track('Signup', { props: { plan: 'pro' }, revenue: { amount: 9.9, currency: 'USD' } });
// A virtual page view (single-page apps, wizards)
nq('view', { u: 'https://example.com/wizard/step-2' });
window.NahnuAnalytics.view('https://example.com/wizard/step-2');
// From code that cannot reach window (an iframe bridge, a sandboxed widget)
document.dispatchEvent(new CustomEvent('nahnu:track', { detail: { name: 'Signup', props: { plan: 'pro' } } }));
// Name the person behind the visit when they sign in
nq('identify', { p: { id: '42', name: 'Jane Doe' } });
// Feature flags, once they are in
nq.ready(function () {
if (nq.flag('new-checkout') === 'b') showNewCheckout();
}); Without code#
data-k-event="Download brochure"on a link or button, with properties asdata-k-p-<name>="value".- Or the classes
k-event-name=Signupplusk-event-<prop>=value. <div data-k-flag="new-checkout" data-k-variant="b" hidden>…</div>shows only to visitors in variant b.
Script tag options#
| Attribute | What it does |
|---|---|
data-h="1" | Counts #hash routes as pages |
data-m="1" | Sends page views only when you call view |
data-x="/admin*,/draft/*" | Never counts those pages |
data-p-<name>="value" | Adds a property to every page view |
Was this helpful?
Thanks for your feedback!
✓ Feedback received. Thank you!



