Getting started with the iOS SDK

setup ConvertedIn iOS SDK so you can start to Know what your customers do before and after visiting your offline stores. Leverage data and learn what their behavior looks like.

Requirements

The ConvertedIn iOS SDK requires Xcode 10.1 or later and is compatible with apps targeting iOS 13 or above.

Installation

The iOS SDK is compatible with apps supporting iOS 13 and above. Apps can be written using Swift.

Getting started with the iOS SDK requires a few steps :

  1. Adding pod 'ConvertedInSDK' to your podfile.

  2. Initialize the SDK with your secret key by import ConvertedIn to your AppDelegate file

  3. Authenticate user by Sending user data for segmentation.

  4. Track user events

Step 1: Adding the dependency

Adding pod 'ConvertedInSDK' to your podfile, then execute pod install in terminal

pod 'ConvertedInSDK'

Step 2: Initialize the SDK

import convertedin to your AppDelegate file

import 'ConvertedIn'

then Initialize the - apikey - secretkey - applicationID

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
pinofferInit.apikey = "MF4K33RX2JM6MSH6R66FH37TSCGJ"
pinofferInit.secretKey = "e93ea6967d70cbbeb3d46a4554d58601"
pinofferInit.ApplicationID = "com.Pinoffer.app1WithframeWork"
return true
}

Step 3: Authenticate user by Sending user data for segmentation

func createNewUser() {
PinofferUser.getAuth()
let dataUser = ConfigUserData()
dataUser.id = "1114992092"
dataUser.name = "ehab ali"
dataUser.email = "ehab@pinoffer.com"
dataUser.birthday = "1988-4-11"
dataUser.gender = .male
dataUser.countryCode = .EG
dataUser.fcmToken = "FCM User Token"
PinofferUser.setUserData(userData: dataUser)
}

Step 4: Track user events

We have around 14 events that need to be implemented to be logged across the user's life cycle within the app. Here are the events

  • launch App.

  • Sign in.

  • Sign up.

  • Sign out.

  • Cart view.

  • View item.

  • Add item to cart.

  • Remove an item from the cart.

  • Transaction confirmation.

  • Search.

  • Promo redeemed.

  • Feedback.

You need to log the user events across the app by adding each event as follows:

launch App

Implement this event in your AppDelegate file to log whenever the user opens the app as follows:

Events.luanchApp()

Sign in

Implement this event after the user is successfully signed in as follows:

Events.signIn()

Sign up

Implement this event after the registration or signing in for the first time as follows:

Events.signUp()

Sign out

Implement this event after the user signs out as follows:

Events.signOut()

Cart view

Implement this event whenever the user views the Cart and pass the cart id as follows:

Events.viewCart(cartID: "12")

View item

Implement this event whenever the user views an item that can be added to the cart and pass the item id as follows:

Events.viewItem(itemID: "10")

Add item to cart

Implement this event whenever the user adds an item to the cart and pass the cart id and the item id as follows:

Events.addItem(itemID: "10", cartID: "12")

Remove item from cart

Implement this event whenever the user views the cart and pass the cart id as follows:

Events.removeItemFromCart(itemID: "10", cartID: "12")

Transaction confirmation

Implement this event after the user successfully completes payment and pass the order id and the cart id as follows:

Events.transactionConfirmation(cartID: "12", orderID: "09321")

Implement this event whenever the user searches for an item and pass the search query as follows:

Events.search(query: "Running Shoes")

Promo redeemed

Implement this event whenever the user redeems a promo code successfully and pass the promo string and it's valued as follows:

Events.promoRedeemed(promoCode: "100023312", amount: 99)

Order feedback

If you have implemented a feedback activity or you take the user's feedback in any form just log it bypassing the order id and the feedback questions and answers as follows:

func feedbackx(){
let fb = Setfeedback()
fb.orderID = 1
fb.note = "this is a note"
fb.feedbackList = [
feedBack(title: "Quality of the product", rate: 1),
feedBack(title: "Quality of sales team", rate: 2),
feedBack(title: "feed No 3", rate: 3),
feedBack(title: "feed No 4", rate: 4),
feedBack(title: "sfdfsd", rate: 5)
]
Events.orderFeedback(feed: fb)
}

in the Feedback rate the number 1: mean very bad rate the number 5: mean Excellent rate