Nerja Tag (website)
Tag JavaScript API
window.NerjaTracker: identify users, send custom events, set consent and clear the cart.
The tag exposes window.NerjaTracker once it has loaded. All calls are safe to make before sign-up completes — guard with if (window.NerjaTracker).
identify#
Call after your sign-up or login API succeeds. This is what turns an anonymous visitor into a contact you can email or push.
window.NerjaTracker?.identify("user_42", {
email: "sara@example.com",
first_name: "Sara",
phone: "+15550100",
});
// alias: NerjaTracker.onSignUpSuccess(userId, traits)// what
Send a stable user id (your database id or the email) plus whatever traits you have.
// why
Nerja links the earlier anonymous browsing, any app installs and the order history to this one person.
track#
window.NerjaTracker?.track("quiz_completed", { quiz: "fragrance", result: "oud" });Custom events show up in Data Brain and can be used as campaign triggers.
setConsent#
// after the visitor accepts your cookie banner
window.NerjaTracker?.setConsent("full"); // "none" | "identity" | "full"clearCart#
Call on your real order-confirmation page so a bought cart is never treated as abandoned.
window.NerjaTracker?.clearCart();Reference#
| Method | Purpose |
|---|---|
identify(userId, traits) | Link this browser to a person (alias: onSignUpSuccess) |
track(eventName, properties) | Send a custom event |
getAnonymousId() | The browser's anonymous id |
getSessionId() | The rolling session id |
flush() | Send buffered events now (debugging) |
setConsent(level) / getConsent() | Control what form data may leave the browser |
clearCart() | Clear the abandoned-cart model on a real order |
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.