NAV Navbar
objective_c
  • Introduction
  • Installation
  • Initialization
  • Users
  • Push
  • Conversion data
  • Introduction

    Welcome on the Omnisense iOS SDK Documentation v1.0. You can use these to retrieve and add informations on your Omnisense instance.

    Omnisense is an omnicanal CRM.

    With Omnisense, you can manage the entire lifecycle of your users : Acquisition, Segmentation, Reengagement.

    Acquisition : Omnisense is connected to the main advertising companies of the market and will allow you to manage your acquisition easily.

    Segmentation : Retrieve all your user data within a clear and intuitive interface and segment them in a few clicks.

    Reengagement : Push, mails, sms ... You can reengage your users with all possible and unimaginable means...

    Installation

    To get access to the Omnisense SDK in your app you must Drag and drop the Omnisense.framework in your project.

    Initialization

    AppDelegate.m

    #import <Omnisense/Omnisense.h>
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
      //This line initializes Omnisense and performs all necessary setup.
      [Omnisense setAppIdentifier:@"YOUR_INSTANCE" apiKey:@"YOUR_APP_API_KEY"];
    
      return YES;
    }
    
    import <Omnisense/Omnisense.h>
    
    
    

    The Omnisense SDK is now successfully included in your project.

    Now you must create an App class extending Application at the root of your app.

    Users

    Post Informations

    OSUser * user = [[OSUser alloc] init];
    user.email = @"john.doe@gmail.com";
    user.facebookId = @"12143534535646";
    user.firstName = @"John";
    user.lastName = "Doe";
    
    [Omnisense setCurrentUser:user];
    

    To identify the user on Omnisense (after login or sign up), create an OSUser and set it as the current user.

    If you want to add or update some of the user attributes, you can get the current user with the method getCurrentUser and change the values. You will have to call the saveUser after settings the values in order to save them to Omnisense.

    After a log out, simply call the resetCurrentUser to remove the current user.

    User Hash

    Parameter Value Description
    email String
    fb_id String
    first_name String
    last_name String
    birthday Date
    phone String
    address String
    city String
    postal_code String
    country String must be the iso code for country (ISO 3166)
    lang String must be the iso code for lang (ISO 639)
    sex String One of "male", "female"
    optin Boolean Set to true if the user is optin to receive email
    optin_sms Boolean Set to true if the user is optin to receive SMS
    registered Boolean Set to true if the user has signed up to your website
    custom_event_date Date
    company String

    Tracking

    User event tracking Let's say the user is looking a product. When the page is loaded you could do something like that to track your user for looking a product.

    [Omnisense recordEvent:@"product_view" segmentation:@{@"product_name": @"The best product ever",@"category": @"New stuff"}];
    

    To record an event made by the user in the app, call the record event method with segmentation.

    Method Informations

    Function name: recordEvent(identifier: String, segments: NSDictionary)

    Method Parameters

    Parameter Value Description
    identifier String The action name
    segments NSDictionary Set of key/values describing the event

    Push

    Register

    - (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)token {
      [Omnisense registerAppForRemoteNotificationsWithDeviceToken:token];
    }
    

    To register the current device for push, call UIApplication's registerForRemoteNotifications method from the app delegate's application:didFinishLaunchingWithOptions

    If the registration is successful, the callback method application:didRegisterForRemoteNotificationsWithDeviceToken in the application delegate will be executed. You will need to implement this method and use it to inform Omnisense about this new device.

    Receiving

    - (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
      [Omnisense handleRemoteNotification:userInfo];
    }
    

    When a push notification is openned on iOS while the associated application is running in the background, the callback method application:didReceiveRemoteNotification in the application delegate will be executed. You will need to implement this method and use it to inform Omnisense about the openning of the push notification.

    When a push notification is received on iOS while the associated application is not in the foreground, it is displayed in the iOS Notification Center and/or a banner will appear at the top of the screen. However, if the notification is received while the associated app is in the foreground, it is up to the application to handle the display of said notification if desired. Depending on your use case, you may want to show an alert to the user, or fetch new data from the server in order to refresh the UI.

    Whatever the case, you will need to implement the application:didReceiveRemoteNotification method in the app delegate in order to handle incoming remote notifications while the app is in the foreground.

    Conversion data

    + (void) conversionDataHandler:(void (^)(NSDictionary* conversionData, NSError *error))block;
    
    + (NSDictionary*) conversionData;
    

    In case you want to use Omnisense conversion data at first launch in your app, you can use the following method before setting the Api Key.

    Conversion data are disk cached, you can get it anywhere in the app using this method.