> AI agents: this is one page of nextanalytica's docs. The full index for agents: https://nextanalytica.app/llms.txt

# Remix cookie consent

> Wire a cookie banner in Remix to analytics: count without cookies until the answer, and pass the saved answer on every page.

Updated: 2026-12-01

In Remix, pass your banner's answer with `consent()` from `@nextanalytica/tag` when the visitor clicks, and on every app start from the answer you saved, in an effect in `app/root.tsx`. Until there's an answer, nextanalytica counts without cookies.

## How does it look?

```tsx title="app/root.tsx"
import { useEffect } from "react";
import { Links, Meta, Outlet, Scripts, ScrollRestoration } from "@remix-run/react";
import { Analytics } from "@nextanalytica/tag/react";
import { consent } from "@nextanalytica/tag";

export default function App() {
  useEffect(() => {
    const saved = localStorage.getItem("consent"); // "yes", "no" or null
    if (saved !== null) consent(saved === "yes");
  }, []);
  return (
    <html lang="en">
      <head><Meta /><Links /></head>
      <body>
        <Outlet />
        <ScrollRestoration />
        <Scripts />
        <Analytics project="na_…" />
      </body>
    </html>
  );
}
```

## What can you ask your agent?

- "How many visitors this week came before answering the banner?"

## Next steps

- [Remix analytics](/docs/platforms/remix)
- [Cookieless counting and consent](/docs/tracking/cookieless-and-consent)

Canonical address: https://nextanalytica.app/docs/platforms/remix/consent
