Nerja Tag (website)
Install the Nerja Tag
Why the Nerja Tag exists, the one-line install, every option, and how to verify it.
Why you need it#
The Nerja Tag is a small script that runs in your visitors' browsers. Without it Nerja only knows about orders that already happened; with it Nerja sees the browsing, carts and checkouts that did not convert — which is exactly what recovery campaigns are made from.
// what
One script tag in your site's <head>. No code in your app, no per-event wiring.
// why
Cart, checkout and browse abandonment, intent scores and lead capture all depend on seeing behaviour as it happens.
Install#
- 1
Get your public key
In Agent Settings → API keys create (or reuse) a key of type
PUBLIC_TAG. It is safe to put in a web page — it can only write events, and only from your allowed website. - 2
Paste the script
Inside <head> on every page<script async src="https://t.nerja.ai/t.js?key=nak_pk_live_YOUR_KEY&api=https://api.nerja.ai" ></script>The exact line, with your real key and addresses, is on Data Brain → Client-side setup. Copy it from there.
- 3
Publish and visit your site
Open any page. Events appear in Data Brain within a few seconds.
Options#
Options go in the script's query string, or in window.NERJA_CONFIG defined before the script.
| Option | Default | What it does |
|---|---|---|
key | required | Your PUBLIC_TAG key. (tagId is accepted as an alias.) |
api | — | The Nerja API address events are sent to. |
debug | 0 | Set to 1 to log what the tag is doing to the browser console. |
consent | identity | none · identity · full — see Privacy & consent. |
cartHours | 3 | Hours a cart item can sit before an abandoned_cart event is emitted. |
cartCheckMin | — | How often (minutes) the tag re-checks carts for abandonment. |
<script>
window.NERJA_CONFIG = { key: "nak_pk_live_YOUR_KEY", api: "https://api.nerja.ai", consent: "identity" };
</script>
<script async src="https://t.nerja.ai/t.js"></script>Platform notes#
- Shopify — installing the Nerja app adds tracking for you (via a web pixel); no theme edit needed.
- WooCommerce — add the script through your theme header or a header-scripts plugin. Headless storefronts: put it on the storefront, not the admin.
- Single-page apps / headless — add the script once in the root HTML; route changes are picked up as page views.
- Google Tag Manager — a Custom HTML tag with the script, firing on All Pages.
- Content-Security-Policy — allow the tag host in
script-srcand the API host inconnect-src.
Verify#
- Open your site and add
&debug=1to the script URL temporarily — the console prints[Nerja]lines. - In the browser's Network tab, look for
POST /v1/events/batchreturning202. - In Nerja, Data Brain should list the page view.
Nothing arrives?
PUBLIC_TAG key is only accepted from your own site. See Troubleshooting.How it sends data#
- A first-party cookie (
_cid) plus a local-storage anonymous id identify the browser; sessions roll over after 30 minutes. - Events are batched and sent about every second, or every 15 events, to
/v1/events/batch; they are flushed when the tab closes. - If the network fails, events wait in a local outbox and are replayed on the next page view.
Prefer to talk it through? Book a 30-minute call with the Nerja team.
Something unclear or missing? Email support@nerja.ai and we will improve this page.