Install guide · framework · ~3 min

Install Admaxxer on NPM Package

Install via npm for bundled frameworks.

Use the npm package when you want type safety and a single source of truth for your website ID. The package is SSR-safe: initPixel() no-ops on the server, so you can call it at module top-level without guards. identify() and track() are SSR-safe too — they buffer until the pixel loads, so you can call them anywhere. Building a SaaS with signups, free trials, and recurring revenue? See the SaaS install guide for the end-to-end funnel wiring.

Steps

  1. 1 Install the package

    Add @admaxxer/pixel to your dependencies.

    bash
    npm install @admaxxer/pixel
  2. 2 Call initPixel once at app boot

    Import and call initPixel once at app boot. It is safe to call at module top-level — the function detects SSR and no-ops server-side.

    ts
    import { initPixel } from '@admaxxer/pixel';
    
    initPixel({
      websiteId: 'YOUR_WEBSITE_ID',
    });
  3. 3 (SaaS) Identify users + track signup

    The package ships identify and track as named exports — both SSR-safe (buffered until the pixel loads). After the user signs up, call identify(user.email) (or identify(user.id, { email: user.email, plan: user.plan })) to stitch the anonymous visitor to the named account, then track('Signup', { plan, source }): import { identify, track } from '@admaxxer/pixel'; identify(user.email); track('Signup', { plan: 'pro' });. For server-side identify (e.g. when you create the account in an API route), POST to /api/identify directly. See the SaaS install guide for the end-to-end flow.

  4. 4 Verify the install

    Load any public page on your site in a fresh browser tab. Within a few seconds, the Admaxxer dashboard realtime view should show the event. If nothing lands after 2 minutes, re-check the snippet is actually in the rendered HTML <head> (View Source, not just DevTools).

Verify installation

Troubleshooting

No events are showing up. What now?
Open DevTools Console and Network. Filter for script.js and /api/event. If they are blocked:csp, your Content Security Policy is blocking admaxxer.com — see /documentation/troubleshoot/csp. Also double-check that data-website-id matches the ID shown in your dashboard.
Events show up in staging but not production.
Confirm data-domain matches the production hostname exactly (no protocol, no trailing slash). Also confirm the website's Allowed Domains list in settings includes the prod domain.
My site is a single-page app — am I missing pageviews?
Use script.hash.js if you rely on location.hash routing. Otherwise the default script.js already hooks history.pushState/replaceState and tracks SPA navigations.