NAV Navbar
objective_c swift
  • Introduction
  • Installation
  • Initialization
  • User data recording
  • Remote notifications
  • Conversion data
  • Introduction

    Welcome on the Omnisense iOS SDK Documentation.

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


    To install the Omnisense SDK in your app, simply drag and drop the Omnisense.framework in your project.

    //  The Objective-C Bridging Header file should look like this...
    #ifndef BridgingHeader_h
    #define BridgingHeader_h
    #import <Omnisense/Omnisense.h>
    #endif /* BridgingHeader_h */


    Initialize the SDK by setting its Omnisense Instance Name (also called App Identifier) and the API Key in application:didFinishLaunchingWithOptions:

    AppDelegate Class

    #import <Omnisense/Omnisense.h>
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
      //This line initializes Omnisense and performs all necessary setup.
      [Omnisense setAppIdentifier:@"YOUR_APP_INSTANCE" apiKey:@"YOUR_APP_API_KEY"];
      return YES;
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool
        //This line initializes Omnisense and performs all necessary setup.
        Omnisense.setAppIdentifier("YOUR_APP_INSTANCE", apiKey: "YOUR_APP_API_KEY")
        return true

    User data recording

    User profile management

    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.

    OSUser * user = [[OSUser alloc] init]; = @"";
    user.facebookId = @"12143534535646";
    user.firstName = @"John";
    user.lastName = @"Doe";
    [Omnisense setCurrentUser:user];
    let user = OSUser() = ""
    user.facebookId = "12143534535646"
    user.firstName = "John";
    user.lastName = "Doe";

    User events recording

    To record an event made by the user in the app, call the record event method with segmentation: recordEvent(identifier: String, segments: NSDictionary).

    [Omnisense recordEvent:@"product_view" segmentation:@{@"product_name": @"The best product ever",@"category": @"New stuff"}];
    let segmentation = ["product_name":"The best product ever", "category":"New stuff"] as Dictionary
    Omnisense.recordEvent("product_view", segmentation: segmentation)

    Remote notifications

    Register to push notifications

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

    Handle incoming push notifications

    - (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
      [Omnisense handleRemoteNotification:userInfo];
    func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) 

    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;
    Omnisense.conversionDataHandler { (conversionData, error) in
                //Do what you want...
    + (NSDictionary*) conversionData;
    let conversionData = Omnisense.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.