iOS SDK Integration guideline


Getting started

Unliche SDK provides application installs and event tracking functionalities. We developed Unliche SDK easy to integrate and lightweight.

1. Embedding the SDK into Your Application (Mandatory)

The following steps are mandatory to measure installs and sessions.

1.1 Installing the SDK using CocoaPods

If project is not already using Cocoapods, you can follow the instructions on cocoapods.org to get up and running.

Add the following line to your pod file:

pod 'unliche'

1.2 Installing the SDK manually

  • In Xcode, go to Build Phases >> Link Binary with Libraries >> Click + to add a new library
  • Click Add Other and add the Unliche.framework

  • And also go to Build Phases >> Embeded binaries >> Click + to add a new library >> Click Add Other and add the Unliche.framework

2. Add the required frameworks

Add the frameworks listed below. To add them, click your application’s target. Then click Build Phases, and Link Binary with Libraries to enter the frameworks.

  • AdSupport.framework

Note

Unliche collects IDFA only if you include this framework.

3. Add Linker Flags

In XCode, under the Build Settings tab, you can either:

  • Choose All, and scroll down to the Linking section, and choose Other Linker Flags
  • Enter “other linker flags” in the search box

In the Other Linker Flags box, add the -ObjC flag.

4. SDK Initialization and Installation Event (Minimum Requirement for Tracking)

Note

This is the minimum requirement to begin tracking your app installs.

4.1. Initialization

  • Add #import <Unliche/Unliche.h> in App Delegate
  • To initialize the SDK, add the following to your “didFinishLaunchingWithOptions” function:
      - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  [UnlicheManager initializeWithUnlicheAccessToken:@"81355258a9d7fbbe8b436bc9c7839cae5c1a2200a84ae4e88b7fd68580ad6cd1"];

  // Override point for customization after application launch.
  return YES;
}

4.2. Open event

Add the following code to your AppDelegate.m source file at “applicationDidBecomeActive” function:

      - (void)applicationWillEnterForeground:(UIApplication *)application {
  [UnlicheManager trackOpenEvent];
}

4.3. Registration event

If app contain registration event, this event will useful to track registration

- (void)trackRegistrationEvent {
  [UnlicheManager trackRegisterEvent];
}

4.4. Purchase event

If app contain purchase event, this event will useful to track purchase

- (void)trackPurchaseEvent {
  [UnlicheManager trackEventWithEventId:AFEventPurchase withValues: @{
                                                                      ULEventParamContentId:@"123",
                                                                      ULEventParamContentType : @"social",
                                                                      ULEventParamRevenue: @100,
                                                                      ULEventParamCurrency:@"USD"}];
  }

4.5. Uninstall tracking

Unliche uninstall tracking feature allows to track the number of uninstalls that happened for perticuler app in the device and attribute them back to a specific media source. With this metric, you can optimize your advertising budget and strategy with those media sources providing the highest value users.

To enable uninstall tracking feature, you have to enable push notificatin feature in your application. And upload the .pem file which you generates with push in Unliche admin portal.

Please refer below link to enable push notification in your app :

Create a push notification certificate

Enable push notification service in your app by implementing the below code:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  // Register for Remote Notifications
  [application registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
  return YES;
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
  // send device token to Unliche SDK
    [UnlicheManager application:application unlicheDidRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
    // send error if occured to Unliche SDK
  [UnlicheManager application:application unlicheDidFailToRegisterForRemoteNotificationsWithError:error];
}

5. How To Submit Your iOS App With IDFA

When submitting your app you have to disclose your IDFA uses:

 

  • Serve advertisements within the app.
Please check this box if you show ads in your app. Unliche’s SDK is not used to serve ads.
  • Attribute this app installation to a previously served advertisement.
Unliche uses IDFA for install attribution. Please select this check box.
  • Attribute an action taken within this app to a previously served advertisement
Unliche uses IDFA for re-engagment ads attribution. Please select this check box.
  • iOS Limited Ad Tracking

The Unliche SDK collects the iOS “Limit Ad Tracking” (“advertisingTrackingEnabled”) flag when collecting IDFA. Unliche fully complies with Apple requirement: “Check the value of this property before performing any advertising tracking. If the value is NO, use the advertising identifier only for the following purposes: frequency capping, conversion events, estimating the number of unique users, security and fraud detection, and debugging.”

Unliche uses IDFA only for: “conversion events, estimating the number of unique users, security and fraud detection”. The data is owned by our clients, the app developers, and Unliche never uses IDFA for user profiling and re-targeting.