Skip to content
IForevents Docs
IForevents Docs
InicioPanelGitHubPrivacidadTérminosSeguridadIntroducción
TrackingIdentify usersTrack events
Web (JavaScript)Flutter SDKJavaScript SDK (browser and Node.js)React, Next.js and React NativePython SDKGo SDKJava and Android SDKsSwift SDK (iOS, macOS)Ruby SDKPHP SDK.NET and Unity SDKsClient libraries (JavaScript, Python, Go)HTTP Ingest (Server-Side)
Soporte y SLA
TrackingSDKs

React, Next.js and React Native

Provider, hooks and route-aware page views on top of the JavaScript SDK

All three packages build on @iforevents/browser and accept the same options and adapters.

React

npm install @iforevents/react
import { IforeventsProvider, useTrack, usePageView } from "@iforevents/react";
import { useLocation } from "react-router-dom";

function PageViews() {
  usePageView(useLocation().pathname); // one page view per route change
  return null;
}

export function App() {
  return (
    <IforeventsProvider projectKey="pk_...">
      <PageViews />
      <Checkout />
    </IforeventsProvider>
  );
}

function Checkout() {
  const track = useTrack();
  return <button onClick={() => track("checkout_started", { items: 3 })}>Buy</button>;
}

Hooks: useIforevents(), useTrack(), useIdentify(), usePageView(path?, props?).

Next.js (App Router)

npm install @iforevents/next
// app/layout.tsx
import { IforeventsProvider } from "@iforevents/next";

export default function RootLayout({ children }) {
  return (
    <html><body>
      <IforeventsProvider projectKey={process.env.NEXT_PUBLIC_IFOREVENTS_PROJECT_KEY!}>{children}</IforeventsProvider>
    </body></html>
  );
}

Page views are sent on every navigation. Route handlers and server actions use the server entry:

import { getServerIforevents } from "@iforevents/next/server";
const { iforevents } = await getServerIforevents({ projectKey: process.env.IFOREVENTS_PROJECT_KEY! });
await iforevents.track("order_created", { total: 42 });

The project key is public, so exposing it through NEXT_PUBLIC_ is intended.

React Native and Expo

npm install @iforevents/react-native @react-native-async-storage/async-storage
npm install react-native-device-info   # optional, richer device context
import { NavigationContainer, createNavigationContainerRef } from "@react-navigation/native";
import { createReactNativeIforevents, trackNavigation } from "@iforevents/react-native";

export const analytics = createReactNativeIforevents("pk_...");
const navRef = createNavigationContainerRef();

export default function App() {
  return <NavigationContainer ref={navRef} {...trackNavigation(analytics, navRef)}>{/* screens */}</NavigationContainer>;
}

await analytics.identify("user_123", { plan: "pro" });
await analytics.track("purchase_completed", { total: 9.99 });

The queue lives in AsyncStorage, so unsent events survive restarts, and the app going to the background triggers a flush.

JavaScript SDK (browser and Node.js)

Install @iforevents/browser or @iforevents/node, identify users, track events and add adapters

Python SDK

Install iforevents, identify users, track events and add adapters from Python

On this page

ReactNext.js (App Router)React Native and Expo