Install Tracking. Connect Confirmed Outcomes.
Start with the cookieless browser SDK. Follow the integration steps for your framework - static HTML, React, Next.js, Vue, or anything in between.
Quick Start
Three steps to go from zero to live analytics.
Create a website in your dashboard
Sign in, navigate to Websites, and add your domain. NeuTarget generates a unique Website ID and an API Secret for server-side revenue calls.
Your Website ID
e.g. a1b2c3d4-e5f6-7890-abcd-ef1234567890
Paste the tracking snippet
Add this single script tag before the closing </head> of your website. Replace YOUR_WEBSITE_ID with the ID from Step 1.
<!-- NeuTarget Analytics · Deferred SDK · Cookie-free -->
<script
defer
data-website-id="YOUR_WEBSITE_ID"
src="https://cdn.neutarget.com/script/v1/nt.min.js"
></script>Deploy & verify
Push your changes live. The tracker automatically fires a pageview event on load.
Open your site in a browser and visit any page.
Return to your NeuTarget dashboard - the Overview page will show the visit within seconds.
Done. No configuration files, no build plugins, no ENV vars.
Framework & Platform Guides
The tracker script works universally, but here's where to place it in popular frameworks.
export default function RootLayout({ children }) {
return (
<html lang="en">
<head>
<script
defer
data-website-id="YOUR_WEBSITE_ID"
src="https://cdn.neutarget.com/script/v1/nt.min.js"
/>
</head>
<body>{children}</body>
</html>
);
}SPA navigations are tracked automatically via MutationObserver + popstate. No router.events hookup required.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<script
defer
data-website-id="YOUR_WEBSITE_ID"
src="https://cdn.neutarget.com/script/v1/nt.min.js"
></script>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>export default defineNuxtConfig({
app: {
head: {
script: [
{
defer: true,
src: "https://cdn.neutarget.com/script/v1/nt.min.js",
"data-website-id": "YOUR_WEBSITE_ID",
},
],
},
},
});<head><script
defer
data-website-id="YOUR_WEBSITE_ID"
src="https://cdn.neutarget.com/script/v1/nt.min.js"
></script>For WordPress, paste this in Appearance → Theme Editor → header.php or use a “Insert Headers & Footers” plugin.
Full WordPress integration guide<!-- Paste inside <head>, before {{ content_for_header }} -->
<script
defer
data-website-id="YOUR_WEBSITE_ID"
src="https://cdn.neutarget.com/script/v1/nt.min.js"
></script>Financial reporting uses a store signing key and three Shopify webhooks. Optional cart metadata can associate a standard theme checkout with a browser session. Test the flow on your actual storefront before relying on attribution.
Full Shopify integration guide// Add to your theme's functions.php or a custom plugin
add_action('wp_head', function () {
echo '<script defer data-website-id="YOUR_WEBSITE_ID"
src="https://cdn.neutarget.com/script/v1/nt.min.js"></script>';
});Use the reviewed WooCommerce adapter for server reported captures and refunds. Validate your payment gateway, checkout type, consent handoff, and retry queue before relying on revenue reports. A checkout status alone does not prove payment.
Full WooCommerce integration guideLooking for step-by-step commerce integration guides?
Validate Your Integration
Confirm the tracker is installed correctly and data is flowing.
Method 1 - NeuTarget DashboardRecommended
Visit your site in a browser, then check the Overview page in your NeuTarget dashboard. Within seconds you should see:
- Unique Visitors count increment
- Total Pageviews count increment
- Avg Load Time populated with a value
If these numbers appear, you're done. Everything is working.
Method 2 - Browser DevTools
- 1Open your website and press F12 to open DevTools.
- 2Go to the Network tab and filter by
track. - 3Reload the page. You should see a POST request to
/api/v1/trackwith a 200 or 204 status. - 4Click the request and inspect the Payload tab - you'll see
websiteId,eventType: "pageview",pathname, etc.
{
"websiteId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"eventType": "pageview",
"pathname": "/",
"referrer": "",
"deviceType": "DESKTOP",
"loadTimeMs": 342,
"utmSource": "google",
"utmMedium": "cpc",
"utmCampaign": "spring-sale"
}Method 3 - Manual cURL test
Send a test event directly from your terminal to confirm the backend is reachable:
curl -X POST https://www.neutarget.com/api/v1/track \
-H "Content-Type: application/json" \
-d '{
"websiteId": "YOUR_WEBSITE_ID",
"eventType": "pageview",
"pathname": "/test",
"referrer": "",
"deviceType": "DESKTOP",
"loadTimeMs": 200
}'A 200 response with { "sh": "a1b2c3..." } confirms NeuTarget is receiving your events. The sh field is a 64-character session hash - store it for revenue attribution.
What Gets Tracked
When collection is allowed by the website policy and consent settings, the browser tag captures these events. Custom interactions require calls from your application code.
Sent on page loads and detected pathname changes. Includes page, referrer, device and campaign context; load timing is included when available.
Fired when a visitor clicks a link to Razorpay, PhonePe, Stripe, Instamojo, or a upi: URI. Measures payment intent; this event does not confirm a payment. HTTP(S) destinations are reduced to their origin and path.
Sent when a visitor clicks a standard link to Google Play Store or Apple App Store. Measures an outbound tap, not a verified install or in-app activity.
Sent for uncaught JavaScript errors and unhandled promise rejections when diagnostics are allowed. Capped at 5 per tracker initialization; these are debugging signals.
Track any interaction - CTA clicks, form submissions, video plays, add-to-cart. Call window.__nt.track() from your code.
How It Works
Privacy by architecture, not by policy. Here's what happens under the hood when a visitor loads your page.
Sessions use a random per-tab nonce with a 30-minute inactivity window, backed by sessionStorage. Approximate weekly network/browser groups are separate from sessions and declared customer IDs; none is proof of an individual person.
Browser delivery is best effort and can be interrupted by navigation, blockers or network failure. Critical payment confirmation belongs on a verified server path with durable receipts and stable retry identifiers.
A MutationObserver watches for DOM changes, combined with a popstate listener. When the URL path changes, a new pageview is fired - no router integration needed.
A single global click event listener uses element.closest("a") to detect payment & app-store outbound links, no matter how deeply nested the click target is.
Custom Events
Track any interaction beyond pageviews - CTA clicks, form submissions, video plays, add-to-cart actions, and more. One function call from your frontend code.
API
window.__nt.track(eventType: string, data?: object)| Parameter | Type | Description |
|---|---|---|
eventType | string | A descriptive action name, e.g. "hero_signup_clicked". Use snake_case and follow the naming limits below. |
data | object (optional) | Supported event fields, such as optional integer eventValue or HTTP(S) targetUrl. Arbitrary properties are not a supported metadata store. |
The SDK uses the same fetch pipeline and collection controls as automatic events, supplying the current page, client session, campaign and device context. Calls made before the SDK is available or while collection is disallowed are not queued.
Event names must be 1 to 80 characters, start with an ASCII letter and contain only letters, digits, underscores, periods, colons or hyphens. Names beginning with revenue, refund, chargeback, billing, financial, system. or nt. are reserved, as are payment_confirmed, purchase_confirmed and backend_verified, regardless of case. Browser observations do not verify payments; use the backend financial-event integration for verified payment and refund receipts.
Examples
// Register after the page element and browser tag are available.
document.querySelector("#signup-btn")?.addEventListener("click", () => {
window.__nt?.track("hero_signup_clicked");
});document.querySelector("#lead-form")?.addEventListener("submit", () => {
// This observes submission, not backend acceptance or a qualified lead.
window.__nt?.track("lead_form_submit_attempt");
});// Call after your application confirms the cart update succeeded.
function trackCartAddition(quantity) {
if (Number.isSafeInteger(quantity) && quantity > 0) {
window.__nt?.track("add_to_cart", { eventValue: quantity });
}
}// checkoutOptions is your existing config, including its verification handler.
// Keep signature/provider verification and financial reporting on your server.
const existingHandler = checkoutOptions.handler;
const rzp = new Razorpay({
...checkoutOptions,
handler: function (response) {
window.__nt?.track("razorpay_callback_received");
return existingHandler.call(this, response);
},
});
// Measures a request to open checkout, not an opened modal or paid order.
window.__nt?.track("razorpay_checkout_requested");
rzp.open();More ideas: video progress, scroll milestones, download-link clicks, search submissions, tab switches, coupon use and wishlist changes. Add explicit handlers for each action and exclude raw search queries, form contents and personal information from event names and fields.
Tips
- Use descriptive, snake_case event names - e.g.
cta_click,form_submit,add_to_cart. - The
dataobject is optional. If you just need to count an event, callwindow.__nt.track("cta_click")without a second argument. - Load the browser tag before sending events. Optional chaining or
if (window.__nt)avoids an error if it is absent, but does not queue an event for later. - The SDK supplies client session, UTM, pathname and device context. Use a JavaScript safe integer for
eventValue, such as seconds watched or item quantity; a value does not create a financial receipt.
Collection, storage and identity
The analytics server processes IP addresses and User-Agent information for request handling, geographic enrichment, and approximate weekly network/browser groups. Raw IP is not a field in the analytics event table, but operational access and security logs may retain it. These network groups are not verified people.
The current browser SDK first requests the site collection and privacy policy. If consent is required, it waits for the customer’s consent flow to grant collection; denying or withdrawing consent clears its session context and stops further tracking writes. Once collection is allowed, it uses a random per-tab session nonce, with a 30-minute inactivity window, and sessionStorage for session and campaign context. Storage restrictions or older tags can reduce continuity. Optional site-scoped customer digests can link declared customer activity across sessions; a 64-character hash is pseudonymous data and can remain personal data.
New websites default to minimal mode, which drops optional declared customer and advertising identifiers, diagnostic error details and precise city/region. Existing websites retain a labelled legacy mode until an admin reviews it; identified mode requires an explicit processing-instructions acknowledgement. Server controls strip URL queries/fragments, reduce referrers to origins, bound text and redact common sensitive patterns, but cannot detect every form of personal information. Paths, UTM values, referrers, click destinations, custom-event fields and error text can still contain customer information if your application puts it there. Keep names, emails, payment credentials, account tokens and sensitive information out of those fields. Hashing identifiers does not remove the need to control collection and access.
Customers choose the purposes, data fields, lawful basis and visitor notices for their deployment. Where consent is required, control loading of the analytics script and enabled integrations through your consent flow. Using no analytics cookies does not by itself establish an exemption for browser storage, identifiers or subsequent personal-data processing.
Applicable requirements depend on the audience, jurisdiction and configuration. The European Commission explains personal and pseudonymised data, and Your Europe describes online privacy and cookie requirements. India’s 2025 DPDP Rules notification provides phased commencement; publication does not mean every provision took effect at once. This product does not assign a lawful basis or certify a customer’s compliance.
Install the public tag only under the collection conditions chosen for your website. Do not put an API secret, raw email address, access token, payment credential or sensitive account information into tag attributes or event fields. Optional declared identity should use a site-scoped server-generated digest from an internal customer ID.
Financial receipts and attribution
Take the setup to your developer
Installation pack 1.0.3Two PDF guides, website and server examples, platform installation files, and a verification checklist. Follow one platform path, then connect the features your team needs.
Replace the website ID placeholders. Get private credentials from protected website settings. Feature access follows your workspace plan and role. ZIP checksum
Record payment evidence; keep attribution optional
Use the same financial-event contract for commerce orders, SaaS invoices, bookings, or other paid services. Verify the provider signature and authoritative amount on your server before reporting. A missing session records an unattributed payment; it must not discard the payment or block checkout.
1. Optional browser handoff
// Run when your checkout starts, after installing the public tracking script.
// SDK readiness is bounded; analytics must never prevent checkout.
const context = await (
window.neutarget?.whenReady?.({ timeoutMs: 2000 }) ?? Promise.resolve(null)
).catch(() => null);
const sessionHash = context?.ready ? context.sessionHash : null;
const privacy = window.neutarget?.getPrivacyState?.();
const consentStatus = context?.ready && privacy?.ready ? privacy.consent : null;
await fetch("/api/create-order", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ items: cart.items, sessionHash, consentStatus })
});
// Your server validates items/prices and persists nullable attribution context.
// Validate consent against your own consent flow before later reporting it.
// It must not trust a browser amount, currency, or payment-success claim.2. Backend receipt after provider verification
// Node.js 20+ backend only. Download client.mjs and currency-exponents.json below.
import { reportFinancialEvent } from "./client.mjs";
// Read these values from your VERIFIED provider event and stored order.
// Never pass a raw browser request directly into this helper.
const receipt = await reportFinancialEvent({
idempotencyKey: "capture:provider-payment-123", // same key on every retry
orderId: "order-123", // stable across captures/refunds
kind: "capture", // capture | refund | chargeback
amountMinor: "12345", // exact positive decimal string
currency: "USD", // USD 123.45; JPY 12345; KWD 12.345
occurredAt: "2026-01-01T12:00:00Z", // provider event time
sessionHash: storedOrder.sessionHash ?? null,
consentStatus: storedOrder.consentStatus ?? null,
customerStatus: "unknown" // do not infer new from a checkout click
}, {
websiteId: process.env.NEUTARGET_WEBSITE_ID,
apiSecret: process.env.NEUTARGET_API_SECRET
});
// 200 recorded/duplicate acknowledges a durable receipt, not final report delivery.
// Persist your job until acknowledgement; retry failures with the SAME key.
// Refunds use kind: "refund" and a stable refund ID as the idempotency key.The client posts to /api/v1/financial-events with the backend-only X-Api-Secret. Currency is explicit and minor units use its ISO exponent. Keep capture, refund, and chargeback IDs stable and distinct; do not generate a new key for each retry.
Source examples and supported checkout scope
- Node.js receipt client and explicit currency scales: use from a verified server handler and durable retry queue.
- Shopify storefront handoff: standard theme/cart checkout. Accelerated checkout or Shop Pay may omit metadata; native signed financial webhooks still record the payment as unattributed.
- WooCommerce plugin ZIP: the reviewed direct installer includes classic and Checkout Blocks handoff, Action Scheduler receipt delivery, and a bounded repair scan. Read its setup and live validation guide.
- Source examples, API contract, tests and migration notes. The older standalone WooCommerce source example covers classic checkout only; the plugin ZIP above is the current store integration.
Evidence and privacy boundaries
Requests authenticated with your website secret are labelled server_reported; that alone does not prove provider verification. Provider-verified counts require a supported signed provider integration. Reports separate gross captures, refunds, chargebacks, net, source coverage, and currencies. Missing historical currency remains unknown; no exchange rate is inferred.
Do not send names, email addresses, phone numbers, raw payment payloads, or private API secrets from a browser. Customer IDs are optional site-scoped digests; a digest remains pseudonymous data. Configure consent and lawful collection for your audience and integrations rather than assuming cookieless tracking removes those obligations.
Migration: browser revenue() returns backend_confirmation_required and sends no payment. Keep secrets in backend environment variables, rotate previously exposed credentials, and migrate your server to this receipt API. Legacy server /revenue remains compatible, but missing currency cannot establish a known financial total.
Website: YOUR_WEBSITE_ID. Developer integration guide.
Ad spend: explicit currency and exact amounts
Manage spend from the authenticated workspace dashboard. Creating or importing spend requires an admin/editor session and website membership; a website tracking secret does not grant this workspace API access.
curl -X POST https://api.neutarget.com/api/v1/spend -H "Content-Type: application/json" -H "Authorization: Bearer $NEUTARGET_WORKSPACE_ACCESS_TOKEN" -d '{"websiteId":"YOUR_WEBSITE_ID","spendDate":"2026-01-01","channel":"google","utmSource":"google","utmMedium":"cpc","utmCampaign":"example","amountPaise":"12345","currency":"USD"}'The legacy field name amountPaise means exact integer minor units in the explicit currency: USD 123.45, JPY 12345, or KWD 12.345. Do not multiply every currency by 100 or derive currency from locale.
date,channel,utm_source,utm_medium,utm_campaign,amount_paise,currency,notes
2026-01-01,google,google,cpc,example,12345,USD,USD 123.45
2026-01-01,google,google,cpc,example-jp,12345,JPY,JPY 12345
2026-01-01,google,google,cpc,example-kw,12345,KWD,KWD 12.345CSV imports retain missing currency as unknown; this cannot establish a known ROAS currency. Review imports before submitting and avoid duplicate uploads. The dashboard shows currency groups separately and reports unknown coverage explicitly.
Payload Reference
Common browser-event payload fields are listed below. Optional fields depend on the event type, available browser context and the website privacy and consent settings.
| Field | Type | Description |
|---|---|---|
websiteId | string (UUID) | Your website's unique identifier from the dashboard |
eventType | string | "pageview" | "payment_click" | "appstore_tap" | "js_error" | your custom type |
pathname | string | Current URL path, e.g. /pricing |
referrer | string | Referring HTTP(S) origin; path, query and fragment are removed |
deviceType | string | "MOBILE" | "TABLET" | "DESKTOP" |
loadTimeMs | number | null | Page load time in ms (pageview events only, first load) |
targetUrl | string | Optional HTTP(S) destination origin and path; queries, fragments and non-HTTP(S) targets are removed |
eventValue | integer | undefined | Optional numeric measurement, such as item quantity or seconds; use a JavaScript safe integer, not a text label or payment claim |
clientSessionId | string | null | SDK-managed 32-character lowercase hexadecimal per-tab session nonce when available |
consentStatus | string | SDK-managed granted, pending or denied state; calls still depend on website collection and consent settings |
utmSource | string | undefined | UTM source param, captured from the landing page URL and persisted for the session |
utmMedium | string | undefined | UTM medium param, captured from the landing page URL and persisted for the session |
utmCampaign | string | undefined | UTM campaign param, captured from the landing page URL and persisted for the session |
errorDetails | string (JSON) | Diagnostic error info such as message, source, line and column; collected only when diagnostics are allowed and subject to sanitization |
Troubleshooting
Common issues and their fixes.
I don't see any Network requests to /api/v1/track
Confirm the <script> tag is inside <head>, has the "defer" attribute, and the data-website-id is set. Also check that the src URL is correct and the script loads (200 status in the Network tab).
I see a CORS error in the console
If you've set up a custom tracking domain, replace the script src with your domain URL. Otherwise, use the default https://cdn.neutarget.com/script/v1/nt.min.js - it works out of the box.
SPA route changes aren't being tracked
The MutationObserver requires document.body to exist when the script runs. Make sure the script tag is deferred (not async) and placed in <head>. If using a framework with aggressive tree-shaking, confirm nt.min.js is not being removed.
Payment / App Store clicks aren't showing up
The tracker looks for <a> tags with href containing razorpay.com, phonepe.com, instamojo.com, upi:, play.google.com, or apps.apple.com. Ensure your links use standard <a> elements (not JavaScript onclick handlers without an href).
Load time shows as null
loadTimeMs is only captured on the initial full-page load (not SPA navigations). It uses the Performance API - if the page hasn't fully loaded when the event fires (e.g. very fast prerender), it may be null.
Ready to integrate?
Create a free account, add your domain, and paste the snippet. You'll see a browser visit after the tag loads. Commerce revenue setup and verification are separate.
