Summary
A tiny delegate the SDK calls so actions in Loudcrowd UI (e.g., “Add to cart”, “View product”) hand off to your app’s native cart or product detail page (PDP).
This is an optional step
If you do nothing, the SDK still works: it routes via your deep links/affiliate links to your existing web experience (with attribution). No extra setup required.
Implement the bridge only if you want these actions to affect your native cart or navigate to your native PDP.
When you should implement this
You want add-to-cart to update your in-app cart/badge.
You need native inventory/eligibility rules enforced.
You want tighter analytics stitching with your app events (native add-to-cart, PDP viewed).
Methods to Implement
addToCart(sku, qty, variantId?) — required for native cart handoff
openProduct(sku) — optional, for native PDP navigation
iOS (Swift)
// At app start (e.g., App.init or SceneDelegate)
Loudcrowd.shared.setCommerceDelegate(self)
// Conform somewhere central (e.g., AppCoordinator)
extension AppCoordinator: LCCommerceDelegate {
func addToCart(sku: String, qty: Int, variantId: String?) async throws {
// TODO: add item to your native cart and update UI/badge
// Example:
// try await Cart.shared.add(sku: sku, qty: qty, variantId: variantId)
}
func openProduct(sku: String) {
// TODO: push your native PDP for this SKU
// Example:
// router.navigate(.product(sku: sku))
}
}
Android (Kotlin)
// At app start (e.g., Application.onCreate or Activity.onCreate)
Loudcrowd.setCommerceDelegate(object : CommerceDelegate {
// Required for native cart handoff
override suspend fun addToCart(sku: String, qty: Int, variantId: String?) {
// TODO: add item to your native cart and update UI/badge
// Example:
// cartRepository.add(sku = sku, qty = qty, variantId = variantId)
}
// Optional: native PDP navigation
override fun openProduct(sku: String) {
// TODO: navigate to your native PDP for this SKU
// Example:
// navController.navigate("pdp/$sku")
}
})
Data Passed by the SDK
Identifiers and quantities only: sku, optional variantId, qty.
No payment data or PII is handled by the SDK.