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
  1. iOS SDK
  2. Integration Guide for iOS SDK
  3. Customization (iOS)

Customize click behaviors (iOS)

PreviousCustomize product card on videos using the custom view (iOS)NextShopping (iOS)

Last updated 5 months ago

Was this helpful?

CtrlK
  • Customize video overlay CTA button click behavior
  • Customize click behaviors for shopping
  • Custom livestream link interaction click behavior
  • Navigate to the host app page

Was this helpful?

The SDK provides behavior delegate methods to customize click behaviors, including those for the video CTA button, product cards, and shopping CTA button.

Customize video overlay CTA button click behavior

  1. Set FireworkVideoCTADelegate delegate:

FireworkVideoSDK.ctaDelegate = <FireworkVideoCTADelegate delegate>

2. Implement handleCustomCTAClick(_:url:for:):

func handleCustomCTAClick(
    _ viewController: PlayerViewController,
    url: URL,
    for video: VideoDetails
) -> Bool {
    // Here, you could write codes to navigate to the host app page.
    // For best practices on navigating to the host page,
    // please consult "Navigate to the host app page" below.

    // Return true to customize video overlay CTA button click behavior
    return true
}

You could write codes to navigate to the host app page within the delegate method. For best practices on navigating to the host page, please consult Navigate to the host app page below.

Customize click behaviors for shopping

To customize click behaviors for shopping, you need to set FireworkVideoShoppingDelegate delegate first:

FireworkVideoSDK.shopping.delegate = <FireworkVideoShoppingDelegate delegate>

Customize product card click behavior

Implement fireworkShopping(_:didTapProductVariant:forVideo:):

func fireworkShopping(
    _ fireworkShopping: FireworkVideoShopping,
    didTapProductVariant item: SelectedProductVariant,
    forVideo video: VideoDetails
) -> Bool {
    // Here, you could write codes to navigate to the host app page.
    // For best practices on navigating to the host page,
    // please consult "Navigate to the host app page" below.

    // Return true to customize product card click behavior
    return true
}

You could write codes to navigate to the host app page within the delegate method. For best practices on navigating to the host page, please consult Navigate to the host app page below.

Customize shopping CTA click behavior

Implement fireworkShopping(_:productVariantCTASelected:fromVideo:ctaCompletionHandler:):

func fireworkShopping(
    _ fireworkShopping: FireworkVideoShopping,
    productVariantCTASelected item: SelectedProductVariant,
    fromVideo video: VideoDetails,
    ctaCompletionHandler: @escaping ShoppingCTAHandler
) {
    // Here, you could write codes to navigate to the host app page.
    // For best practices on navigating to the host page,
    // please consult "Navigate to the host app page" below.

    // Calling completion closure with none refer to
    // host app will customize the click behavior
    ctaCompletionHandler(.none)
}

You could write codes to navigate to the host app page within the delegate method. For best practices on navigating to the host page, please consult Navigate to the host app page below.

Customize product link button click behavior

Implement fireworkShopping(_:didTapLinkButtonAt:fromVideo:withURL:):

func fireworkShopping(
        _ fireworkShopping: FireworkVideoShopping,
        didTapLinkButtonAt item: SelectedProductVariant,
        fromVideo video: VideoDetails,
        withURL itemURL: String
    ) -> Bool {
        // Here, you could write codes to navigate to the host app page.
        // For best practices on navigating to the host page,
        // please consult "Navigate to the host app page" below.

        // Return true to customize product link button click behavior
        return true
}

You could write codes to navigate to the host app page within the delegate method. For best practices on navigating to the host page, please consult Navigate to the host app page below.

Customize cart icon click behavior

  1. Set cartAction to custom:

FireworkVideoSDK.shopping.cartAction = .custom
  1. Implement fireworkShopping(_:didTapCartIconForVideo:):


func fireworkShopping(
    _ fireworkShopping: FireworkVideoShopping,
    didTapCartIconForVideo videoDetails: VideoDetails
) {
    // Here, you could write codes to navigate to the host app page.
    // For best practices on navigating to the host page,
    // please consult "Navigate to the host app page" below.
}

You could write codes to navigate to the host app page within the delegate method. For best practices on navigating to the host page, please consult Navigate to the host app page below.

Custom livestream link interaction click behavior

  1. Set FireworkLiveStreamBehaviorDelegate delegate:

FireworkVideoSDK.liveStreamBehaviorDelegate = <FireworkLiveStreamBehaviorDelegate delegate>
  1. Implement fireworkLiveStream(_:didTapLinkInteraction:):

func fireworkLiveStream(
    _ liveStream: LiveStreamEventDetails,
    didTapLinkInteraction interaction: LiveStreamLinkInteraction
) -> Bool {
    // Here, you could write codes to navigate to the host app page.
    // For best practices on navigating to the host page,
    // please consult "Navigate to the host app page" below.

    // Return true to customize livestream link interaction click behavior
    return true
}

You could write codes to navigate to the host app page within the delegate method. For best practices on navigating to the host page, please consult Navigate to the host app page below.

Navigate to the host app page

We have three ways to navigate to the host app page when customizing click behaviors.

  1. Present the host app page over the SDK player.

  2. Use the host app navigation controller to push the host app page.

Present the host app page

As the following code snippets, we use "present" to navigate to the host app PDP page. The code snippets are:

func fireworkShopping(
    _ fireworkShopping: FireworkVideoShopping,
    didTapProductVariant item: SelectedProductVariant,
    forVideo video: VideoDetails
) -> Bool {
    // The following PDP view controller is a sample.
    // Please create your own PDP view controller.
    let pdpVC = UIViewController()
    // As we may have other flows in PDP(such as the checkout page),
    // we could embed the PDP controller with navigation controller.
    let nav = UINavigationController(rootViewController: pdpVC)
    nav.modalPresentationStyle = .fullScreen
    UIViewController.topPresentedVC()?.present(nav, animated: true)
    
    // Return true to customize product card click behavior
    return true
}

Use the host app navigation controller to push the host app page

When the SDK fullscreen player is displayed, the host app's navigation controller is positioned beneath it. When the host app navigates to a new page using its navigation controller while customizing click behaviors, it will be obscured by the Firework full-screen player.

As illustrated in the following code snippets, you can invoke our APIs to convert the Firework full-screen player (if it exists) into a floating player or close it (if it exists) when customizing click behaviors. This approach ensures that the new host app page will not be obscured by the Firework full-screen player.

func fireworkShopping(
    _ fireworkShopping: FireworkVideoShopping,
    didTapProductVariant item: SelectedProductVariant,
    forVideo video: VideoDetails
) -> Bool {
    // Use the following codes to convert the Firework full-screen player (if it exists)
    // into a floating player or close it
    do {
        try PictureInPictureController.start()
    } catch {
        FireworkVideoSDK.dismissFullScreenPlayer()
    }
    
    // Use host app navigation controller to push the host app page
    if let nav = FireworkVideoSDK.getHostAppNavigationController() {
        // The following PDP view controller is a sample.
        // Please create your own PDP view controller.
        let pdpVC = UIViewController()
        nav.pushViewController(pdpVC, animated: true)
        return true
    }
    return false
}

The above code snippets are based on fireworkShopping(_:didTapProductVariant:forVideo:). But they are also applicable to other behavior delegate methods.