Installation Guide · Expo (Expo Router)
How to Add Agent Analytics to Your Website
One script captures what visitors browse. That becomes memory your analytics can understand. And agents like Jack turn it into actions — recovery emails, demand segments, conversion insights.
Install on Expo (Expo Router)
Expo (Expo Router)
Use the @tradly/analytics SDK with Expo and Expo Router. It works in Expo Go and development builds — no native code, no config plugin.
Install the SDK
Add the @tradly/analytics package to your Expo project.
Works with Expo Go and development builds since there is no native module.
npm install @tradly/analyticsCreate the analytics client
Set up the client once in a shared module so every screen can use it.
This powers the same createAnalytics API used by React Native.
import { createAnalytics } from "@tradly/analytics";
export const analytics = createAnalytics({
projectKey: "your-tenant-id",
app: {
name: "My App",
version: "1.0.0",
platform: "android",
},
});Track supports all existing commerce and goal events; identify links anonymous history to a known user after login.
await analytics.track("checkout_started", { value: "249.00" });
await analytics.identify("tenant:123:user:456");Screen tracking with Expo Router
Place a ScreenTracking component once inside the root layout so every route change is tracked.
Use usePathname and call analytics.screen whenever the path changes.
import { Slot, usePathname } from "expo-router";
import { useEffect } from "react";
import { createAnalytics } from "@tradly/analytics";
const analytics = createAnalytics({ projectKey: "your-tenant-id" });
function ScreenTracking() {
const pathname = usePathname();
useEffect(() => {
if (pathname) void analytics.screen(pathname);
}, [pathname]);
return null;
}
export default function RootLayout() {
return (
<>
<ScreenTracking />
<Slot />
</>
);
}Need help? Contact support@tradly.dev or check our FAQ.
Last updated: January 2025