Firework for Developers
One-to-one Virtual ShoppingBusiness Portal
  • Welcome to Firework for Developers
  • Firework Interactive Video and One-to-many Digital Showroom
  • Web
    • Getting Started (Web)
      • Shopify
      • Magento
      • Wordpress (WooCommerce)
      • Salesforce Commerce Cloud
      • BigCommerce
    • Integration Guide for Web
      • Components
        • Hero Unit
        • Carousel / Grid
        • Storyblock (Web)
        • Player (Floating)
        • Storylink
      • Styling
      • Feed Attributes
      • Player
        • Configuration
          • Appearance
      • Video customization
        • Video Factory
        • CTA Button
        • Product cards
      • Events
        • Embed Feed and Storyblock Events
        • Video player events
        • Live stream events
        • Shopping events
      • Shopping Integration (V2)
        • Introduction
        • Shopping APIs
        • Product Hydration
        • Product Factory
        • Cart Sync
        • Tracking
          • Purchase
          • Add to cart
          • Remove from cart
          • Page viewed
        • Shopping Integration FAQ
        • Migrate from V1
      • Web SDK
      • Enhanced Picture-in-Picture
      • Privacy settings
        • Tracking settings
        • Cookies management
        • Content Security Policy
    • Telemetry console
    • Firework Service Domains
    • FAQ & Troubleshooting (Web)
  • Android SDK
    • Integration Guide for Android SDK
      • Getting Started (Android)
      • Video Feed (Android)
        • Video Feed Layouts (Android)
        • Channel Feed (Android)
        • Discover Feed (Android)
        • Playlist Feed (Android)
        • Dynamic Content Feed
        • Channel Hashtags Feed
        • Sku Feed
        • Single Content Feed
        • Configure Video Feed
      • Customization
        • CTA
      • Analytics (Android)
      • Shoppable Videos (Android)
        • Product Hydration
      • Live Stream Support (Android)
      • Video Player (Android)
      • StoryBlock (Android)
      • Share & Video Deep linking
      • Ad Support (Android)
      • Configure Video Advertisements Source (Android)
      • In-app Language Switches
      • Compose support(Android)
    • Sample App (Android)
    • FAQ & Troubleshooting (Android)
    • Changelog (Android)
  • iOS SDK
    • Integration Guide for iOS SDK
      • Getting Started (iOS)
      • ATT compliance (iOS)
      • Video Feed (iOS)
        • Discover Feed(iOS)
        • Channel Feed (iOS)
        • Playlist Feed (iOS)
        • Playlist Group Feed (iOS)
        • Dynamic Content (iOS)
        • Hashtag Playlist (iOS)
        • SKU Playlist (iOS)
        • Video Ads (iOS)
        • Video Feed Layouts (iOS)
      • Story Block (iOS)
      • Customization (iOS)
        • Video feed configurations (iOS)
        • Player configurations (iOS)
        • Shopping configurations (iOS)
          • Customize product card on videos using the custom view (iOS)
        • Customize click behaviors (iOS)
      • Shopping (iOS)
      • Live Stream Support (iOS)
      • Analytics (iOS)
      • Share & Deeplinking(iOS)
      • Ad Support (iOS)
    • Sample App (iOS)
    • FAQ & Troubleshooting (iOS)
    • Changelog (iOS)
  • React Native SDK
    • Integration Guide for React Native SDK V2
      • Getting Started (React Native)
      • ATT compliance React Native (iOS)
      • Video Feed (React Native)
      • Story Block (React Native)
      • Customization (React Native)
        • Video feed configurations (React Native)
        • Player configurations (React Native)
        • Shopping configurations (React Native)
          • Customize product card on videos using the custom view (React Native)
        • Customize click behaviors (React Native)
      • Shopping (React Native)
      • Live Stream Support (React Native)
      • Ad Support (React Native)
      • Analytics (React Native)
      • App-level Language Setting (React Native)
      • Share & Video Deeplinking (React Native)
      • Android Style (React Native)
      • Inject Android Image Loader (React Native)
      • Integrate SDKs in Hybrid React Native and native Apps
      • Reference (React Native)
      • Sample App (React Native)
      • FAQ & Troubleshooting (React Native)
      • Changelog (React Native)
  • Flutter SDK
    • Integration Guide for Flutter SDK V2
      • Getting Started (Flutter)
      • ATT compliance Flutter (iOS)
      • Video Feed (Flutter)
      • Story Block (Flutter)
      • Customization (Flutter)
        • Video feed configurations (Flutter)
        • Player configurations (Flutter)
        • Shopping configurations (Flutter)
          • Customize product card on videos using the custom view (Flutter)
        • Customize click behaviors (Flutter)
      • Live Stream Support (Flutter)
      • Shopping (Flutter)
      • Ad Support (Flutter)
      • Analytics (Flutter)
      • App-level Language Setting (Flutter)
      • Share & Video Deeplinking (Flutter)
      • Inject Android Image Loader (Flutter)
      • Android Style (Flutter)
      • Integrate SDKs in Hybrid Flutter and native Apps
      • Reference (Flutter)
      • Sample App (Flutter)
      • FAQ & Troubleshooting (Flutter)
      • Changelog (Flutter)
  • Help Articles
    • Importing Products to Firework
    • Adding products to a video
    • Displaying product videos on product pages using hashtag filtering(Web)
    • Syncing Carts
    • Encoded IDs
Powered by GitBook
On this page
  • Video playback events
  • Video feed click events
  • Live stream events
  • Live stream chat events
  • Product click events
  • Outstream PDP
  • Instream PDP
  • Shopping CTA click events
  • Video overlay CTA click events
  • Purchase tracking
  • Conversion tracking
  • Sample use case
  • Get feed id for VideoFeed and StoryBlock during widget initialization
  • Get data from onShoppingCTA callback
  • Opt out of Firework data tracking while still accessing Firework videos

Was this helpful?

  1. Flutter SDK
  2. Integration Guide for Flutter SDK V2

Analytics (Flutter)

PreviousAd Support (Flutter)NextApp-level Language Setting (Flutter)

Last updated 2 months ago

Was this helpful?

Video playback events

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

FireworkSDK.getInstance().onVideoPlayback = (event) {
  if (event != null) {
    // Get feed id
    final feedId = event.info.feedId ?? "";
    // Get video id
    final videoId = event.info.videoId ?? "";
    // Get video type, the possible values for videoType
    // are: VideoType.ad, VideoType.video, and VideoType.livestream.
    final videoType = event.info.videoType;
    // Get live stream status, the possible values for livestreamStatus
    // are: LiveStreamStatus.idle, LiveStreamStatus.live, LiveStreamStatus.completed, 
    //      and LiveStreamStatus.replay
    final livestreamStatus = event.info.liveStreamStatus;
    // The possible values for widgetType
    // are: FWWidgetType.videoFeed and FWWidgetType.storyBlock
    final widgetType = FireworkSDK.getInstance().getWidgetType(feedId);
    switch (event.eventName) {
      case VideoPlaybackEventName.impression:

        /// When video is shown to the user.
        break;
      case VideoPlaybackEventName.start:

        /// Video started.
        break;
      case VideoPlaybackEventName.pause:

        /// Video paused.
        break;
      case VideoPlaybackEventName.resume:

        /// Video resume.
        break;
      case VideoPlaybackEventName.firstQuartile:

        /// Video reached 25%.
        break;
      case VideoPlaybackEventName.midpoint:

        /// Video reached 50%.
        break;
      case VideoPlaybackEventName.thirdQuartile:

        /// Video reached 75%.
        break;
      case VideoPlaybackEventName.complete:

        /// Video reached 100% or video was closed manually.
        break;
      case VideoPlaybackEventName.adStart:

        /// When ad video start playing.
        break;
      case VideoPlaybackEventName.adEnd:

        /// When ad video finishes playing.
        break;
      case VideoPlaybackEventName.clickCTA:

        /// When a visitor clicks on CTA button (if available).
        break;
      case VideoPlaybackEventName.clickShare:

        /// When user clicks on "Share" button.
        break;
    }
  }
};

Video feed click events

FireworkSDK.getInstance().onVideoFeedClick = (event) {
  // Get feed id
  final feedId = event?.info.feedId ?? "";
  // Get video id
  final videoId = event?.info.id ?? "";
  // Get video type, the possible values for videoType
  // are: VideoType.ad, VideoType.video, and VideoType.livestream.
  final videoType = event?.info.videoType;
  // Get live stream status, the possible values for livestreamStatus
  // are: LiveStreamStatus.idle, LiveStreamStatus.live, LiveStreamStatus.completed, 
  //      and LiveStreamStatus.replay
  final livestreamStatus = event?.info.liveStreamStatus;
  // The possible values for widgetType
  // are: FWWidgetType.videoFeed and FWWidgetType.storyBlock
  final widgetType = FireworkSDK.getInstance().getWidgetType(feedId);
};

Live stream events

FireworkSDK.getInstance().liveStream.onLiveStreamEvent = (event) {
  if (event != null) {
    // Get feed id
    final feedId = event.info.feedId ?? "";
    // Get video id
    final videoId = event.info.id ?? "";
    // Get video type, the possible values for videoType
    // are: VideoType.ad, VideoType.video, and VideoType.livestream.
    final videoType = event.info.videoType;
    // Get live stream status, the possible values for livestreamStatus
    // are: LiveStreamStatus.idle, LiveStreamStatus.live, LiveStreamStatus.completed, 
    //      and LiveStreamStatus.replay
    final livestreamStatus = event.info.liveStreamStatus;
    // The possible values for widgetType
    // are: FWWidgetType.videoFeed and FWWidgetType.storyBlock
    final widgetType = FireworkSDK.getInstance().getWidgetType(feedId);
    switch (event.eventName) {
      case LiveStreamEventName.userDidjoin:
        print("User joins the livestream");
        break;
      case LiveStreamEventName.userDidLeave:
        print("User leaves the livestream");
        break;
      case LiveStreamEventName.userSendLike:
        print("User sends like in the livestream");
        break;
    }
  }
};

Live stream chat events

FireworkSDK.getInstance().liveStream.onLiveStreamChatEvent = (event) {
  if (event != null) {
    // Get feed id
    final feedId = event.liveStreamfeedId ?? "";
    // Get video id
    final videoId = event.liveStream.id ?? "";
    // Get video type, the possible values for videoType
    // are: VideoType.ad, VideoType.video, and VideoType.livestream.
    final videoType = event.liveStream.videoType;
    // Get live stream status, the possible values for livestreamStatus
    // are: LiveStreamStatus.idle, LiveStreamStatus.live, LiveStreamStatus.completed, 
    //      and LiveStreamStatus.replay
    final livestreamStatus = event.liveStream.liveStreamStatus;
    // The possible values for widgetType
    // are: FWWidgetType.videoFeed and FWWidgetType.storyBlock
    final widgetType = FireworkSDK.getInstance().getWidgetType(feedId);
    switch (event.eventName) {
      case LiveStreamChatEventName.userSendChat:
        print("User sends chat message in the livestream");
        break;
    }
  }
};

Product click events

Outstream PDP

FireworkSDK.getInstance().shopping.onCustomTapProductCard =
    (CustomTapProductCardEvent? event) async {
  // Get feed id
  final feedId = event?.video.feedId ?? "";
  // Get video id
  final videoId = event?.video.videoId ?? "";
  // Get video type, the possible values for videoType
  // are: VideoType.ad, VideoType.video, and VideoType.livestream.
  final videoType = event?.video.videoType;
  // Get live stream status, the possible values for livestreamStatus
  // are: LiveStreamStatus.idle, LiveStreamStatus.live, LiveStreamStatus.completed, 
  //      and LiveStreamStatus.replay
  final livestreamStatus = event?.video.liveStreamStatus;
  // The possible values for widgetType
  // are: FWWidgetType.videoFeed and FWWidgetType.storyBlock
  final widgetType = FireworkSDK.getInstance().getWidgetType(feedId);

  final result =
      await FireworkSDK.getInstance().navigator.startFloatingPlayer();
  if (!result) {
    // When the result is false, the current fullscreen player may not
    // enable the floating player. In that case, we could call the
    // following method to close the fullscreen player.
    await FireworkSDK.getInstance().navigator.popNativeContainer();
  }

  // If the context is available, you could also call
  // Navigator.of(context).pushNamed to push the Flutter link content page.
  globalNavigatorKey.currentState?.pushNamed('/link_content', arguments: {
    "url": event?.url,
  });
};

Instream PDP

FireworkSDK.getInstance().shopping.onClickProduct =
    (ClickProductEvent? event) async {
  // Get feed id
  final feedId = event?.video.feedId ?? "";
  // Get video id
  final videoId = event?.video.videoId ?? "";
  // Get video type, the possible values for videoType
  // are: VideoType.ad, VideoType.video, and VideoType.livestream.
  final videoType = event?.video.videoType;
  // Get live stream status, the possible values for livestreamStatus
  // are: LiveStreamStatus.idle, LiveStreamStatus.live, LiveStreamStatus.completed, 
  //      and LiveStreamStatus.replay
  final livestreamStatus = event?.video.liveStreamStatus;
  // The possible values for widgetType
  // are: FWWidgetType.videoFeed and FWWidgetType.storyBlock
  final widgetType = FireworkSDK.getInstance().getWidgetType(feedId);
};

Shopping CTA click events

FireworkSDK.getInstance().shopping.onShoppingCTA =
    (ShoppingCTAEvent? event) async {
  // Get feed id
  final feedId = event?.video.feedId ?? "";
  // Get video id
  final videoId = event?.video.videoId ?? "";
  // Get video type, the possible values for videoType
  // are: VideoType.ad, VideoType.video, and VideoType.livestream.
  final videoType = event?.video.videoType;
  // Get live stream status, the possible values for livestreamStatus
  // are: LiveStreamStatus.idle, LiveStreamStatus.live, LiveStreamStatus.completed, 
  //      and LiveStreamStatus.replay
  final livestreamStatus = event?.video.liveStreamStatus;
  // The possible values for widgetType
  // are: FWWidgetType.videoFeed and FWWidgetType.storyBlock
  final widgetType = FireworkSDK.getInstance().getWidgetType(feedId);

  final result =
      await FireworkSDK.getInstance().navigator.startFloatingPlayer();
  if (!result) {
    // When the result is false, the current fullscreen player may not
    // enable the floating player. In that case, we could call the
    // following method to close the fullscreen player.
    await FireworkSDK.getInstance().navigator.popNativeContainer();
  }

  Future.delayed(const Duration(seconds: 0), () {
    // If the context is available, you could also call
    // Navigator.of(context).pushNamed to push the Flutter link content page.
    globalNavigatorKey.currentState?.pushNamed('/link_content', arguments: {
      "url": event?.url,
    });
  });

  return ShoppingCTAResult(
    res: ShoppingCTARes.success,
  );
};

Video overlay CTA click events

FireworkSDK.getInstance().onCustomCTAClick =
    (CustomCTAClickEvent? event) async {
  // Get feed id
  final feedId = event?.video.feedId ?? "";
  // Get video id
  final videoId = event?.video.videoId ?? "";
  // Get video type, the possible values for videoType
  // are: VideoType.ad, VideoType.video, and VideoType.livestream.
  final videoType = event?.video.videoType;
  // Get live stream status, the possible values for livestreamStatus
  // are: LiveStreamStatus.idle, LiveStreamStatus.live, LiveStreamStatus.completed, 
  //      and LiveStreamStatus.replay
  final livestreamStatus = event?.video.liveStreamStatus;
  // The possible values for widgetType
  // are: FWWidgetType.videoFeed and FWWidgetType.storyBlock
  final widgetType = FireworkSDK.getInstance().getWidgetType(feedId);

  final result =
      await FireworkSDK.getInstance().navigator.startFloatingPlayer();
  if (!result) {
    // When the result is false, the current fullscreen player may not
    // enable the floating player. In that case, we could call the
    // following method to close the fullscreen player.
    await FireworkSDK.getInstance().navigator.popNativeContainer();
  }

  // If the context is available, you could also call
  // Navigator.of(context).pushNamed to push the Flutter link content page.
  globalNavigatorKey.currentState?.pushNamed('/link_content', arguments: {
    "url": event?.url ?? '',
  });
};
FireworkSDK.getInstance().onVideoPlayback =
    (VideoPlaybackEvent? event) async {
  if (event != null) {
    final eventName = event.eventName;
    // Get feed id
    final feedId = event.info.feedId ?? "";
    // Get video id
    final videoId = event.info.videoId ?? "";
    // Get video type, the possible values for videoType
    // are: VideoType.ad, VideoType.video, and VideoType.livestream.
    final videoType = event.info.videoType;
    // Get live stream status, the possible values for livestreamStatus
    // are: LiveStreamStatus.idle, LiveStreamStatus.live, LiveStreamStatus.completed, 
    //      and LiveStreamStatus.replay
    final livestreamStatus = event.info.liveStreamStatus;
    // The possible values for widgetType
    // are: FWWidgetType.videoFeed and FWWidgetType.storyBlock
    final widgetType = FireworkSDK.getInstance().getWidgetType(feedId);
    switch (eventName) {
      case VideoPlaybackEventName.clickCTA:
        /// When a visitor clicks on CTA button (if available).
        break;
      default:
        break;
    }
  }
};

Purchase tracking

FireworkSDK.getInstance().trackPurchase(
  TrackPurchaseParameters(
    orderId: "<Order ID of User Purchase>",
    value: "total purchase value",
    currencyCode: "e.g. USD",
    countryCode: "e.g. US",
    additionalInfo: <String, String>{
      "additionalKey1": "additionalValue1",
      "additionalKey2": "additionalValue2",
      "additionalKey3": "additionalValue3"
    },
  ),
);

Conversion tracking

Sample use case

When a user clicks the "Shop now" button on the product card, we aim to track the specific entry they interacted with. This entry includes details such as the widget type (video feed or story block) and the widget title.

Get feed id for VideoFeed and StoryBlock during widget initialization

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

Map<String, String> globalMap = <String, String>{};

VideoFeed(
  height: 200,
  source: VideoFeedSource.discover,
  onVideoFeedGetFeedId: (feedId) {
    // The host app could store some custom info based on the feed id,
    // such as widget name.
    globalMap[feedId] = "VideoFeed Widget1";
  },
);

VideoFeed(
  height: 200,
  source: VideoFeedSource.discover,
  onVideoFeedGetFeedId: (feedId) {
    // The host app could store some custom info based on the feed id,
    // such as widget name.
    globalMap[feedId] = "VideoFeed Widget2";
  },
);

StoryBlock(
  height: 200,
  source: StoryBlockSource.discover,
  onStoryBlockGetFeedId: (feedId) {
    // The host app could store some custom info based on the feed id,
    // such as widget name.
    globalMap[feedId] = "StoryBlock Widget1";
  },
);

StoryBlock(
  height: 200,
  source: StoryBlockSource.discover,
  onStoryBlockGetFeedId: (feedId) {
    // The host app could store some custom info based on the feed id,
    // such as widget name.
    globalMap[feedId] = "StoryBlock Widget2";
  },
);

Get data from onShoppingCTA callback

Then, the host app could get feed id, video id, video type, live stream status, widget type and custom info(such as widget name) from onShoppingCTA callback. For example:

FireworkSDK.getInstance().shopping.onShoppingCTA = async (event: ShoppingCTAEvent) => {
  // Get feed id
  final feedId = event?.video.feedId ?? "";
  // Get custom info based on the feed id
  final widgetName = globalMap[feedId];
  // Get widget type based on feed id
  // The possible values for widgetType
  // are: FWWidgetType.videoFeed and FWWidgetType.storyBlock
  final widgetType = FireworkSDK.getInstance().getWidgetType(feedId);
  // Get video id
  final videoId = event?.video.videoId ?? "";
  // Get video type, the possible values for videoType
  // are: VideoType.ad, VideoType.video, and VideoType.livestream.
  final videoType = event?.video.videoType;
  // Get live stream status, the possible values for livestreamStatus
  // are: LiveStreamStatus.idle, LiveStreamStatus.live, LiveStreamStatus.completed, 
  //      and LiveStreamStatus.replay
  final livestreamStatus = event?.video.liveStreamStatus;
}

In addition to onShoppingCTA callback, we could also get feed id, video id, video type, live stream status, widget type and custom info(such as widget name) from other event callbacks, such as:

FireworkSDK.getInstance().onVideoPlayback = (event) {
  if (event != null) {
    // Get feed id
    final feedId = event.info.feedId ?? "";
    // Get widget type based on feed id
    // The possible values for widgetType
    // are: FWWidgetType.videoFeed and FWWidgetType.storyBlock
    final widgetType = FireworkSDK.getInstance().getWidgetType(feedId);
    // Get custom info based on the feed id
    final widgetName = globalMap[feedId];
    // Get video id
    final videoId = event.info.videoId ?? "";
    // Get video type, the possible values for videoType
    // are: VideoType.ad, VideoType.video, and VideoType.livestream.
    final videoType = event.info.videoType;
    // Get live stream status, the possible values for livestreamStatus
    // are: LiveStreamStatus.idle, LiveStreamStatus.live, LiveStreamStatus.completed, 
    //      and LiveStreamStatus.replay
    final livestreamStatus = event.info.liveStreamStatus;
  }
};

FireworkSDK.getInstance().onVideoFeedClick = (event) {
  // Get feed id
  final feedId = event?.info.feedId ?? "";
  // Get widget type based on feed id
  // The possible values for widgetType
  // are: FWWidgetType.videoFeed and FWWidgetType.storyBlock
  final widgetType = FireworkSDK.getInstance().getWidgetType(feedId);
  // Get custom info based on the feed id
  final widgetName = globalMap[feedId];
  // Get video id
  final videoId = event?.info.id ?? "";
  // Get video type, the possible values for videoType
  // are: VideoType.ad, VideoType.video, and VideoType.livestream.
  final videoType = event?.info.videoType;
  // Get live stream status, the possible values for livestreamStatus
  // are: LiveStreamStatus.idle, LiveStreamStatus.live, LiveStreamStatus.completed, 
  //      and LiveStreamStatus.replay
  final livestreamStatus = event?.info.liveStreamStatus;
};

FireworkSDK.getInstance().liveStream.onLiveStreamEvent = (event) {
  if (event != null) {
    // Get feed id
    final feedId = event.info.feedId ?? "";
    // Get widget type based on feed id
    // The possible values for widgetType
    // are: FWWidgetType.videoFeed and FWWidgetType.storyBlock
    final widgetType = FireworkSDK.getInstance().getWidgetType(feedId);
    // Get custom info based on the feed id
    final widgetName = globalMap[feedId];
    // Get video id
    final videoId = event.info.id ?? "";
    // Get video type, the possible values for videoType
    // are: VideoType.ad, VideoType.video, and VideoType.livestream.
    final videoType = event.info.videoType;
    // Get live stream status, the possible values for livestreamStatus
    // are: LiveStreamStatus.idle, LiveStreamStatus.live, LiveStreamStatus.completed, 
    //      and LiveStreamStatus.replay
    final livestreamStatus = event.info.liveStreamStatus;
  }
};

FireworkSDK.getInstance().liveStream.onLiveStreamChatEvent = (event) {
  if (event != null) {
    // Get feed id
    final feedId = event.liveStreamfeedId ?? "";
    // Get widget type based on feed id
    // The possible values for widgetType
    // are: FWWidgetType.videoFeed and FWWidgetType.storyBlock
    final widgetType = FireworkSDK.getInstance().getWidgetType(feedId);
    // Get custom info based on the feed id
    final widgetName = globalMap[feedId];
    // Get video id
    final videoId = event.liveStream.id ?? "";
    // Get video type, the possible values for videoType
    // are: VideoType.ad, VideoType.video, and VideoType.livestream.
    final videoType = event.liveStream.videoType;
    // Get live stream status, the possible values for livestreamStatus
    // are: LiveStreamStatus.idle, LiveStreamStatus.live, LiveStreamStatus.completed, 
    //      and LiveStreamStatus.replay
    final livestreamStatus = event.liveStream.liveStreamStatus;
  }
};

FireworkSDK.getInstance().shopping.onCustomTapProductCard =
    (CustomTapProductCardEvent? event) async {
  // Get feed id
  final feedId = event?.video.feedId ?? "";
  // Get widget type based on feed id
  // The possible values for widgetType
  // are: FWWidgetType.videoFeed and FWWidgetType.storyBlock
  final widgetType = FireworkSDK.getInstance().getWidgetType(feedId);
  // Get custom info based on the feed id
  final widgetName = globalMap[feedId];
  // Get video id
  final videoId = event?.video.videoId ?? "";
  // Get video type, the possible values for videoType
  // are: VideoType.ad, VideoType.video, and VideoType.livestream.
  final videoType = event?.video.videoType;
  // Get live stream status, the possible values for livestreamStatus
  // are: LiveStreamStatus.idle, LiveStreamStatus.live, LiveStreamStatus.completed, 
  //      and LiveStreamStatus.replay
  final livestreamStatus = event?.video.liveStreamStatus;
};

FireworkSDK.getInstance().shopping.onClickProduct =
    (ClickProductEvent? event) async {
  // Get feed id
  final feedId = event?.video.feedId ?? "";
  // Get widget type based on feed id
  // The possible values for widgetType
  // are: FWWidgetType.videoFeed and FWWidgetType.storyBlock
  final widgetType = FireworkSDK.getInstance().getWidgetType(feedId);
  // Get custom info based on the feed id
  final widgetName = globalMap[feedId];
  // Get video id
  final videoId = event?.video.videoId ?? "";
  // Get video type, the possible values for videoType
  // are: VideoType.ad, VideoType.video, and VideoType.livestream.
  final videoType = event?.video.videoType;
  // Get live stream status, the possible values for livestreamStatus
  // are: LiveStreamStatus.idle, LiveStreamStatus.live, LiveStreamStatus.completed, 
  //      and LiveStreamStatus.replay
  final livestreamStatus = event?.video.liveStreamStatus;
};

FireworkSDK.getInstance().onCustomCTAClick =
    (CustomCTAClickEvent? event) async {
  // Get feed id
  final feedId = event?.video.feedId ?? "";
  // Get widget type based on feed id
  // The possible values for widgetType
  // are: FWWidgetType.videoFeed and FWWidgetType.storyBlock
  final widgetType = FireworkSDK.getInstance().getWidgetType(feedId);
  // Get custom info based on the feed id
  final widgetName = globalMap[feedId];
  // Get video id
  final videoId = event?.video.videoId ?? "";
  // Get video type, the possible values for videoType
  // are: VideoType.ad, VideoType.video, and VideoType.livestream.
  final videoType = event?.video.videoType;
  // Get live stream status, the possible values for livestreamStatus
  // are: LiveStreamStatus.idle, LiveStreamStatus.live, LiveStreamStatus.completed, 
  //      and LiveStreamStatus.replay
  final livestreamStatus = event?.video.liveStreamStatus;
};

Opt out of Firework data tracking while still accessing Firework videos

We add a feature that allows users to opt out of Firework data tracking. Firework data tracking is enabled by default. You could use the following codes to disable Firework data tracking.

// As this API call is only effective for this app launch,
// you need to call this API every app launch.
FireworkSDK.getInstance().dataTrackingLevel = DataTrackingLevel.none;

After you disable Firework data tracking, you can also enable Firework tracking by using the following codes.

FireworkSDK.getInstance().dataTrackingLevel = DataTrackingLevel.all;

FireworkSDK.getInstance().dataTrackingLevel is only effective for this app launch, you need to call this API every app launch.

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

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

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

If you would like to customize the product click event handling, you could use 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.

If you would like to use the SDK default behavior to handle the product click event, you could use 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.

You could use callback to receive shopping CTA click events.

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

If you would like to use the SDK default behavior to handle the overlay CTA click event, you could use (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.

The host app can record a purchase which will help get a full picture of the user journey flow. To do this, call whenever the purchase happens. The following are the sample codes:

The API reference is .

VideoPlaybackEvent
VideoFeedClickEvent
LiveStreamEvent
LiveStreamChatEvent
onCustomTapProductCard
onClickProduct
onShoppingCTA
onCustomCTAClick
onVideoPlayback
FireworkSDK.getInstance().trackPurchase
onVideoFeedGetFeedId callback for VideoFeed
onVideoFeedGetFeedId callback for StoryBlock
dataTrackingLevel