To run the example project, clone the repo, and run pod install
from the Example directory first.
ExposeBox is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ExposeBox'
Import the framework (required)
import ExposeBoxSDK
Set your companyId (required). All data sent before setting companyId will be ignored.
ExposeBox.shared.companyId = "COMPANY_ID"
Set your appId (optional)
ExposeBox.shared.appId = "APP_ID"
companyId is your company's ID, appId is your app's ID, both provided by ExposeBox.
Then you can use ExposeBox across your app.
ExposeBox.shared.view(name: "MainView")
or alternatively from instance of UIViewController:
reportExposeBoxView(name: "MainView")
ExposeBox.shared.setCategories(["Category1", "Category2"])
ExposeBox.shared.setProducts(["e349vb", "x980tmw"])
In case of a single product, you can provide an array with a single element
ExposeBox.shared.setTags(["Key" : ["Key", "Value"]])
Use this when your customer is adding or removing items from the cart, where productId is your product's SKU, quantity is the quantity of the same product added, and price the product's unit price
ExposeBox.shared.addToCart(productId: "ID", quantity: INT, unitPrice: FLOAT)
ExposeBox.shared.removeFromCart(productId: "ID", quantity: INT)
ExposeBox.shared.addToWishlist(productId: "ID")
ExposeBox.shared.removeFromWishlist(productId: "ID")
ExposeBox.shared.apporove(coupon: "COUPON")
ExposeBox.shared.request(coupon: "COUPON")
Setting customer details enables ExposeBox send automated emails and synchronise offline data with online data.
Use this when the customer is logged in and the data is available.
First, create the CustomerData object
let customerData = ExposeBoxCustomerData(email: "EMAIL")
customerData.firstName = "FIRST"
customerData.lastName = "LAST"
customerData.customerId = "ID"
customerData.additionalInfo = ["CUSTOM": "DATA"]
ExposeBox.shared.setCustomerData(customerData)
Other fields like city, zip code, address, phone, etc are available via additional info.
Then send it through ExposeBox
You can send custom events with data
ExposeBox.shared.event(name: "EVENT", data: ["CUSTOM" : "DATA"])
Where eventName is the event name that will appear on your dashboard, and data is a Dictionary with your custom event data.
ExposeBox.shared.click(placementId: "ID", widgetId: INT, productId: "ID", additionalData: ["CUSTOM": "DATA"])
let batches = [RealImpressionBatch(placementId: "ID", widgetId: INT, items: ["CUSTOM" : "DATA"])]
ExposeBox.shared.realImpression(batches)
Notifies ExposeBox that a conversion was made. This should be sent when a conversion event has occurred (e.g. a “thank you” page after checkout)
First, create the cart products that were in the order, then send it through ExposeBox with orderId and totalPrice (optional) (orderId should be your order ID, which you usually get after an order was placed).
let products = [CartProduct(productId: "ID", quantity: INT, unitPrice: FLOAT)]
ExposeBox.shared.conversion(orderId: "ID", totalPrice: FLOAT, cartProducts: products)
After you set up your placements in the ExposeBox dashboard, you can get product recommendations for those placements. Provide placement IDs in a string array, like in the example below for placements ID1 and ID2. The response will contain a List of ExposeBox Placements
ExposeBox.shared.recommendations(placementIds: ["ID1", "ID2"]) { objects, error in
// YOUR HANDLERS
}
Viktor Shchepanovskyi, [email protected]
ExposeBox is available under the MIT license. See the LICENSE file for more info.