GuidesWeb

Remix analytics with Privytics, cookieless and EU-hosted

Cookieless analytics for Remix, with event data stored in the EU.

Privytics gives your Remix app page views, custom events, funnels and user profiles without cookies. You install the @openpanel/web SDK, point it at the Privytics ingestion API, and load it from your client entry file. Client-side navigations between Remix routes are picked up automatically, so the whole setup is one module and one import.

Why Remix teams use Privytics

Remix route changes are tracked without router wiring

With trackScreenViews enabled the SDK wraps history.pushState and history.replaceState and listens for popstate. Every navigation through a Remix <Link>, a form redirect or the back button fires a screen view, so you do not need to subscribe to useLocation or add an effect in root.tsx.

Safe to import in an SSR app

Remix renders on the server first. The SDK checks for a server environment and skips all browser-only work, so the module does not blow up during SSR. Importing it from app/entry.client.tsx keeps tracking strictly in the browser, which is the behaviour you want anyway.

No consent banner to bolt onto your root layout

Privytics is cookieless by default. Nothing is written to the device, and the anonymous visitor id is computed server side and resets every day. That removes the usual banner work in root.tsx. You remain the data controller and should still confirm your own obligations.

Progressive enhancement friendly event tracking

Remix leans on real links and real forms. trackOutgoingLinks records clicks to external domains on its own, and trackAttributes lets you tag any element with data-track="your_event" instead of attaching an onClick handler, so events still fire on markup that works before hydration.

Set it up

About five minutes, on the free plan, without a credit card.

  1. Install the SDK

    There is no dedicated Remix package. The OpenPanel web SDK is the supported path for Remix and is published on npm as @openpanel/web.

    npm install @openpanel/web
  2. Create the client

    apiUrl is required. Without it the SDK falls back to its built-in default of https://api.openpanel.dev and your events go to OpenPanel's own host rather than Privytics.

    // app/op.ts
    import { OpenPanel } from '@openpanel/web';
    
    export const op = new OpenPanel({
      clientId: 'YOUR_CLIENT_ID',
      apiUrl: 'https://api.privytics.com',
      trackScreenViews: true,
      trackOutgoingLinks: true,
      trackAttributes: true,
    });
  3. Load it from your client entry

    Importing the module in entry.client.tsx runs the constructor once, in the browser only, before hydration.

    // app/entry.client.tsx
    import { RemixBrowser } from '@remix-run/react';
    import { StrictMode, startTransition } from 'react';
    import { hydrateRoot } from 'react-dom/client';
    
    import './op';
    
    startTransition(() => {
      hydrateRoot(
        document,
        <StrictMode>
          <RemixBrowser />
        </StrictMode>
      );
    });
  4. Track a custom event

    Screen views are automatic. Call op.track for anything else. With trackAttributes enabled you can also write <button type="button" data-track="signup_clicked" /> and skip the handler.

    // app/routes/pricing.tsx
    import { op } from '~/op';
    
    export default function Pricing() {
      return (
        <button
          type="button"
          onClick={() => op.track('signup_clicked', { plan: 'pro' })}
        >
          Start free
        </button>
      );
    }
  5. Identify signed-in users

    Optional. Pass your own user id to link sessions into a single profile. This is opt-in and needs your own lawful basis.

    import { op } from '~/op';
    
    op.identify({
      profileId: '123', // Required
      firstName: 'Joe',
      lastName: 'Doe',
      email: 'joe@doe.com',
      properties: {
        tier: 'premium',
      },
    });
  6. Alternative: plain script tag

    If you cannot or would rather not add a client module, put this in the <head> of app/root.tsx instead of installing the SDK. The first block queues calls until the tracker loads, the second loads it. apiUrl still has to point at Privytics.

    <script>
      window.op = window.op || function (...args) { (window.op.q = window.op.q || []).push(args); };
      window.op('init', {
        apiUrl: 'https://api.privytics.com',
        clientId: 'YOUR_CLIENT_ID',
        trackScreenViews: true,
        trackOutgoingLinks: true,
      });
    </script>
    <script src="https://privytics.com/op1.js" defer></script>

Privytics runs the open-source OpenPanel engine, so the upstream Remix SDK reference applies here too. Point apiUrl at Privytics and the data lands in your Privytics project.

Questions

Is there a dedicated Remix SDK?

No. The upstream Remix doc page is a stub that tells Remix users to use the web SDK or a script tag for now. Install @openpanel/web and load it from app/entry.client.tsx.

Does it track Remix client-side route changes?

Yes, when trackScreenViews is true. The SDK patches history.pushState and history.replaceState and listens for popstate, so navigations through <Link>, form redirects and the browser back button all record a screen view.

Do I need a cookie banner for Remix analytics?

Privytics sets no cookies and writes nothing to the device, so the usual analytics banner is not triggered by our tracking. You are still the data controller, so check your own obligations and anything else running on the page.

Will it break server-side rendering?

No. The SDK detects a server environment and skips browser-only work, so it is safe to import. Loading it from entry.client.tsx keeps all tracking in the browser.

Where is the event data stored?

Event data is stored in EU data centres in Germany. Privytics is built on the open-source OpenPanel engine and is not affiliated with OpenPanel.