Android SDK

Segmentify 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 productId.

Introduction

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

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

Integration

This guide will help you to integrate different events (visitor actions) and also product recommendations. Integration can be divided into following steps:


Event Types

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

Event Description Event Name
Page It is sent when a visitor views a page PAGE_VIEW
Product It is sent when a visitor views a product PRODUCT_VIEW
Basket It is sent when a visitor makes a basket action (add product to basket or remove product from basket) BASKET_OPERATIONS
Checkout It is sent when a visitor makes a checkout action (views basket, enter customer information, enter payment information, finishes purchase) CHECKOUT
User It is sent when a visitor makes a user action or use this event to update information about customers USER_OPERATIONS
Custom It is sent when to identify any visitor action that has no predefined value in Segmentify CUSTOM_EVENT
Interaction It is sent when a visitor makes an interaction like click, view a widget, submit, etc. INTERACTION
Search It is sent when a visitor makes a search action like clicking a search input or typing words on the search input SEARCH

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 Code Description
NO_API_KEY Your 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 Segmentify account, please check your api key value.
UNVERIFIED_ACCOUNT Account associated with api key is not a verified account. To verify your account, please check your email and verify it.
FAILED_ACCOUNT Account associated with api key is not an active account. Please contact with support team to re-activate your account.
NO_DOMAIN_APIKEY_MATCH Each Segmentify account is associated with a domain. Please check your domain and provide at requests with header Origin. Check Reqeust Details for required headers.
UNVERIFIED_ACCOUNT Account associated with api key is not a verified account. To verify your account, please check your email and verify it.
NO_EVENT There is no events inside request body. You should add at least one event with each request.
NO_USERID Each Segmentify event should have an userId parameter, and at least one event in the request lacks this parameter.
NO_SESSIONID Each Segmentify event should have an sessionId parameter, and at least one event in the request lacks this parameter.
BAD_INPUT Your request body should be a json array of Segmentify events. It is malformed, please check your json object for validity.

Common Parameters

Every event in Segmentify 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:

Name Type Description Example
Event
(name)
Mandatory Name of the event. Use one name from Event Types 'PAGE_VIEW' or 'CHECKOUT'
User ID
(userId)
Mandatory Unique 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)
Mandatory Unique 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)
Optional Type of current visitor's language.Contact us for other languages.
Default languages :
- 'TR'
- 'EN'
- 'FR'
- 'DE'
'FR'
Currency
(currency)
Optional Currency of product price. Must be in Short Format. If not given, account's currency will be used for the product
'EUR'
Page Url
(pageUrl)
Optional Url of the current page which the event is generated 'https://www.exampleshop.com/example-product-1/'
Test Mode
(testMode)
Optional Test 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

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

System Variable Description
App Key unique Segmentify key value to send events
Data Center data center end point to send Segmentify events

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

You can do it with an extended class from the application class as follows. (We recommend it)

package xxx;

import android.app.Application;
import  com.segmentify.segmentifyandroidsdk.SegmentifyManager;

public class MyApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        //SegmentifyManager.INSTANCE.config(this,apiKey,dataCenter,domain);
        SegmentifyManager.INSTANCE.config(this,"xxx-xxx-xxxx-xxxx-xxxxx","https://xxxx.segmentify.com","xxxx.com");
    }
}

You should add this class in AndroidManifest.xml

  android:name=".MyApplication"

You can use the following command to set new configs

SegmentifyManager.INSTANCE.setConfig("newApiKey","newDataCenterUrl","newDomain");

Basic response method for spesific event;

SegmentifyManager.INSTANCE.sendPageView(
  "Home Page", 
  null, 
  new SegmentifyCallback<ArrayList<RecommendationModel>>() {
    @Override
    public void onDataLoaded(ArrayList<RecommendationModel> data) {
      // parse recommendation results and render to the webpage
    }
  }
);

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

SegmentifyManager.INSTANCE.sendPageView(
  "Home Page", 
  null, 
  new SegmentifyCallback<ArrayList<RecommendationModel>>() {
    @Override
    public void onDataLoaded(ArrayList<RecommendationModel> data) {
      // parse recommendation results and render to the webpage

      // check if recommendations are active for this page 
      // and there is recommendations to be rendered
      if(data != null) {
        // loop through each recommendation
        for (int i = 0; i < data.size(); i++) {
          RecommendationModel recommendationMdl = data.get(i);

          // check for a specific campaign
          if(recommendationMdl.getInstanceId() == "scn_XXXXXXXXXXX") {
            // render recommendations
            ArrayList<ProductRecommendationModel> products = 
              recommendationMdl.getProducts();
          }
        }
      }
    }
  }
);

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):

Name Type Requirement Description Example
Category
(category)
String Mandatory Category of the Page. Predefined values for Segmentify are:
- Home Page
- Product Page
- Category Page
- Basket Page
- Checkout Page
- Search Page
- 404 Page
'Product Page'
Sub Category
(subCategory)
String Optional Sub-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 model object
PageModel model = new PageModel();
model.setCategory("Home Page");

//send page view request 
SegmentifyManager.INSTANCE.sendPageView(model, new SegmentifyCallback<ArrayList<RecommendationModel>>() {
  @Override
  public void onDataLoaded(ArrayList<RecommendationModel> data) {
  }
});

An example of parameterized use as an alternative;

//send page view request 
SegmentifyManager.INSTANCE.sendPageView("Home Page", null, new SegmentifyCallback<ArrayList<RecommendationModel>>() {
  @Override
  public void onDataLoaded(ArrayList<RecommendationModel> data) {

  }
});

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):

Name Type Requirement Description Example
Query
(query)
String Optional Typed words for searching products. Should be empty or null for before search. 'Dress'

An example search view request is given below:

//define search page model object
SearchPageModel searchPage = new SearchPageModel();
searchPage.setQuery("Dress");

//send search page view request 
SegmentifyManager.INSTANCE.sendSearchPageView(searchPage, new SegmentifyCallback<SearchResponseModel>() {
    @Override
    public void onDataLoaded(SearchResponseModel data) {
    }
});

Search Response Details

SearchModel has two objects: products for product list, and campaign for search campaign details.

SearchModel

Name Type Description
campaign
SearchCampaignModel? search campaign details.
products
ProductRecommendationModel? Product list

SearchCampaignModel

Name Type Description
instanceId
String? Campaign instanceId. It will be used on events.
name
String? Campaign name.
mobileItemCount
Int? Max product count to be displayed
minCharacterCount
Int? The minimum number of characters required to search
stringSearchAssetTextMap
[String:SearchAssetTextModel] language based map of titles
SearchAssetTextModel
Name Type Description
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):

Name Type Requirement Description Example
Product ID
(productId)
String Mandatory Unique id of the product 'EXAMPLE_PRODUCT_1'
Title
(title)
String Mandatory Name/Title of the product  'EXAMPLE PRODUCT'
Stock
(inStock)
Bool Optional Product’s stock status - either true or false. If not given it is assumed to be in stock ('true') 'true'
Url
(url)
String Mandatory Canonical url of the product 'https://www.exampleshop.com/example-product-1/'
Mobile Url
(mUrl)
String  Optional mobile specific url for the product 'https://m.exampleshop.com/example-product-1/'
Image
(image)
String Mandatory main image url to be used in product recommendations 'https://cdn.exampleshop.com/example-product-1.png'
Image X-Small
(imageXS)
String Optional very small image url to be used in product recommendations 'https://cdn.exampleshop.com/example-product-1-xs.png'
Image Small
(imageS)
String Optional small image url to be used in product recommendations 'https://cdn.exampleshop.com/example-product-1-small.png'
Image Medium
(imageM)
String Optional medium image url to be used in product recommendations 'https://cdn.exampleshop.com/example-product-1-medium.png'
Image Large
(imageL)
String Optional large image url to be used in product recommendations 'https://cdn.exampleshop.com/example-product-1-large.png'
Image X-Large
(imageXL)
String Optional very large image url to be used in product recommendations 'https://cdn.exampleshop.com/example-product-1-xl.png'
Category
(category)
String Mandatory Hierarchical category of the product 'Men > Sports > Shoes'
Brand
(brand)
String Optional Brand of the product 'EXAMPLE BRAND'
Price
(price)
NSNumber  Mandatory Price of the product, must be numeric 349.99
Old/Sales Price
(oldPrice)
NSNumber Optional Price of the product before sales 449.99
Currency
(currency)
String  Optional Currency of product price. Must be in Short Format. If not given, account's currency will be used for the product 'EUR'
Gender
(gender)
Optional Gender of the product. Possible values are 'M', 'F', 'U' 'M'
Colors
(colors)
Array type String Optional Different 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 String Optional Custom 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)
Bool Optional noUpdate must be defined as "true" in order not to disturb the products. 'true'

An example product view request is given below:

//define page model object
PageModel model = new PageModel();
model.setCategory("Product Page");

//send page view request 
SegmentifyManager.INSTANCE.sendPageView(model, new SegmentifyCallback<ArrayList<RecommendationModel>>() {
  @Override
  public void onDataLoaded(ArrayList<RecommendationModel> data) {
  }
});



//define product model object
ProductModel model = new ProductModel();
ArrayList<String> categories = new ArrayList<String>();
categories.add("Womenswear");

model.setProductId("25799860937");
model.setCategories(categories);
model.setPrice(578.00);
model.setTitle("Asymmetric Dress in Black");
model.setImage("//cdn.shopify.com/s/files/1/1524/5822/products/2014_11_17_Lana_Look034_02_300x300.jpg?v=1475497696");
model.setUrl("https://segmentify-shop.myshopify.com/products/asymmetric-dress-black");

//send product view request 
SegmentifyManager.INSTANCE.sendProductView(model, new SegmentifyCallback<ArrayList<RecommendationModel>>() {
    @Override
    public void onDataLoaded(ArrayList<RecommendationModel> data) {

    }
});

An example of parameterized use as an alternative;

//send page view request 
SegmentifyManager.INSTANCE.sendPageView("Product Page", null, new SegmentifyCallback<ArrayList<RecommendationModel>>() {
  @Override
  public void onDataLoaded(ArrayList<RecommendationModel> data) {

  }
});




ProductModel model = new ProductModel();
ArrayList<String> categories = new ArrayList<String>();
categories.add("Womenswear");

SegmentifyManager.INSTANCE.sendProductView("25799860937","Womenswear",578.00,"Asymmetric Dress in Black","//cdn.shopify.com/s/files/1/1524/5822/products/2014_11_17_Lana_Look034_02_300x300.jpg?v=1475497696",
"https://segmentify-shop.myshopify.com/products/asymmetric-dress-black")
    , new SegmentifyCallback<ArrayList<RecommendationModel>>() {
    @Override
    public void onDataLoaded(ArrayList<RecommendationModel> data) {

    }
});

Basket Operations

Segmentify 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
BasketModel model = new BasketModel();
model.setStep("add");
model.setProductId("25800400265");
model.setQuantity(2);
model.setPrice(358.00);
//Send add to basket event 
SegmentifyManager.INSTANCE.sendAddOrRemoveBasket(model);

An example of parameterized use as an alternative;

//Send add to basket event 
SegmentifyManager.INSTANCE.sendAddOrRemoveBasket("add","25800400265",2,358.00);

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
BasketModel model = new BasketModel();
model.setStep("remove");
model.setProductId("25800400265");
model.setQuantity(2);
model.setPrice(358.00);
//Send add to basket event 
SegmentifyManager.INSTANCE.sendAddOrRemoveBasket(model);

An example of parameterized use as an alternative;

SegmentifyManager.INSTANCE.sendAddOrRemoveBasket("remove","25800400265",2,358.00);

Basket Event Parameters

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

Name Type Requirement Description Values
Basket Step
(step)
String Mandatory  Basket operation type. Can be either 'add' or 'remove'  'add'
Product ID
(productId)
String Mandatory Unique id of the product. Must match with product ids sent with product view event 'EXAMPLE_PRODUCT_1'
Price
(price)
NSNumber Optional Price of the product in the basket. If not given, price of the product in product catalogue will be assumed 349.99
Currency
(currency)
String Optional Currency of product price. Must be in Short Format. Currency of the product is used if not given  'EUR'
Quantity String Optional Number 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.3 1

Checkout Operations

Segmentify 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.

Segmentify track four different steps of checkout operation:

Operation  Step Details
View Basket basket When 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 Information customer This is the second step on checkout funnel. When customer is entering his personal information details, this event should be send to Segmentify. To see details, please click
Payment Information payment When customer is on payment stage of checkout funnel, you should send this event to Segmentify.To see details, please click
Purchase/Success purchase Final step of checkout funnel is purchase and Segmentify 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
SegmentifyManager.INSTANCE.sendPageView("Basket Page", null, new SegmentifyCallback<ArrayList<RecommendationModel>>() {
    @Override
    public void onDataLoaded(ArrayList<RecommendationModel> data) {

    }
});
//END Page view request

//START Basket View Request
ArrayList<ProductModel> productList = new ArrayList<>();
ProductModel productModel = new ProductModel();
productModel.setPrice(78.0);
productModel.setQuantity(2);
productModel.setProductId("25799809929");

productList.add(productModel);

CheckoutModel checkoutModel = new CheckoutModel();
checkoutModel.setProductList(productList);
checkoutModel.setTotalPrice(156.0);

SegmentifyManager.INSTANCE.sendViewBasket(checkoutModel, new SegmentifyCallback<ArrayList<RecommendationModel>>() {
    @Override
    public void onDataLoaded(ArrayList<RecommendationModel> data) {

    }
});
//END Basket View Request

An example of parameterized use as an alternative;

//START Page view request
SegmentifyManager.INSTANCE.sendPageView("Basket Page", null, new SegmentifyCallback<ArrayList<RecommendationModel>>() {
    @Override
    public void onDataLoaded(ArrayList<RecommendationModel> data) {

    }
});
//END Page view request

//START Basket View Request
ArrayList<ProductModel> productList = new ArrayList<>();
ProductModel productModel = new ProductModel();
productModel.setPrice(78.0);
productModel.setQuantity(2);
productModel.setProductId("25799809929");
productList.add(productModel);

SegmentifyManager.INSTANCE.sendViewBasket(156.00,productList,null, new SegmentifyCallback<ArrayList<RecommendationModel>>() {
    @Override
    public void onDataLoaded(ArrayList<RecommendationModel> data) {

    }
});

//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
SegmentifyManager.INSTANCE.sendPageView("Customer Info Page", null, new SegmentifyCallback<ArrayList<RecommendationModel>>() {
    @Override
    public void onDataLoaded(ArrayList<RecommendationModel> data) {

    }
});
//END Page view request

//START Basket View Request
ArrayList<ProductModel> productList = new ArrayList<>();
ProductModel productModel = new ProductModel();
productModel.setPrice(78.0);
productModel.setQuantity(2);
productModel.setProductId("25799809929");

productList.add(productModel);


CheckoutModel checkoutModel = new CheckoutModel();
checkoutModel.setProductList(productList);
checkoutModel.setTotalPrice(156.0);

SegmentifyManager.INSTANCE.sendCustomerInformation(checkoutModel, new SegmentifyCallback<ArrayList<RecommendationModel>>() {
    @Override
    public void onDataLoaded(ArrayList<RecommendationModel> data) {

    }
});
//END Basket View Request

An example of parameterized use as an alternative;

//START Page view request
SegmentifyManager.INSTANCE.sendPageView("Customer Info Page", null, new SegmentifyCallback<ArrayList<RecommendationModel>>() {
    @Override
    public void onDataLoaded(ArrayList<RecommendationModel> data) {

    }
});
//END Page view request

//START Basket View Request
ArrayList<ProductModel> productList = new ArrayList<>();
ProductModel productModel = new ProductModel();
productModel.setPrice(78.0);
productModel.setQuantity(2);
productModel.setProductId("25799809929");
productList.add(productModel);

SegmentifyManager.INSTANCE.sendCustomerInformation(156.00,productList,null, new SegmentifyCallback<ArrayList<RecommendationModel>>() {
    @Override
    public void onDataLoaded(ArrayList<RecommendationModel> data) {

    }
});

//END Basket View 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
SegmentifyManager.INSTANCE.sendPageView("Checkout Payment Page", null, new SegmentifyCallback<ArrayList<RecommendationModel>>() {
    @Override
    public void onDataLoaded(ArrayList<RecommendationModel> data) {

    }
});
//END Page view request

//START Basket View Request
ArrayList<ProductModel> productList = new ArrayList<>();
ProductModel productModel = new ProductModel();
productModel.setPrice(78.0);
productModel.setQuantity(2);
productModel.setProductId("25799809929");
productList.add(productModel);

CheckoutModel checkoutModel = new CheckoutModel();
checkoutModel.setProductList(productList);
checkoutModel.setTotalPrice(156.0);

SegmentifyManager.INSTANCE.sendPaymentInformation(checkoutModel, new SegmentifyCallback<ArrayList<RecommendationModel>>() {
    @Override
    public void onDataLoaded(ArrayList<RecommendationModel> data) {

    }
});
//END Basket View Request

An example of parameterized use as an alternative;

//START Page view request
SegmentifyManager.INSTANCE.sendPageView("Checkout Payment Page", null, new SegmentifyCallback<ArrayList<RecommendationModel>>() {
    @Override
    public void onDataLoaded(ArrayList<RecommendationModel> data) {

    }
});
//END Page view request

//START Basket View Request
ArrayList<ProductModel> productList = new ArrayList<>();
ProductModel productModel = new ProductModel();
productModel.setPrice(78.0);
productModel.setQuantity(2);
productModel.setProductId("25799809929");
productList.add(productModel);

SegmentifyManager.INSTANCE.sendPaymentInformation(156.00,productList,null, new SegmentifyCallback<ArrayList<RecommendationModel>>() {
    @Override
    public void onDataLoaded(ArrayList<RecommendationModel> data) {

    }
});

//END Basket View 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 request
SegmentifyManager.INSTANCE.sendPageView("Checkout Success Page", null, new SegmentifyCallback<ArrayList<RecommendationModel>>() {
    @Override
    public void onDataLoaded(ArrayList<RecommendationModel> data) {

    }
});
//END Page view request

//START Basket View Request
ArrayList<ProductModel> productList = new ArrayList<>();
ProductModel productModel = new ProductModel();
productModel.setPrice(78.0);
productModel.setQuantity(2);
productModel.setProductId("25799809929");

productList.add(productModel);

CheckoutModel checkoutModel = new CheckoutModel();
checkoutModel.setProductList(productList);
checkoutModel.setTotalPrice(156.0);
checkoutModel.orderNo("order1");

SegmentifyManager.INSTANCE.sendPurchase(checkoutModel, new SegmentifyCallback<ArrayList<RecommendationModel>>() {
    @Override
    public void onDataLoaded(ArrayList<RecommendationModel> data) {

    }
});
//END Basket View Request

An example of parameterized use as an alternative;

//START Page view request
SegmentifyManager.INSTANCE.sendPageView("Checkout Success Page", null, new SegmentifyCallback<ArrayList<RecommendationModel>>() {
    @Override
    public void onDataLoaded(ArrayList<RecommendationModel> data) {

    }
});
//END Page view request

//START Basket View Request
ArrayList<ProductModel> productList = new ArrayList<>();
ProductModel productModel = new ProductModel();
productModel.setPrice(78.0);
productModel.setQuantity(2);
productModel.setProductId("25799809929");
productList.add(productModel);

SegmentifyManager.INSTANCE.sendPurchase(156.00,productList,"OrderNo1", new SegmentifyCallback<ArrayList<RecommendationModel>>() {
    @Override
    public void onDataLoaded(ArrayList<RecommendationModel> data) {

    }
});

//END Basket View 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:

Name Type Description Example
Checkout Step
(step)
String Mandatory Identifies which step of the checkout funnel. Each step has different meaning and use it accordingly
Total Price/Amount
(totalPrice)
NSNumber Mandatory Total amount of the basket including taxes, shipping costs and also discounts
Currency
(currency)
String Optional Currency of the total amount of the basket. Must be in Short Format. If not given, currency of the account is used
Order No
(orderNo)
String Optional Your 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)
String Optional Permalink 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)
Products Array type Any Mandatory List 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.

Name Type Requirement Description Example
Product ID
(productId)
String Mandatory Unique id of the product 'EXAMPLE_PRODUCT_1'
Price NSNumber Optional Price of the product in the basket. If not given, price of the product in the product catalogue will be used 349.99
Currency String Optional Currency of product price. Must be in Short Format. If not given, currency of the product in the product catalogue will be used  'EUR'
Quantity String Optional Number of items from current product in the basket. If not given, it is assumed to be 1 1

User/Visitor Operations

Segmentify tracks important user operations like sign-up/register, sign-in/login, sign-out/logout and also you can share your customer's information with Segmentify 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, to see details please click
  2. User Login/Sign-in: It should be sent when a registered user logins to your website, to see details please click
  3. User Logout/Sign-out: It should be sent when a registered user logouts from your website, to see details please click
  4. User Update: It should be sent when you want to share registered user's information (ex: name, email, phone number, etc.) with Segmentify. 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. To see details please click

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 Segmentify, please use User Update.

Details of parameters of new user is given below:

Name Type Requirement Description Example
User Operation
(step)
String Mandatory Identifies which operation is taken for current user/customer. Each operation has differen meaning and use it accordingly 'signup'
Username
(username)
String Mandatory Unique identifier for the customer 'johndoe'
Full Name
(fullName)
 String Optional Full name of the customer.  'John Doe'
Email
(email)
 String Optional
(Mandatory for using email module)
Email address of the customer  'john.doe@exampleshop.com'
Mobile Phone
(phone)
String Optional Mobile phone number of the customer  '+1 555 555 5555'
Is Login
(isLogin)
Bool Optional Login information of the user true
Is Registered
(isRegistered)
Bool Optional Register information of the customer true
Gender
(gender)
String Optional Gender of the customer. Must be either 'M' or 'F'  'M'
Age
(age)
String Optional Age of the customer. Must be numeric. Either use age or birthdate  27
Birthdate
(birthdate)
String Optional Birthdate of the customer. Must be in format 'DD.MM.YYYY'. Either use age or birthdate  '23.01.1980'
Membership Date
(memberSince)
String Optional Membership date of the customer. Must be in format 'DD.MM.YYYY'  '20.01.2014'
Location
(location)
String Optional Location of the customer  'New York'
Customer Segments
(segments)
Array type String Optional Segments of the customer. Must be in array format  ['SEGMENT 1', 'SEGMENT 2']

An example request is given below:

//Create new user Object
UserModel userModel = new UserModel();
//Define user object's username and email 
userModel.setUsername("Segmentify");
userModel.setEmail("example@segmentify.com");
//Send user register request

SegmentifyManager.INSTANCE.sendUserRegister(userModel);

An example of parameterized use as an alternative;

//Send user register request
SegmentifyManager.INSTANCE.sendUserRegister("Segmentify","example@segmentify.com");

User Login

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

Details of parameters of user login is given below:

Name Type Requirement Description Example
User Operation
(step)
String Mandatory Identifies which operation is taken for current user/customer 'signin'
Username String Mandatory Unique identifier for the customer 'johndoe'

An example request is given below:

//Create new user Object
UserModel userModel = new UserModel();
//Define user object's username and email 
userModel.setUsername("Segmentify");
userModel.setEmail("example@segmentify.com");
//Send user register request

SegmentifyManager.INSTANCE.sendUserLogin(userModel);

An example of parameterized use as an alternative;

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

User Logout

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

Details of parameters of user logout is given below:

Name Type Requirement Description Example
User Operation
(step)
String Mandatory Identifies which operation is taken for current user/customer 'signout'
Username String Mandatory Unique identifier for the customer 'johndoe'

An example request is given below:

//Create new user Object
UserModel userModel = new UserModel();
//Define user object's username and email 
userModel.setUsername("Segmentify");
userModel.setEmail("example@segmentify.com");
//Send user register request

SegmentifyManager.INSTANCE.sendUserLogout(userModel);

An example of parameterized use as an alternative;

//Send user login request
SegmentifyManager.sharedManager().sendUserLogout("Segmentify","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 Segmentify, please use New User.

Details of parameters of user update is given below:

Name Type Requirement Description Example
User Operation
(step)
String Mandatory Identifies which operation is taken for current user/customer. Each operation has differen meaning and use it accordingly 'update'
Username
(username)
String Mandatory Unique identifier for the customer 'johndoe'
Full Name
(fullName)
String Optional Full name of the customer.  'John Doe'
Email
(email)
String Optional
(Mandatory for using email module)
Email address of the customer  'john.doe@exampleshop.com'
Mobile Phone
(phone)
 String Optional Mobile phone number of the customer  '+1 555 555 5555'
Gender
(gender)
String Optional Gender of the customer. Must be either 'M' or 'F'  'M'
Age
(age)
String Optional Age of the customer. Must be numeric. Either use age or birthdate  27
Birthdate
(birthdate)
String Optional Birthdate of the customer. Must be in format 'DD.MM.YYYY'. Either use age or birthdate  '23.01.1980'
Membership Date
(memberSince)
String Optional Membership date of the customer. Must be in format 'DD.MM.YYYY'  '20.01.2014'
Location
(location)
String Optional Location of the customer  'New York'
Customer Segments
(segments)
Array type String Optional Segments of the customer. Must be in array format  [ 'SEGMENT 1', 'SEGMENT 2' ]
Is Registered Flag
(isRegistered)
Bool Optional This 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)
Bool Optional This 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
UserModel userModel = new UserModel();
//Define user object's username and email 
userModel.setUsername("Segmentify");
userModel.setEmail("example@segmentify.com");
//Send user register request

SegmentifyManager.INSTANCE.sendUserUpdate(userModel);

An example of parameterized use as an alternative;

//Send user update request
SegmentifyManager.sharedManager().sendUserUpdate("Segmentify","example@segmentify.com")

User Change

This event is used when userid wants to be changed.

UserChangeModel model = new UserChangeModel();
model.setUserId("XXXXXXXXXX");

SegmentifyManager.INSTANCE.sendChangeUser(model;

Custom Event

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

Details of parameters of custom event is given below:

Name Type Requirement Description Example
Type
(type)
String Mandatory Type of the event. You should use same type for same events 'my_custom_event'
Custom Parameters
(params)
Dictionary Optional Custom parameters of the event. Must be in map format. '{"field1":"value1", "field2":"value2"}'

An example request is given below:

CustomEventModel model = new CustomEventModel();
model.setType("test");

SegmentifyManager.INSTANCE.sendCustomEvent(model, new SegmentifyCallback<ArrayList<RecommendationModel>>() {
    @Override
    public void onDataLoaded(ArrayList<RecommendationModel> data) {

    }
});

Interaction

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

Widget View

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

Name Type Requirement Description Example
instanceId
String Mandatory Identity of the campaign scn_6186a632e0d76001
interactionId
String Mandatory Identity of the action act_6185c1e624ab0000
if(recObj.instanceId == "scn_xxx") { // recObj is the recomendationModel object returned from the productView event.
    //Any actions related to product's
    var interactionId  = recObj.interactionId
    var instanceId = recObj.instanceId
    SegmentifyManager.INSTANCE.sendWidgetView(instanceId,interactionId: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.

Name Type Requirement Description Example
instanceId
String Mandatory Identity of the campaign instanceId = "scn_6186a632e0d76001"
interactionId
String Mandatory Unique id of the product interactionId = "25803234569"
if(recObj.instanceId == "scn_xxx") { // recObj is the recomendationModel object returned from the productView event.
    //Any actions related to product's
    var interactionId  = productId
    var instanceId = recObj.instanceId
    SegmentifyManager.INSTANCE.sendClick(instanceId,interactionId:interactionId);
} 

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.

Name Type Requirement Description Example
instanceId
String Mandatory Identity of the product for before search input instanceId = "bs_product"
interactionId
String Mandatory Unique id of the product for before search input interactionId = "123456789"

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

Name Type Requirement Description Example
instanceId
String Mandatory Identity of the product for after search input instanceId = "product"
interactionId
String Mandatory Unique id of the product for after search input interactionId = "123456789"
SegmentifyManager.INSTANCE.sendSearchClickView("product","123456789");