Skip to main content

Bambuser Social Commerce SDK iOS

Overview

BambuserCommerceSDK is a lightweight SDK for integrating Bambuser video player and commerce experience into your android applications in order to enhance your app with interactive video commerce features that streamline the video shopping experience.


Requirements

This SDK is built using Xcode 16 with the Swift 6 toolchain but remains compatible with Swift 5. Ensure you have the correct version installed for compatibility.

  • Xcode 16 (or later)
  • Swift 5 toolchain
  • iOS 15.6+ supported

Important:

Add -ObjC Linker Flag


To ensure full functionality of the SDK, you must add the -ObjC flag to your app target:


Installation

Swift Package Manager (SPM)

You can integrate the SDK using Swift Package Manager. Add the following dependency to your project:

dependencies: [
.package(url: "https://github.com/bambuser/bambuser-commerce-sdk-ios", from: "1.0.0")
]

Please check our latest release versions here


Manual Installation

If you prefer to integrate the SDK manually, follow these steps:

  • Download BambuserCommerceSDK.xcframework from releases page
  • Drag and drop xcframework file to your project

Architecture

img

Bambuser Live SDK creates a native video player to display the live content and all the other shoppable elements are been overlayed by the webview. In this way we can get a seamless video streaming and picture in picture, with all the interactive elements.

Setup

BambuserPlayer.swift
// Import the SDK
import BambuserCommerceSDK

// Initialize the Bambuser video player with the server region
// You can choose between .US or .EU based on your region
let videoPlayer = BambuserVideoPlayer(server: .US) // or .EU

let playerView = videoPlayer.createPlayerView(
videoConfiguration: .init(
type: .live(id: "xxx"),

// List of events to listen to; use ["*"] for all events (currently only option available)
events: ["*"],

// Configuration settings for the player
// More options can be found here:
// https://bambuser.com/docs/live/player-api-reference/
configuration: [
"buttons": [
"dismiss": "none", // Hides the close button on the player.
"product": "none", // Clicking on a product requires a listener for the "should-show-product-view" event to handle this interaction.
],
"actionCard": "none", // Clicking on an action card requires a listener for the "action-card-clicked" eventmisformat to handle this interaction.
"currency": "USD", // Sets the currency format for display.
"locale": "en-US", // Defines the language and regional settings for the player interface.
"autoplay": true // player will automatically play video when player is ready
]
)
playerView.delegate = self
)

Delegate Protocol

The BambuserCommerceSDK provides the BambuserVideoPlayerDelegate protocol for handling communications from a Bambuser video player instance. By implementing this protocol, your class can receive callback messages when new events occur or errors are encountered.

Methods:

  • onNewEventReceived: Called when a new event is received from the video player.
  • onErrorOccurred: Called when an error occurs within the video player.

For more detailed infomation please check our Github Repo

Conversion Tracking

Bambuser Conversion Tracking for Live Video Shopping gives you the most value out of your Live Shopping performance statistics. The Bambuser Conversion tracker enables merchants to attribute the relevant conversions to the LiveShopping shows. The number of attributed sales will be available on the stats page of each show.

To track conversions within the BambuserCommerceSDK, utilize the track function provided by the BambuserPlayerView. This function transmits necessary data sets to Bambuser Analytics.

let response = try? await self.playerView.track(
event: "purchase",
with: [
"transaction": [
"id":"abcd",
"subtotal":70.99,
"currency":"USD",
"total":74.98,
"tax":14.2,
"shippingCost":3.99,
"shippingMethod":"Store pickup",
"coupon":"SUMMER_SALE",
],
"products": [
[
"id":"314-7216-102",
"name":"Tennis Shoe Classic - Size 10",
"image":"https://example.com/images/314-7216-102.jpg",
"price":70.99,
"currency":"USD",
"quantity":1,
"brand":"Plausible Co.",
"category":"Footwear > Sports > Tennis",
"location":"https://example.com/products/314-7216"
]
]
]
)

To log an event, you must supply and include additional data as a dictionary with string keys and values of any type ([String: Any?]). Note that the example format is for illustrative purposes only. For the precise data structure required for each event, please refer to our Github Repo.

Configuration and Functions:

To find the detailed configuration and functions please refer to Bambuser Player API Reference