2) iOS Integration

To apply T-MAT, be sure that you already finished both adding your app and SDK settings. See [1. TnkAd SDK] for details.

* Inbound channel data is not collected in iOS.

[Basic settings]
  • Add TnkAd library and related Frameworks to Xcode project.
  • Put initializing code with your App ID value in applicationDidFinishLaunchingWithOption method of Application Delegate.
    • Replace your-application-id-from-tnk-site with your App Id value.
  • If your don't want to use T-MAT anymore, just simply set TrackingEnabled to NO. Default value of TrackingEnabled is YES. 

Sample Code

#import "tnksdk.h"


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

    // Tnk initialization

    [TnkSession initInstance:@"your-application-id-from-tnk-site"];


    // Tracking on/off

    [[TnkSession sharedInstance] setTrackingEnabled:YES];

}


[Required Invocation]

Invoke this method as soon as your app is started. This is a minimum requirement for analytics.

Method
  - (void) applicationStarted

Description
   Call when application is started.

applicationStared sample

#import "tnksdk.h"


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

    // Tnk Initialization

    [TnkSession initInstance:@"your-application-id-from-tnk-site"];



    // 

    [[TnkSession sharedInstance] applicationStarted];

}


[Funnel Analytics]

Call below API to receive data about depth of user action. For example, action such as log- in, item purchase and recommendation can be called.

Method
  - (void) actionCompleted:(NSString *)actionName

Description
   Call when specific action is made, First occurrence for each action is collected.

Parameters
NameDescription
 actionNameString representing user action( "user_login" for example)
You must register this name in the page of Funnel Analytics of Report menu at Tnk site.

actionCompleted Samples

// resource downloaded

[[TnkSession sharedInstance] actionCompleted:@"resource_loaded"];

// user signed up

[[TnkSession sharedInstance] actionCompleted:@"signup_done"];

// profile entered

[[TnkSession sharedInstance] actionCompleted:@"profile_entered"];

// friend invitation

[[TnkSession sharedInstance] actionCompleted:@"friend_invite"];


[Buying Users]

Call this method whenever a user purchases a paid item.  
You can get very informative data about buying activities using this API.

Method
  - (void) buyCompleted:(NSString *)itemName

Description
   Call this method when a buying action is made.

Parameters
 Name Description
 itemNamename of item purchased ("item_01" for example)

buyCompleted Samples

// item_01 purchased

 [[TnkSession sharedInstance] buyCompleted:@"item_01"];

//item_02 purchased

 [[TnkSession sharedInstance] buyCompleted:@"item_02"];


[User Information]

If you set user demographic, you can find more informative data. 

Setting Users Info

// Age 

 [[TnkSession sharedInstance] setUserAge:33];

// Man

 [[TnkSession sharedInstance] setUserGender:TNK_CODE_MALE];

// Woman

 [[TnkSession sharedInstance] setUserGender:TNK_CODE_FEMALE];

Comments