For the complete documentation index, see llms.txt. This page is also available as Markdown.

Analytics (React Native)

Video playback events

As follows, you could set FireworkSDK.getInstance().onVideoPlayback to receive video playback events. The event type is VideoPlaybackEvent.

FireworkSDK.getInstance().onVideoPlayback = (event) => {
  console.log('[example] onVideoPlayback', event);
};

Video feed click events

As follows, you could set FireworkSDK.getInstance().onVideoFeedClick to receive video feed click events. The event type is VideoFeedClickEvent.

FireworkSDK.getInstance().onVideoFeedClick = (event) => {
  console.log('[example] onVideoFeedClick', event);
};

Live stream events

As follows, you could set FireworkSDK.getInstance().liveStream.onLiveStreamEvent to receive live stream events. The event type is LiveStreamEvent.

FireworkSDK.getInstance().liveStream.onLiveStreamEvent = (event) => {
  console.log('[example] onLiveStreamEvent', event);
};

Live stream chat events

As follows, you could set FireworkSDK.getInstance().liveStream.onLiveStreamChatEvent to receive live stream chat events. The event type is LiveStreamChatEvent.

Product click events

Outstream PDP

If you would like to customize the product click event handling, you could use onCustomTapProductCard to support this use case. For example, you could open your product detail page when the user clicks on the product. We call this outstream PDP.

Instream PDP

If you would like to use the SDK default behavior to handle the product click event, you could use onClickProduct to support this use case. The SDK default behavior is opening Firework product detail page when the user clicks on the product. We call this instream PDP.

Shopping CTA click events

You could use onShoppingCTA callback to receive shopping CTA click events.

Video overlay CTA click events

  1. If you would like to customize the overlay CTA click event handling, you could use onCustomCTAClick to receive video overlay CTA click events. For example, you could open your product detail page when the user clicks on the overlay CTA.

  2. If you would like to use the SDK default behavior to handle the overlay CTA click event, you could use onVideoPlayback(eventName is VideoPlaybackEventName.ClickCTA) to receive video overlay CTA click events. The SDK default behavior is opening the CTA link using the SDK webview or system browser when the user clicks the overlay CTA.

Purchase tracking

The host app can record a purchase which will help get a full picture of the user journey flow. To do this, call FireworkSDK.getInstance().trackPurchase whenever the purchase happens.

Call trackPurchase once per completed order, on the order confirmation step. Report every purchase without any client-side filtering — Firework identifies attributed vs non-attributed purchases server-side.

Required fields

For Shopping V2 purchase tracking (parity with the Web analytics.purchase API), the following fields are required:

Field
Description

orderId

A unique identifier for the user's order.

value

The final amount paid, including taxes, shipping, and discounts. Sent as order_value.

currencyCode

The ISO 4217 currency code of the purchase value, e.g. USD.

subtotal

The items cost before discounts, taxes, and shipping.

products

The purchased items, must be non-empty. Sent as line_items.

Each entry in products requires price (the unit price, including line-level discounts), quantity, and at least one of sku or extProductId. sku can be the SKU, barcode, GTIN, MPN, or external id; when present it takes precedence over extProductId.

If any required field is missing, the SDK still forwards the event but logs a warning listing the missing fields.

Sample code

Conversion tracking

Get feed id for VideoFeed and StoryBlock during component initialization

You could use onVideoFeedGetFeedId callback to get feed id for VideoFeed and StoryBlock during component initialization. The related reference links are:

Get feed id from event callbacks

Currently, the host app could get feed id from some event callbacks. For example:

Last updated

Was this helpful?