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

JavaScript SDK (browser and Node.js)

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

The JavaScript family shares one core (@iforevents/core) and mirrors the Flutter package: a facade, pluggable integrations, and a first-party API integration that batches, retries and keeps an offline queue. The public project key is the only credential; there is no project secret in any SDK.

PackageFor
@iforevents/browserweb apps and script tags (auto page views, localStorage queue, beacon flush)
@iforevents/nodeNode.js 18+ servers and workers (drains on exit)
@iforevents/react, @iforevents/next, @iforevents/react-nativesee React, Next.js and React Native
@iforevents/mixpanel, @iforevents/amplitude, @iforevents/segment, @iforevents/posthog, @iforevents/ga4adapters: every call fans out to the vendor too

Browser

npm install @iforevents/browser
import { createBrowserIforevents } from "@iforevents/browser";

const analytics = createBrowserIforevents("pk_...", { autoTrack: true });
await analytics.identify("user_123", { email: "[email protected]", plan: "pro" });
await analytics.track("signup_completed", { plan: "pro" });
await analytics.page("/pricing");
await analytics.reset(); // logout

Without a bundler, the web snippet loads the same code from a script tag.

Node.js

npm install @iforevents/node
import { createIforevents } from "@iforevents/node";

const { iforevents, shutdown } = await createIforevents({ projectKey: process.env.IFOREVENTS_PROJECT_KEY! });
await iforevents.identify("user_123", { email: "[email protected]" });
await iforevents.track("invoice_paid", { amount: 120, currency: "USD" });
process.on("SIGTERM", () => shutdown().finally(() => process.exit(0)));

Identity

Every request carries X-User-Id: a generated anon_... id the SDK keeps per visitor, replaced by your own id on identify. A user exists by its events alone; identify adds a profile with name, e-mail and traits. reset() starts a fresh anonymous id. Identify traits go to every integration once and are not copied into later events (each backend keeps them on the profile); nested objects are flattened with _.

Adapters

import { MixpanelIntegration } from "@iforevents/mixpanel/browser";
import { GA4Integration } from "@iforevents/ga4";

createBrowserIforevents("pk_...", {
  integrations: [new MixpanelIntegration({ token: "..." }), new GA4Integration({ measurementId: "G-..." })],
});

One failing adapter never affects the others: every call returns an IntegrationResult per integration.

Options

OptionDefaultMeaning
baseUrlhttps://api.iforevents.comself-hosted installs pass their own origin
batchSize20events per request; 1 sends immediately; max 500
flushInterval10000 mshow long a partial batch waits
maxRetries / retryDelay3 / 1000 mstransient failures retry; Retry-After is honored
persistQueuebrowser true, node falseunsent events survive a reload
onQuotaExceeded, onError–typed errors: IForeventsAuthError, IForeventsQuotaExceededError, IForeventsRateLimitedError

Source: iforevents-sdks/js.

Flutter SDK

Install and initialize the IForevents Flutter SDK

React, Next.js and React Native

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

On this page

BrowserNode.jsIdentityAdaptersOptions