shoprees46Test
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Requirements
Installation
shoprees46Test is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'shoprees46Test'
Usage
Initialization
import shoprees46Test
.....
var sdk = createPersonalizationSDK(shopId: "API_KEY")
Get session id
let ssid = sdk.getSSID()
Track
Send track event to server. The track method has next events:
- Product view
sdk.track(event: .productView(id: "123")) { _ in
print(" Product view callback")
}
- Category View
sdk.track(event: .categoryView(id: "123")) { _ in
print(" Category view callback")
}
- Product add to favorites
sdk.track(event: .productAddedToFavorities(id: "123")) { _ in
print(" Product added to favorities callback")
}
- Product remove from Favorites
sdk.track(event: .productRemovedToFavorities(id: "123")) { _ in
print(" Product removed from favorities callback")
}
- Product add to Cart
sdk.track(event: .productAddedToCart(id: "123")) { _ in
print(" Product added to cart callback")
}
- Product remove from cart
sdk.track(event: .productRemovedFromCart(id: "123")) { _ in
print(" Product removed from cart callback")
}
- Syncronize cart
sdk.track(event: .syncronizeCart(ids: ["1", "2"])) { _ in
print(" Cart syncronized callback")
}
- Create Order
sdk.track(event: .orderCreated(orderId: "123", totalValue: 33.3, products: [(id: "1", amount: 3), (id: "2", amount: 1)])) { _ in
print(" Order created callback")
}
Recommend
Get recommends product ids.
sdk.recommend(blockId: "block_id") { recomendResult in
print(" Recommendations requested callback")
}
Or
sdk.recommend(blockId: "block_id", currentProductId: "1") { recomendResult in
print(" Recommendations requested callback")
}
Output:
recomended = [Sting] - products ids array; title = String - title block recomend
Search
Get search response for qeury in two statament ( partial search and full search)
Partial search:
sdk.search(query: "iphone", searchType: .instant) { searchResult in
print(" Instant search callback")
}
Full search:
sdk.search(query: "iphone", searchType: .full) { searchResult in
print(" Full search callback")
}
Output:
categories = [Category]; products = [Product]; productsTotal = Int; queries = [Query] .
Set user data
Send user data
sdk.setProfileData(userEmail: "email") { (profileDataResp) in
print(" Profile data callback")
}
Or
sdk.setProfileData(userEmail: "email", userPhone: "123", userLoyaltyId: "1", birthday: nil, age: nil, firstName: "Ars", secondName: "test", lastName: nil, location: nil, gender: .male) { (profileDataResp) in
print(" Profile data callback")
}
Author
Avsi222, «[email protected]»
License
shoprees46Test is available under the MIT license. See the LICENSE file for more info.