Client libraries (JavaScript, Python, Go)
Generated clients for the whole API, from ingest to analytics
Three client libraries are generated from the OpenAPI document and published with every release of the API. They are thin, endpoint-by-endpoint clients; for event tracking with batching, retries, identity and adapters use the SDKs instead (JavaScript, Python, Go, Java, Swift, Ruby, PHP, .NET). The generated clients remain the way to call analytics and admin endpoints from code.
| Language | Package | Install |
|---|---|---|
| JavaScript / Node.js | @iforevents/sdk-js | npm install @iforevents/sdk-js |
| Python 3.10+ | iforevents-sdk (module iforevents_sdk) | pip install iforevents-sdk |
| Go 1.23+ | github.com/innovafour/iforevents-api-go | go get github.com/innovafour/iforevents-api-go |
They cover every endpoint: ingest with the public project key, analytics with the key and secret (see the API reference), and the dashboard routes with a session token. Method names follow the operationIds of the document (trackEvent, identifyUser, getFunnel, ...), so the API reference doubles as the SDK reference.
For browsers use the web snippet instead; for mobile apps the Flutter SDK.
Node.js
const IForevents = require("@iforevents/sdk-js");
const client = new IForevents.ApiClient();
client.authentications.projectKey.apiKey = process.env.IFOREVENTS_PROJECT_KEY;
const ingest = new IForevents.IngestApi(client);
await ingest.trackEvent(
{ event_name: "purchase", event_type: "track", properties: { amount: 99.99, currency: "USD" } },
{ xUserId: "user_12345" }, // your id for the person; no identify call needed
);
await ingest.identifyUser({ custom_id: "user_12345", email: "[email protected]" }); // optional profile detailsAnalytics with the project secret (server side only):
client.authentications.projectSecret.apiKey = process.env.IFOREVENTS_PROJECT_SECRET;
const { metrics } = await new IForevents.AnalyticsApi(client).getMetrics();Python
import os
from iforevents_sdk import ApiClient, Configuration, IngestApi, AnalyticsApi
from iforevents_sdk.models import IdentifyUserRequest, TrackEventRequest
config = Configuration(host="https://api.iforevents.com")
config.api_key["projectKey"] = os.environ["IFOREVENTS_PROJECT_KEY"]
with ApiClient(config) as client:
ingest = IngestApi(client)
ingest.track_event(
TrackEventRequest(event_name="purchase", event_type="track", properties={"amount": 99.99, "currency": "USD"}),
x_user_id="user_12345", # your id for the person; no identify call needed
)
ingest.identify_user(IdentifyUserRequest(custom_id="user_12345", email="[email protected]")) # optional profile details
config.api_key["projectSecret"] = os.environ["IFOREVENTS_PROJECT_SECRET"] # server side only
print(AnalyticsApi(client).get_metrics().metrics)Go
import (
"context"
"os"
iforevents "github.com/innovafour/iforevents-api-go"
)
cfg := iforevents.NewConfiguration()
cfg.AddDefaultHeader("X-Project-Key", os.Getenv("IFOREVENTS_PROJECT_KEY"))
client := iforevents.NewAPIClient(cfg)
ctx := context.Background()
event := iforevents.NewTrackEventRequest("purchase")
event.SetProperties(map[string]interface{}{"amount": 99.99, "currency": "USD"})
if _, _, err := client.IngestAPI.TrackEvent(ctx).XUserId("user_12345").TrackEventRequest(*event).Execute(); err != nil {
// err carries the status; the response body is in err.(*iforevents.GenericOpenAPIError).Body()
}
// Analytics with the secret, server side only.
cfg.AddDefaultHeader("X-Project-Secret", os.Getenv("IFOREVENTS_PROJECT_SECRET"))
metrics, _, err := client.AnalyticsAPI.GetMetrics(ctx).Execute()Versions
The libraries carry the version of the API release they were generated from (npm view @iforevents/sdk-js version, pip index versions iforevents-sdk, go list -m -versions github.com/innovafour/iforevents-api-go). A new API release publishes all three at once; breaking changes are listed in the changelog.
Keys, not secrets
Ingest needs the project key only, and the key is safe to ship in apps. The project secret unlocks the read-only analytics routes and belongs on your servers: never put it in a browser bundle, a mobile app or a public repository. The dashboard shows it once, at project creation or rotation.