Skip to main content

Usage

Each time a view is displayed, the SDK must be notified.

Example on a 'Home' page

override func viewDidLoad() {
super.viewDidLoad()
let homePageAttributes : BYHomeAttributes = BYHomeAttributes(tags: ["screenTitle":"\(self.screenTitle)", "numberCategory":"\(self.productCollections.count)"])
AppDelegate.instance.beyableClient.sendPageview(page: EPageUrlTypeBeyable.HOME, currentView: self.view, attributes: homePageAttributes)
}

Example on a 'Product' page

override func viewDidLoad() {
super.viewDidLoad()
let productBY : BYProductAttributes = BYProductAttributes(reference: productObject?.id, name: productObject?.name, url: productObject?.imageUrl, priceBeforeDiscount: productObject?.price.value ?? 0.0, sellingPrice: productObject?.price.value ?? 0, stock: 1, thumbnailUrl: "", tags: ["type":"\(productObject?.type ?? "")","materiel":"\(productObject?.info?.material ?? "")"])
AppDelegate.instance.beyableClient.sendPageview(page: EPageUrlTypeBeyable.PRODUCT, currentView: self.view, attributes: productBY)
}

Example - Page 'Category' with a collection of items

override func viewDidLoad() {
super.viewDidLoad()
let homePage : BYCategoryAttributes = BYCategoryAttributes(tags: ["screenTitle":"\(self.screenTitle)", "numberCategory":"\(self.productCollections.count)"])
AppDelegate.instance.beyableClient.sendPageview(page: EPageUrlTypeBeyable.CATEGORY, currentView: self.view, attributes: homePage)
}

Add on the UITableViewController

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "MyCell", for: indexPath)
//...

AppDelegate.instance.beyableClient.sendCellBinded(cell);
return cell
}