shoprees46Test 0.0.3

shoprees46Test 0.0.3

Maintained by Avsi222.



  • By
  • Avsi222

shoprees46Test

CI Status Version License Platform

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:

  1. Product view
sdk.track(event: .productView(id: "123")) { _ in
      print("   Product view callback")
}
  1. Category View
sdk.track(event: .categoryView(id: "123")) { _ in
            print("   Category view callback")
}
  1. Product add to favorites
sdk.track(event: .productAddedToFavorities(id: "123")) { _ in
            print("   Product added to favorities callback")
}
  1. Product remove from Favorites
sdk.track(event: .productRemovedToFavorities(id: "123")) { _ in
            print("   Product removed from favorities callback")
}
  1. Product add to Cart
sdk.track(event: .productAddedToCart(id: "123")) { _ in
    print("   Product added to cart callback")
}
  1. Product remove from cart
sdk.track(event: .productRemovedFromCart(id: "123")) { _ in
    print("   Product removed from cart callback")
}
  1. Syncronize cart
sdk.track(event: .syncronizeCart(ids: ["1", "2"])) { _ in
    print("   Cart syncronized callback")
}
  1. 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.