Experience Module iOS SDK Integration

Experience Module iOS SDK Integration

iOS SDK

Dengage iOS SDK for sending visitor behavior and rendering product recommendations.


Important warning

ProductView, Basket Add/Remove, View Basket, Purchase and Click events must match productId.

Introduction

This tutorial provides a very simple and quick introduction to the Dengage integration for iOS applications by walking you through details of different events.

To see sample application using iOS SDK, please check iOS SDK repository.


Event Types

Dengage uses different event types for different visitor actions. You can define following events by using Dengage iOS SDK:

EventDescriptionEvent Name
PageIt is sent when a visitor views a pagePAGE_VIEW
ProductIt is sent when a visitor views a productPRODUCT_VIEW
BasketIt is sent when a visitor makes a basket action (add product to basket or remove product from basket)BASKET_OPERATIONS
CheckoutIt is sent when a visitor makes a checkout action (views basket, enter customer information, enter payment information, finishes purchase)CHECKOUT
UserIt is sent when a visitor makes a user action or use this event to update information about customersUSER_OPERATIONS
CustomIt is sent when to identify any visitor action that has no predefined value in DengageCUSTOM_EVENT
InteractionIt is sent when a visitor makes an interaction like click, view a widget, submit, etc.INTERACTION
SearchIt is sent when a visitor makes a search action like clicking a search input or typing words on the search inputSEARCH

API Errors

If your request body has a field statusCode, then you have an error in your request. Details of errors are given in below table:

Error CodeDescription
NO_API_KEYYour request doesn't have an apiKey parameter, please provide apiKey parameter at the request with your account's unique api key.
NO_ACCOUNT Given api key is not associated with a Dengage account, please check your api key value.
UNVERIFIED_ACCOUNTAccount associated with api key is not a verified account. To verify your account, please check your email and verify it.
FAILED_ACCOUNTAccount associated with api key is not an active account. Please contact with support team to re-activate your account.
NO_DOMAIN_APIKEY_MATCHEach Dengage account is associated with a domain. Please check your domain and provide at requests with header Origin. Check Reqeust Details for required headers.
UNVERIFIED_ACCOUNTAccount associated with api key is not a verified account. To verify your account, please check your email and verify it.
NO_EVENTThere is no events inside request body. You should add at least one event with each request.
NO_USERIDEach Dengage event should have an userId parameter, and at least one event in the request lacks this parameter.
NO_SESSIONIDEach Dengage event should have an sessionId parameter, and at least one event in the request lacks this parameter.
BAD_INPUTYour request body should be a json array of Dengage events. It is malformed, please check your json object for validity.

Common Parameters

Every event in Dengage shares common parameters and you can add these parameters to all events that will be defined later.

Details of common parameters for events are given below:

NameTypeDescriptionExample
Event
(name)
MandatoryName of the event. Use one name from Event Types'PAGE_VIEW' or 'CHECKOUT'
User ID
(userId)
MandatoryUnique id of the user. Please check User & Session Management for creating unique key for the user/visitor. You should send same key for every event of same user and this id must be unique among other users'USER_1234567890'
Session ID
(sessionId)
MandatoryUnique id of the user session. Please check User & Session Management for creating unique key for the user/visitor session. You should send same key for every event of same user session and this id must be unique among other sessions'SESSION_1234567890'
Language
(lang)
OptionalType of current visitor's language.Contact us for other languages.
Default languages :
- 'TR'
- 'EN'
- 'FR'
- 'DE'
'FR'
Region
(region)
OptionalType of current visitor's region.'EU'
Currency
(currency)
OptionalCurrency of product price. Must be in Short Format. If not given, account's currency will be used for the product
'EUR'
Page Url
(pageUrl)
OptionalUrl of the current page which the event is generated'https://www.exampleshop.com/example-product-1/'
Test Mode
(testMode)
OptionalTest Mode Flag. If event is set to test mode, it will be only processed by campaigns in test mode and discarded in reports. Possible values are 'true' or 'false''false'

Basic Configuration

Dengage accounts have two important system variables used in integration: APP KEY and Data Center. You can access these values from Integrations menu of Dengage Panel:

System VariableDescription
App Keyunique Dengage key value to send events
Data Centerdata center end point to send Dengage events

To access Integrations menu of Dengage Panel, please login to your Dengage account and navigate to Settings > Integrations.

Dengage uses podfile for integration into the project. Inside your Xcode project's root folder run the following commands.

- Run pod init to create an empty pod file
- Run pod install to add Cocoapods to your project
- Run open YourProject.xcworkspace to your new Xcode project's workspace.

After, import Segmentify must be defined in AppDelegate.swift and in required classes..

Dengage iOS SDK requires App key, Subdomain and Data Center URL to establish a connection.

Define configuration method in AppDelegate.swift file.

Example configuration is given below:

SegmentifyManager.config(
  appkey: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX, 
  dataCenterUrl: https://xxx.segmentify.com“, 
  subDomain: example.com
  )

If you do not want console log to be visible, define it as false.

let _ = SegmentifyManager.logStatus(isVisible: true)

You can use the following command to set new configs

SegmentifyManager.setConfig(apiKey: newApiKey, dataCenterUrl: newDataCenterUrl, subDomain: newDomain)

An empty array of type RecommendationModel is required where the products to be suggested are stored within any view controller.

Example;

var recommendations : [RecommendationModel] = []

The response will be stored in this array as the response.

Basic response method for spesific event;

SegmentifyManager.sharedManager(
  appKey: appKey, 
  dataCenterUrl: dataCenterUrl, 
  subDomain: subDomain).setPageViewEvent(
    SegmentifyObject: obj, 
    callback: { (response: [RecommendationModel]) in
    self.recommendations = response
    //for example to process on recommendations
    self.createProducts(recommendations: self.recommendations)
})

Callback returns as a one-dimensional array. Optional operation on the array can be done to show it in the UI. Widget View is used when the page's widget is actually displayed. Related title: Interaction

func createProducts(recommendations : [RecommendationModel]) {
  for recObj in recommendations {
    if recObj.instanceId == "YOUR_CAMPAIGN_INSTANCE_ID" {
      // to show details of the products in the UI
      self.setProductInfos(products: recObj.products!)

    }
  }
}

Page View

When a visitor views a view controller, this event should be sent.

Parameters can be sent with page view event is given below (you can also add common parameters):

NameTypeRequirementDescriptionExample
Category
(category)
StringMandatoryCategory of the Page. Predefined values for Dengage are:
- Home Page
- Product Page
- Category Page
- Basket Page
- Checkout Page
- Search Page
- 404 Page
'Product Page'
Sub Category
(subCategory)
StringOptionalSub-category of the page. It is used to enhance information about product and category pages.
Example: For a sports category listing page, page category should be 'Category Page' and sub category should be 'Men>Shoes>Sports'
 'Men>Shoes>Sports'

An example Page View request is given below:

//define page view object
let obj = PageModel()
obj.category = "Home Page"
obj.lang = "EN"
obj.region = "EU"
//send page view request
SegmentifyManager.sharedManager().sendPageView(segmentifyObject: obj) { 
  (response: [RecommendationModel]) in
 self.recommendations = response
 //operations about recommendations
}

An example of parameterized use as an alternative;

//send page view request
SegmentifyManager.sharedManager().sendPageView(
  category: "Home page", subCategory: String?) {
    (response: [RecommendationModel]) in

}

Search View

When a visitor wants to search products, this event should be sent.

There are two search type before search input and after search input. Before search input module works until the search is done. After search input starts working after searching. These recommendations are updated after minimum characters written in the search bar. Minimum character count presents in the campaign that is in search request response.

Parameters can be sent with search event is given below (you can also add common parameters):

NameTypeRequirementDescriptionExample
Query
(query)
StringOptionalTyped words for searching products. Should be empty or null for before search.'Dress'

An example search view request is given below:

    //define search view object
    let searchViewObj = SearchPageModel()
    searchViewObj.query = "Dress"
    searchViewObj.lang = "EN"
    searchViewObj.region = "EU"
    //send search view request
    SegmentifyManager.sharedManager().sendSearchPageView(segmentifyObject: searchViewObj){
        (response: SearchModel) in
        self.response = response
        //operations about search
    }

Search Response Details

SearchModel has five objects: products for product list, campaign for search campaign details, errorString in case of an error, instanceId and interactionId for action identity.

SearchModel

NameTypeDescription
campaign
SearchCampaignModel?Search Campaign object.
products
[ProductRecommendationModel]?Products for product list.
errorString
String?Error message in case of unexpected results.
instanceId
String?Campaign instanceId. It will be used on events.
interactionId
String?Identity of the action.

SearchCampaignModel

NameTypeDescription
instanceId
String?Campaign instanceId. It will be used on events.
name
String?Campaign name.
status
String?campaign status like ACTIVE/TEST
devices
String?Available device list.
searchDelay
Int?delay for calling search event.
minCharacterCount
Int?min character count in input to call search event.
searchUrlPrefix
String?search url prefix of website
mobileItemCount
Int?max product count to be displayed
stringSearchAssetTextMap
[String:SearchAssetTextModel]language based map of titles

SearchAssetTextModel

NameTypeDescription
popularProductsText
String?title for popular products on cold start.
mobileCancelText
String?title for cancel button.
notFoundText
String?title for no result.

Product View

When a visitor views a product, this event should be sent.

If product is also inside a page, don't forget to send a page view event with category 'Product Page' and subCategory product's category too.

Parameters can be sent with product view event is given below (you can also add common parameters):

NameTypeRequirementDescriptionExample
Product ID
(productId)
StringMandatoryUnique id of the product'EXAMPLE_PRODUCT_1'
Title
(title)
StringMandatoryName/Title of the product 'EXAMPLE PRODUCT'
Stock
(inStock)
BoolOptionalProduct’s stock status - either true or false. If not given it is assumed to be in stock ('true')'true'
Url
(url)
StringMandatoryCanonical url of the product'https://www.exampleshop.com/example-product-1/'
Mobile Url
(mUrl)
String Optionalmobile specific url for the product'https://m.exampleshop.com/example-product-1/'
Image
(image)
StringMandatorymain image url to be used in product recommendations'https://cdn.exampleshop.com/example-product-1.png'
Image X-Small
(imageXS)
StringOptionalvery small image url to be used in product recommendations'https://cdn.exampleshop.com/example-product-1-xs.png'
Image Small
(imageS)
StringOptionalsmall image url to be used in product recommendations'https://cdn.exampleshop.com/example-product-1-small.png'
Image Medium
(imageM)
StringOptionalmedium image url to be used in product recommendations'https://cdn.exampleshop.com/example-product-1-medium.png'
Image Large
(imageL)
StringOptionallarge image url to be used in product recommendations'https://cdn.exampleshop.com/example-product-1-large.png'
Image X-Large
(imageXL)
StringOptionalvery large image url to be used in product recommendations'https://cdn.exampleshop.com/example-product-1-xl.png'
Category
(category)
StringMandatoryHierarchical category of the product'Men > Sports > Shoes'
Brand
(brand)
StringOptionalBrand of the product'EXAMPLE BRAND'
Price
(price)
NSNumber MandatoryPrice of the product, must be numeric349.99
Old/Sales Price
(oldPrice)
NSNumberOptionalPrice of the product before sales449.99
Currency
(currency)
String OptionalCurrency of product price. Must be in Short Format. If not given, account's currency will be used for the product'EUR'
Gender
(gender)
OptionalGender of the product. Possible values are 'M', 'F', 'U''M'
Colors
(colors)
Array type StringOptionalDifferent color options of the product. Must be in array format['black', 'red', 'blue']
Sizes
(sizes)
Array type String Optional Different size options of the product. Must be in array format['small', 'medium', 'large']
Labels
(labels)
Array type StringOptionalCustom labels associated with the product. You can use these labels to filter products in the recommendations. Must be in array format['top-seller', 'new-comer']
noUpdate
(noUpdate)
BoolOptionalnoUpdate must be defined as "true" in order not to disturb the products.'true'

An example product view request is given below:

// START Page view request
// define page model object
let pageObj = PageModel()
pageObj.category = "Product Page"

// send page view request
SegmentifyManager.sharedManager().sendPageView(segmentifyObject: pageObj) { 
  (response: [RecommendationModel]) in

}
// END Page view request

//START Product view request
//define product model object
let ProductObj = ProductModel()
ProductObj.title = "Asymmetric Dress in Black"
ProductObj.category = "Womenswear"
ProductObj.image = "//cdn.shopify.com/s/files/1/1524/5822/products/2014_11_17_Lana_Look034_02_300x300.jpg?v=1475497696"
ProductObj.url = "https://segmentify-shop.myshopify.com/products/asymmetric-dress-black"
ProductObj.inStock = true
ProductObj.brand = "Amelia Toro"
ProductObj.price = 578
ProductObj.productId = "25799860937"
ProductObj.noUpdate = true

//send product view request 
SegmentifyManager.sharedManager().sendProductView(segmentifyObject: ProductObj) { 
  (response: [RecommendationModel]) in
  self.recommendations = response
    //operations about recommendations
}
//END Product view request

An example of parameterized use as an alternative;

//START Page View  request
//define page model object
let pageObj = PageModel()
pageObj.category = "Product Page"

//send page view request
SegmentifyManager.sharedManager().sendPageView(segmentifyObject: pageObj) { 
  (response: [RecommendationModel]) in

}
//END Page View request


//send product view request 
SegmentifyManager.sharedManager().sendProductView(
  productID : "25799860937", 
  title : "Asymmetric Dress in Black", 
  category : "Womenswear", 
  price : 578, 
  brand : "Amelia Toro", 
  stock : true, 
  url: "https://segmentify-shop.myshopify.com/products/asymmetric-dress-black", 
  image: "//cdn.shopify.com/s/files/1/1524/5822/products/2014_11_17_Lana_Look034_02_300x300.jpg?v=1475497696") { 
    (response: [RecommendationModel]) in
      self.recommendations = response
        //operations about recommendations
}

Basket Operations

Dengage uses basket operations as intermediary step for measuring success of recommendations throughout the conversion funnel. Basket success rate is also reported by Trendify and Bannerify to show individual performance of products, categories, brands and banners.

Basket operations are similar to page view and product view. There are two possible steps in a basket operation these are: add product to basket, remove product from basket.

Add Product to Basket

When a visitor adds a product to basket/cart, this event should be sent.

An example request is given below:

//Define basket operations model
let addBasketObj = BasketModel()
  addBasketObj.step = "add"
  addBasketObj.productId = "25800400265"
  addBasketObj.quantity = "2"
  addBasketObj.price = 358

//Send add to basket event 
  SegmentifyManager.sharedManager().sendAddOrRemoveBasket(segmentifyObject: addBasketObj)

An example of parameterized use as an alternative;

//Send add to basket event 
  SegmentifyManager.sharedManager().sendAddOrRemoveBasket(basketStep : "add", productID : "25800400265", quantity : 2,price : 358)

Remove Product from Basket

When a visitor removes a product from basket/cart, this event should be sent.

An example request is given below:

//Define basket operations model    
let removeBasketObj = BasketModel()
removeBasketObj.productId = "25799860937"
removeBasketObj.price = 578
removeBasketObj.quantity = "1"
removeBasketObj.step = "remove"

//Send remove from basket request  
SegmentifyManager.sharedManager().sendAddOrRemoveBasket(segmentifyObject: obj)

An example of parameterized use as an alternative;

//Send add to basket event 
  SegmentifyManager.sharedManager().sendAddOrRemoveBasket(basketStep : "remove", productID : "25800400265", quantity : 2,price : 358)

Basket Event Parameters

Parameters can be sent with basket operations event is given below (you can also add common parameters):

NameTypeRequirementDescriptionValues
Basket Step
(step)
StringMandatory Basket operation type. Can be either 'add' or 'remove' 'add'
Product ID
(productId)
StringMandatoryUnique id of the product. Must match with product ids sent with product view event'EXAMPLE_PRODUCT_1'
Price
(price)
NSNumberOptionalPrice of the product in the basket. If not given, price of the product in product catalogue will be assumed349.99
Currency
(currency)
StringOptionalCurrency of product price. Must be in Short Format. Currency of the product is used if not given 'EUR'
QuantityStringOptionalNumber of items added to basket at this operation. If not given, it is assumed 1. You can also use decimals for not integer quantities like 2.31

Checkout Operations

Dengage uses checkout operations to measure success of recommendations throughout the conversion funnel. Checkout information and steps are also used in email & personalization campaigns. Campaign, Trendify, Bannerify and Sales reports are feed from checkout information. It is essential for both analyitcs and recommendation capabilities to function properly.

Dengage track four different steps of checkout operation:

Operation StepDetails
View BasketbasketWhen customer views the basket page. Some online stores has dedicated basket pages, others have basket detail pop-ups. For both use cases we recommend you to send checkout event with basket details. To see details, please click
Customer InformationcustomerThis is the second step on checkout funnel. When customer is entering his personal information details, this event should be send to Dengage. To see details, please click
Payment InformationpaymentWhen customer is on payment stage of checkout funnel, you should send this event to Dengage.To see details, please click
Purchase/SuccesspurchaseFinal step of checkout funnel is purchase and Dengage uses this step as success indicator for recommendations. Reports for campaigns (both recommendation and engagement), sales analysis and real-time analtyics are dependent to this event and shoukd be implemented with great care. To see details, please click

View Basket

View Basket is the first step of checkout funnel, and followed by Customer Information.

When a visitor views his/her basket/cart, this event should be sent with basket details.

An example request is given below:

//START Page view request
let pageObj = PageModel()

SegmentifyManager.sharedManager().sendPageView(segmentifyObject: pageObj) { (response: [RecommendationModel]) in

}
//END Page view request

//START Basket View Request
var productsArray = [Any]()
let firstProduct = ["price":"78","productId":"25799809929","quantity":"1"]

productsArray.append(firstProduct)

let checkoutObj = CheckoutModel()
checkoutObj.productList = productsArray
checkoutObj.totalPrice = 78

SegmentifyManager.sharedManager().sendViewBasket(segmentifyObject: checkoutObj) { (response: [RecommendationModel]) in
  self.recommendations = response
  //operations about recommendations
}
//END Basket View Request

An example of parameterized use as an alternative;

//START Page view request
let pageObj = PageModel()

SegmentifyManager.sharedManager().sendPageView(segmentifyObject: pageObj) { (response: [RecommendationModel]) in

}
//END Page view request

//START Basket View Request
var productsArray = [Any]()
let firstProduct = ["price":"78","productId":"25799809929","quantity":"1"]

productsArray.append(firstProduct)

SegmentifyManager.sharedManager().sendViewBasket(totalPrice: 78, productList: productsArray) { (response: [RecommendationModel]) in
  self.recommendations = response
  //operations about recommendations
}
//END Basket View Request

Customer Information

Customer Information is the second step of checkout funnel, and preceeded by View Basket & followed by Payment Information.

When a visitor enters customer information as second step of checkout funnel, this event should be sent with basket details.

An example request is given below:

//START Page view request
let pageObj = PageModel()

SegmentifyManager.sharedManager().sendPageView(segmentifyObject: pageObj) { (response: [RecommendationModel]) in

}
//END Page view request

//START Customer information request
var productsArray = [Any]()
let firstProduct = ["price":"78","productId":"25799809929","quantity":"1"]

productsArray.append(firstProduct)

let custInfObj = CheckoutModel()
custInfObj.productList = productsArray
custInfObj.totalPrice = 78

SegmentifyManager.sharedManager().sendCustomerInformation(segmentifyObject: custInfObj) { (response: [RecommendationModel]) in
self.recommendations = response
//operations about recommendations 
}
//END Customer information request

An example of parameterized use as an alternative;

//START Page view request
let pageObj = PageModel()

SegmentifyManager.sharedManager().sendPageView(segmentifyObject: pageObj) { (response: [RecommendationModel]) in

}
//END Page view request

//START Customer information request
var productsArray = [Any]()
let firstProduct = ["price":"78","productId":"25799809929","quantity":"1"]

productsArray.append(firstProduct)

SegmentifyManager.sharedManager().sendCustomerInformation(totalPrice: 78, productList: productsArray) { (response: [RecommendationModel]) in
self.recommendations = response
//operations about recommendations 
}
//END Customer information request

Please refer to View Basket Step of Checkout for basket products detail and use the same information throughout the purchase funnel by only changing step information.

Payment Information

Payment Information is the third step of checkout funnel, and preceeded by Payment Information & followed by Purchase/Success.

When a visitor enters payment information as third step of checkout funnel, this event should be sent with basket details.

An example request is given below:

//START Page view request
let pageObj = PageModel()

SegmentifyManager.sharedManager().sendPageView(segmentifyObject: pageObj) { (response: [RecommendationModel]) in

}
//END Page view request

//START Payment information request
//example array
var productsArray = [Any]()
let firstProduct = ["price":"78","productId":"25799809929","quantity":"1"]

//append product to example array
productsArray.append(firstProduct)

//define a variable type of CheckoutModel        
let paymentInf = CheckoutModel()
paymentInf.totalPrice = 78
paymentInf.productList = productsArray

//payment information request
SegmentifyManager.sharedManager().sendViewBasket(segmentifyObject: paymentInf) { (response: [RecommendationModel]) in
self.recommendations = response
//operations about recommendations 
}
//END Payment information request

An example of parameterized use as an alternative;

//START Page view request
let pageObj = PageModel()

SegmentifyManager.sharedManager().sendPageView(segmentifyObject: pageObj) { (response: [RecommendationModel]) in

}
//END Page view request

//START Payment information request
//example array
var productsArray = [Any]()
let firstProduct = ["price":"78","productId":"25799809929","quantity":"1"]

//append product to example array
productsArray.append(firstProduct)

//Send user register request
SegmentifyManager.sharedManager().sendPurchase(totalPrice: 78, productList: productsArray, orderNo: 1234) { (response: [RecommendationModel]) in
self.recommendations = response
//operations about recommendations 
}
//END Payment information request

Please refer to View Basket Step of Checkout for basket products detail and use the same information throughout the purchase funnel by only changing step information.

Purchase/Success

Purchase/Success is the fourth and final step of checkout funnel, and preceeded by Payment Information.

When a visitor finalizes a purchase, this event should be sent with basket details.

An example request is given below:

//START Page View     
let pageViewObj = PageModel()
pageViewObj.category = "Purchase Success Page"
//send page view request
SegmentifyManager.sharedManager().sendPageView(segmentifyObject: obj) { (response: [RecommendationModel]) in

}
//END Page View

//START Purchase Success request
var productsArray = [Any]()
let firstProduct = ["price":"78","productId":"25799809929","quantity":"1"]

productsArray.append(firstProduct)

let purchaseObj = CheckoutModel()
purchaseObj.productList = productsArray
purchaseObj.totalPrice = 78
purchaseObj.orderNo = "12313"

//Puchase success request
SegmentifyManager.sharedManager().sendPurchase(segmentifyObject: purchaseObj) { (response: [RecommendationModel]) in
  self.recommendations = response
  //operations about recommendations 
}
//END Purchase Success request

An example of parameterized use as an alternative;

//START Page view request
let pageObj = PageModel()

SegmentifyManager.sharedManager().sendPageView(segmentifyObject: pageObj) { (response: [RecommendationModel]) in
}
//END Page view request

//START Purchase Success request
//example array
var productsArray = [Any]()
let firstProduct = ["price":"78","productId":"25799809929","quantity":"1"]

//append product to example array
productsArray.append(firstProduct)

//Send user register request
SegmentifyManager.sharedManager().sendPayment(totalPrice: 78, productList: productsArray, orderNo: 1234) { (response: [RecommendationModel]) in
self.recommendations = response
//operations about recommendations 
}
//END Purchase Success request

Please refer to View Basket Step of Checkout for basket products detail and use the same information throughout the purchase funnel by only changing step information.

Checkout Parameters

Detailed explanation for each parameter is given below:

NameTypeDescriptionExample
Checkout Step
(step)
StringMandatoryIdentifies which step of the checkout funnel. Each step has different meaning and use it accordingly
Total Price/Amount
(totalPrice)
NSNumberMandatoryTotal amount of the basket including taxes, shipping costs and also discounts
Currency
(currency)
StringOptionalCurrency of the total amount of the basket. Must be in Short Format. If not given, currency of the account is used
Order No
(orderNo)
StringOptionalYour unique id of the order. Send this value only for purchase/succeess step and you can access to this id on sales report
Cart Url
(cartUrl)
StringOptionalPermalink for accessing basket at later stages. Should be used for view basket, customer information and payment information steps of checkout. This url can be used at engagement campaigns like cart abondonment reminders. Customers will be informed with this url with out-bound channels like email and push messages. If not given, account's default cart url will be used (which can be adjusted from account settings in panel)
ProductsArray type AnyMandatoryList of products inside the basket. Must be in array format. Details are given at product parameters

Basket Product Parameters

Each product inside the basket can be defined with following parameters. See Checkout Parameters for defining checkout operation in which basket product is also defined.

NameTypeRequirementDescriptionExample
Product ID
(productId)
StringMandatoryUnique id of the product'EXAMPLE_PRODUCT_1'
PriceNSNumberOptionalPrice of the product in the basket. If not given, price of the product in the product catalogue will be used349.99
CurrencyStringOptionalCurrency of product price. Must be in Short Format. If not given, currency of the product in the product catalogue will be used 'EUR'
QuantityStringOptionalNumber of items from current product in the basket. If not given, it is assumed to be 11

User/Visitor Operations

Dengage tracks important user operations like sign-up/register, sign-in/login, sign-out/logout and also you can share your customer's information with Dengage by sending an update event.

Important warning

The userid must be used for the unification operation on all channels in the same userId. See the success department for the web side

There are 4 possible user/visitor operations:

  1. User Register/Sign-up: It should be sent when a visitor signed up to your website.
  2. User Login/Sign-in: It should be sent when a registered user logins to your website.
  3. User Logout/Sign-out: It should be sent when a registered user logouts from your website.
  4. User Update: It should be sent when you want to share registered user's information (ex: name, email, phone number, etc.) with Dengage. These information can be used at campagin templates to customize message or email address is used for email out-bound campaigns like abandoned cart reminders.

New User

When a visitor registers (sign-up) to your website, you should send a new user event.

If you want to share details of an already registered user with Dengage, please use User Update.

Details of parameters of new user is given below:

NameTypeRequirementDescriptionExample
User Operation
(step)
StringMandatoryIdentifies which operation is taken for current user/customer. Each operation has differen meaning and use it accordingly'signup'
Username
(username)
StringMandatoryUnique identifier for the customer'johndoe'
Full Name
(fullName)
 StringOptionalFull name of the customer. 'John Doe'
Email
(email)
 StringOptional
(Mandatory for using email module)
Email address of the customer 'john.doe@exampleshop.com'
Mobile Phone
(phone)
StringOptionalMobile phone number of the customer '+1 555 555 5555'
Is Login
(isLogin)
BoolOptionalLogin information of the usertrue
Is Registered
(isRegistered)
BoolOptionalRegister information of the customertrue
Gender
(gender)
StringOptionalGender of the customer. Must be either 'M' or 'F' 'M'
Age
(age)
StringOptionalAge of the customer. Must be numeric. Either use age or birthdate 27
Birthdate
(birthdate)
StringOptionalBirthdate of the customer. Must be in format 'DD.MM.YYYY'. Either use age or birthdate '23.01.1980'
Membership Date
(memberSince)
StringOptionalMembership date of the customer. Must be in format 'DD.MM.YYYY' '20.01.2014'
Location
(location)
StringOptionalLocation of the customer 'New York'
Customer Segments
(segments)
Array type StringOptionalSegments of the customer. Must be in array format ['SEGMENT 1', 'SEGMENT 2']

An example request is given below:

//Create new user Object
let newUserObj = UserModel()
//Define user object's username and email 
newUserObj.username = "Segmentify"
newUserObj.email = "example@Segmentify.com"

//Send user register request
SegmentifyManager.sharedManager().sendUserRegister(segmentifyObject: newUserObj)

An example of parameterized use as an alternative;

//Send user register request
segmentifyManager.sharedManager().sendUserRegister(username: "segmentify", fullName: "Segmentify User", email: "example@Segmentify.com", mobilePhone: "123456789", gender: "Male/Female", age: "4", birthdate: "04/2014")

User Login

When a registered customer logins (sign-in), a user login event should be sent to Dengage.

Details of parameters of user login is given below:

NameTypeRequirementDescriptionExample
User Operation
(step)
StringMandatoryIdentifies which operation is taken for current user/customer'signin'
UsernameStringMandatoryUnique identifier for the customer'johndoe'

An example request is given below:

//Create  user Object
let UserObj = UserModel()
//Define user object's username and email 
UserObj.username = "Segmentify"
UserObj.email = "example@Segmentify.com"

//Send user login request
SegmentifyManager.sharedManager().sendUserLogin(segmentifyObject: UserObj)

An example of parameterized use as an alternative;

//Send user login request
SegmentifyManager.sharedManager().sendUserLogin(username: "Segmentify", email: "example@segmentify.com")

User Logout

When a registered customer logouts (sign-out), a user logout event should be sent to Dengage.

Details of parameters of user logout is given below:

NameTypeRequirementDescriptionExample
User Operation
(step)
StringMandatoryIdentifies which operation is taken for current user/customer'signout'
UsernameStringMandatoryUnique identifier for the customer'johndoe'

An example request is given below:

/Create  user Object
let UserObj = UserModel()
//Define user object's username and email 
UserObj.username = "segmentify"
UserObj.email = "example@segmentify.com"

//Send user logout request
SegmentifyManager.sharedManager().sendUserLogout(segmentifyObject: UserObj)

An example of parameterized use as an alternative;

//Send user logout request
SegmentifyManager.sharedManager().sendUserLogout(username: "Segmentify", email: "example@segmentify.com")

User Update

When you want to share an already registered customer information, provide details of the customer by sending an user update event. You can use both this integration for both frequently updating user information and instant updates when customer updates his/her personal information.

If you want to share a new registered user with Dengage, please use New User.

Details of parameters of user update is given below:

NameTypeRequirementDescriptionExample
User Operation
(step)
StringMandatoryIdentifies which operation is taken for current user/customer. Each operation has differen meaning and use it accordingly'update'
Username
(username)
StringMandatoryUnique identifier for the customer'johndoe'
Full Name
(fullName)
StringOptionalFull name of the customer. 'John Doe'
Email
(email)
StringOptional
(Mandatory for using email module)
Email address of the customer 'john.doe@exampleshop.com'
Mobile Phone
(phone)
 StringOptionalMobile phone number of the customer '+1 555 555 5555'
Gender
(gender)
StringOptionalGender of the customer. Must be either 'M' or 'F' 'M'
Age
(age)
StringOptionalAge of the customer. Must be numeric. Either use age or birthdate 27
Birthdate
(birthdate)
StringOptionalBirthdate of the customer. Must be in format 'DD.MM.YYYY'. Either use age or birthdate '23.01.1980'
Membership Date
(memberSince)
StringOptionalMembership date of the customer. Must be in format 'DD.MM.YYYY' '20.01.2014'
Location
(location)
StringOptionalLocation of the customer 'New York'
Customer Segments
(segments)
Array type StringOptionalSegments of the customer. Must be in array format [ 'SEGMENT 1', 'SEGMENT 2' ]
Is Registered Flag
(isRegistered)
BoolOptionalThis is an advanced parameter, use cautiously. If you want to change user's register status without sending a register event, use this flag. Value is either 'true' or 'false''true'
Is Login Flag
(isLogin)
BoolOptionalThis is an advanced parameter, use cautiously. If you want to change user's login status without sending a login/logout event, use this flag. Value is either 'true' or 'false''true'

An example request is given below:

//Create new user Object
let UserObj = UserModel()
//Define user object's username and email 
UserObj.username = "Segmentify"
UserObj.email = "example@segmentify.com"

//Send user update request
SegmentifyManager.sharedManager().sendUserRegister(segmentifyObject: UserObj)

An example of parameterized use as an alternative;

//Send user update request
DegmentifyManager.sharedManager().sendUserUpdate(username : "Segmentify", fullName : "Segmentify Test", email : "example@segmentify.com", mobilePhone : "123456789", gender : "Male/Female", age : "4", birthdate : "04/2014", isRegistered : true, isLogin : false)

User Change

This event is used when userid wants to be changed.

let userObj = UserChangeModel()
userObj.userId = "XXXXXXXXXXX"
SegmentifyManager.sharedManager().sendChangeUser(SegmentifyObject: userObj)

Custom Event

This integration enables any event & data important for you to be tracked by Dengage and become actionable. With this integration, you can send any non standard events & data to Dengage, and gives endless opportunities to track and take actions to your visitor's behaviour.

Details of parameters of custom event is given below:

NameTypeRequirementDescriptionExample
Type
(type)
StringMandatoryType of the event. You should use same type for same events'my_custom_event'
Custom Parameters
(params)
DictionaryOptionalCustom parameters of the event. Must be in map format.'{"field1":"value1", "field2":"value2"}'

An example request is given below:

//Config for Segmentify manager
SegmentifyManager.config(appkey: Constant.segmentifyApiKey, dataCenterUrl: Constant.segmentifyDataCenterUrl, subDomain: Constant.segmentifySubDomain)

//START Custom Event Request
let customObj = CustomEventModel()
let paramDict = ["PRICE":"200-500"]
customObj.type = "test"
customObj.params = paramDict as [String : AnyObject]

SegmentifyManager.sharedManager().sendCustomEvent(segmentifyObject: customObj) { (response: [RecommendationModel]) in
  self.recommendations = response
  //operations about recommendations 
}
//END Custom Event Request

Interaction

Dengage needs to be thrown to use the information from widgets.

Widget View

Widget View is used when the page's widget is actually displayed.

NameTypeRequirementDescriptionExample
instanceId
StringMandatoryIdentity of the campaignscn_6186a632e0d76001
interactionId
StringMandatoryIdentity of the actionact_6185c1e624ab0000
if recObj.instanceId == "scn_61869cb94553e000" { // recObj is the recomendationModel object returned from the productView event
  //Any actions related to product's
  self.interactionId = recObj.interactionId
  self.impressionId = recObj.instanceId
  SegmentifyManager.sharedManager().sendWidgetView(instanceId: self.impressionId!, interactionId: self.interactionId!)
}

Click

It is necessary to notify the product productId and which campaign it belongs to when it is clicked on a product in any recommendation.

NameTypeRequirementDescriptionExample
instanceId
StringMandatoryIdentity of the campaigninstanceId = "scn_6186a632e0d76001"
interactionId
StringMandatoryUnique id of the productinteractionId = "25803234569"
SegmentifyManager.sharedManager().sendClickView(instanceId: self.impressionId!, interactionId: productID)

Search Click

It is necessary to notify the productId when it is clicked on a product in any search result.

If identity of the campaign in search response is "BEFORE_SEARCH" then instanceId should be bs_product.

NameTypeRequirementDescriptionExample
instanceId
StringMandatoryIdentity of the product for before search inputinstanceId = "bs_product"
interactionId
StringMandatoryUnique id of the product for before search inputinteractionId = "123456789"

If identity of the campaign in search response is "SEARCH" then instanceId should be product.

NameTypeRequirementDescriptionExample
instanceId
StringMandatoryIdentity of the product for after search inputinstanceId = "product"
interactionId
StringMandatoryUnique id of the product for after search inputinteractionId = "123456789"
SegmentifyManager.sharedManager().sendClickView(instanceId: "product", interactionId: "123456789" )

Banners

Event Types and Definitions

EventDescriptionEvent Name
Banner OperationsEvents that should be sent when there is an interaction with the banner. It can be an impression, a click to the banner, or an update for banner information.BANNER_OPERATIONS
Banner Group ViewEvent that needs to be sent for the banner group uploaded to the page.BANNER_GROUP_VIEW
Internal Banner GroupThe event that feeds the active banner status in the relevant group and the information of these banners to the Dengage.INTERNAL_BANNER_GROUP

Parameters can be sent with banner operations event is given below (you can also add common parameters):

NameTypeRequirementDescriptionExample
Type
(type)
StringMandatoryBanner operation type. Can be 'impression', 'click' or 'update''impression'
Title
(title)
StringMandatoryTitle of the banner'Home Page Banner'
Group
(group)
StringMandatoryGroup of the banner'Home Page Banner - Group 1'
Order
(url)
NSNumber MandatoryOrder of the banner in the group1
Product ID
(productId)
String OptionalUnique id of the product'EXAMPLE_PRODUCT_1'
Category
(category)
StringOptionalHierarchical category of the product'Men > Sports > Shoes'
Brand
(brand)
StringOptionalBrand of the product'EXAMPLE BRAND'
Label
(label)
StringOptionalCustom label associated with the banner.'top-seller'
// Banner impression event
let bannerImpressionOperationModel = BannerOperationsModel()
bannerImpressionOperationModel.type = "impression"
bannerImpressionOperationModel.title = "Gorgeous Duo T-Shirt & Trousers"
bannerImpressionOperationModel.group = "Home Page Slider"
bannerImpressionOperationModel.order = 1
SegmentifyManager.sharedManager().sendBannerImpressionEvent(segmentifyObject: bannerImpressionOperationModel)

// Banner click event
let bannerClickOperationModel = BannerOperationsModel()
bannerClickOperationModel.type = "click"
bannerClickOperationModel.title = "Gorgeous Duo T-Shirt & Trousers"
bannerClickOperationModel.group = "Home Page Slider"
bannerClickOperationModel.order = 1
SegmentifyManager.sharedManager().sendBannerClickEvent(segmentifyObject: bannerClickOperationModel)

// Banner update event
let bannerUpdateOperationModel = BannerOperationsModel()
bannerUpdateOperationModel.type = "update"
bannerUpdateOperationModel.title = "Gorgeous Duo T-Shirt & Trousers"
bannerUpdateOperationModel.group = "Home Page Slider"
bannerUpdateOperationModel.order = 2
SegmentifyManager.sharedManager().sendBannerUpdateEvent(segmentifyObject: bannerUpdateOperationModel);

Parameters can be sent with banner group view event is given below (you can also add common parameters):

NameTypeRequirementDescriptionExample
Group
(group)
StringMandatoryGroup of the banner'Home Page Banner - Group 1'
// Banner Group View Model
let bannerGroupViewModel = BannerGroupViewModel()
bannerGroupViewModel.group = "Home Page Slider"

// optional parameters
var internalBannerViewArray = [InternalBannerModel]()
let internalBannerModel = InternalBannerModel()
internalBannerModel.title = "Gorgeous Duo T-Shirt & Trousers"
internalBannerModel.order = 1
internalBannerModel.image = "https://cdn.segmentify.com/demo/banner-img2.jpg"
internalBannerModel.urls = ["https://www.example.com/gorgeous-duo-tshirt-trousers"]

internalBannerViewArray.append(internalBannerModel)

let internalBannerModel2 = InternalBannerModel()
internalBannerModel2.title = "Ready to Renew"
internalBannerModel2.order = 2
internalBannerModel2.image = "https://cdn.segmentify.com/demo/banner-img1.jpg"
internalBannerModel2.urls = ["https://www.example.com/ready-to-renew"]

internalBannerViewArray.append(internalBannerModel2)
bannerGroupViewModel.banners = internalBannerViewArray
// optional parameters end

SegmentifyManager.sharedManager().sendBannerGroupViewEvent(segmentifyObject: bannerGroupViewModel)

Internal Banner Group

Parameters can be sent with banner group view event is given below (you can also add common parameters):

NameTypeRequirementDescriptionExample
Group
(group)
StringMandatoryGroup of the banner'Home Page Banner - Group 1'
Banners
(banners)
Array type AnyOptionalList of banners. Must be in array format. Details are given at banner details[banner1,banner2]
NameTypeRequirementDescriptionExample
Title
(title)
StringOptionalTitle of the banner'Home Page Banner'
Image
(image)
StringOptionalImage of the banner'https://example.com/image.jpg'
Order
(url)
NSNumber OptionalOrder of the banner1
Urls
(urls)
Array type AnyOptionalUrls of the banner[https://example.com/banner1]
// Banner Group View Model
let bannerGroupViewModel = BannerGroupViewModel()
bannerGroupViewModel.group = "Home Page Slider"

// optional parameters
var internalBannerViewArray = [InternalBannerModel]()
let internalBannerModel = InternalBannerModel()
internalBannerModel.title = "Gorgeous Duo T-Shirt & Trousers"
internalBannerModel.order = 1
internalBannerModel.image = "https://cdn.segmentify.com/demo/banner-img2.jpg"
internalBannerModel.urls = ["https://www.example.com/gorgeous-duo-tshirt-trousers"]

internalBannerViewArray.append(internalBannerModel)

let internalBannerModel2 = InternalBannerModel()
internalBannerModel2.title = "Ready to Renew"
internalBannerModel2.order = 2
internalBannerModel2.image = "https://cdn.segmentify.com/demo/banner-img1.jpg"
internalBannerModel2.urls = ["https://www.example.com/ready-to-renew"]

internalBannerViewArray.append(internalBannerModel2)
bannerGroupViewModel.banners = internalBannerViewArray
// optional parameters end

SegmentifyManager.sharedManager().sendBannerGroupViewEvent(segmentifyObject: bannerGroupViewModel)

Debugging Notes

On your application development phase debug logs can be enabled or disabled by following call, by default debug level logging is enabled

DsegmentifyManager.logStatus(isVisible: false)

    • Related Articles

    • Experience Module Integration For Mobile App

      Mobile App Integration ​ Segmentify can integrate with any mobile application and has following alternatives: iOS SDK: You can connect your iOS app to Dengage Experience Module by using native iOS SDK Android SDK: You can connect your Android app ...
    • Experience Module Android SDK Integration

      Android SDK¶ Dengage Android SDK for sending visitor behavior and rendering product recommendations. Supports Android 4.4 and higher devices. Important warning ProductView, Basket Add/Remove, View Basket, Purchase and Click events must match ...
    • Experience Module Custom Mobile Integration

      Custom Integration¶ Custom Integration (Backend Side) Guide and Restful API Beta This integration method is in beta and not recommended for frontend use. Please check other integration methods. Introduction¶ This tutorial provides a very simple and ...
    • Where can I see latest SDK version?

      The following link provides where the documentation is available for the SDK version. You can use the following links relevant to the technologies to see the required SDK version. IOS SDK Android SDK Huawei SDK React Native Cordova Flutter
    • IOS SDK Setup

      Requirements Dengage Integration Key iOS Push Cerificate iOS Device ( you must test on real device for notifications) A mac with latest Xcode Installation Dengage.Framework is available through CocoaPods. To install it, simply add the following line ...