ActionLab Analytics for Remix
Add privacy-first, AI-powered analytics to your Remix site in under 60 seconds. No cookies, no consent banners, no complex setup.
Setup at a Glance
Add ActionLab to Remix in 4 simple steps. Copy one script tag, paste it into your project, and start collecting privacy-friendly analytics immediately.
About Remix
Remix is a full-stack React framework that emphasizes web standards, progressive enhancement, and efficient data loading through nested routes and loaders. Built on web fundamentals like HTTP and HTML forms, Remix produces fast, resilient applications that work even before JavaScript loads. ActionLab integrates cleanly in the root layout, tracking both server-rendered page loads and client-side navigations without any Remix-specific packages or configuration.
Why Add Analytics to Remix
Remix developers value web standards and progressive enhancement, and ActionLab integration follows these principles. The script tag is standard HTML that works regardless of JavaScript availability. Client-side navigation tracking uses the standard History API rather than framework-specific hooks. No npm packages are added to your dependency tree, and no build configuration is modified. This standards-based approach means ActionLab integration is resilient to Remix version changes and works identically across all Remix deployment targets.
Installation Code
// app/root.tsx
export default function App() {
return (
<html>
<head><Meta /><Links /></head>
<body>
<Outlet />
<script
src="https://cdn.actionlabanalytics.com/actionlab.js"
data-site="YOUR_SITE_ID"
defer
/>
<Scripts />
</body>
</html>
);
}Step-by-Step Setup
- 1
Open your app/root.tsx file, which serves as the root layout for your entire Remix application.
- 2
Add the ActionLab script tag inside the <body> element, positioned before the Remix <Scripts /> component.
- 3
Replace YOUR_SITE_ID with your actual site ID from the ActionLab dashboard.
- 4
Remix client-side navigation (using Link and fetcher) is tracked automatically via History API detection.
Why Use ActionLab with Remix
- Works naturally with Remix nested routes — each route transition is tracked as a pageview.
- Automatic client-side navigation tracking for Remix Link navigation and programmatic routing.
- No Remix-specific npm packages needed — the script tag in root.tsx is the entire integration.
- Works with both Vite-based Remix and the classic Remix compiler, and with all deployment targets.
Frequently Asked Questions
Does ActionLab work with Remix loaders?
ActionLab runs on the client side and tracks page visits and navigation. It operates independently of Remix loaders and actions, which run on the server. There are no conflicts between ActionLab tracking and your data loading or mutation logic. Loader responses, action redirects, and error boundaries all work identically with ActionLab installed.
Does ActionLab track Remix nested route transitions?
Yes. When Remix navigates between nested routes (updating child routes while keeping parent routes mounted), ActionLab detects the URL change via the History API and records it as a pageview. This means you get accurate page-level analytics for Remix nested routing architecture without any special configuration.
Can I use environment variables for the site ID in Remix?
Yes. In Remix, pass the site ID through a root loader that reads from process.env, then use it in your root component. This allows different site IDs for development, staging, and production environments while keeping the secret out of client-side code by handling it server-side in the loader.
Does ActionLab work with Remix SPA mode?
Yes. Remix SPA mode (introduced in Remix v2.5) renders everything client-side without server-side rendering. ActionLab works identically in SPA mode and traditional SSR mode because the tracking script runs in the browser regardless of rendering approach. Client-side navigation tracking is automatic in both modes.
Does ActionLab work with React Router v7 (Remix successor)?
Yes. React Router v7, which absorbs Remix functionality, uses the same History API for navigation that ActionLab monitors. The tracking script detects route changes automatically regardless of whether you are using Remix v2 or React Router v7.