@fire-spark/analytics
Sends events to Fire Spark and to the GA4, Meta, TikTok and Masivo adapters.
import { analytics } from "@fire-spark/analytics";
import { ga4 } from "@fire-spark/analytics-ga4";
await analytics.configure({
channel_id: "web",
platform: "web",
storage: window.localStorage,
getCustomer: () => session.customer,
adapters: [ga4({ measurementId: "G-XXXXXXX" })],
onError: issue => console.error(issue)
});
await analytics.track("add_to_cart", { product_id: "p1", quantity: 1 });
Behavior to know before you integrate:
- Calls to
track()beforeconfigure()are kept and sent once it runs. - Fire Spark stores funnel and interaction events and any event sent as
track({ name, properties }).track("name", params)with another name only reaches the destinations (by design). - Fire Spark keeps one event per funnel step per session; destinations receive every occurrence.
- The queue is sent on its own (
flushAt,flushIntervalMs, page hide on web,appStatein React Native). - Destination failures go to
onError;track()never rejects for them. setUser()andsetConsent()reach every destination.
Guide: https://firespark.cloud/docs/guides/analytics/use-analytics-in-the-sdk