Upsight logo Back to top

Advanced Messages

setMode

Setting SDK Mode


This call determines which server the SDK will send data to: Production or Test.

setMode

Required Parameters


Parameter Type Description
modestring Determines whether you send data to Kontagent Test or Production servers. For Production, set this parameter to: kKontagentSDKMode_PRODUCTION. For Test, set this parameter to: kKontagentSDKMode_TEST.

setMode

Optional Parameters


No Optional Parameters

setMode

Code Example


Set the SDK Mode to Test:

[Kontagent setMode:kKontagentSDKMode_TEST];

Set the SDK Mode to Production:

[Kontagent setMode:kKontagentSDKMode_PRODUCTION];

createSession

Creating a Kontagent Object


Call this method to create a Kontagent object. Use this method if you wish to send to multiple API Keys..

Note To put a Session into TEST mode, use the setMode function.

createSession

Required Parameters


Parameter Type Description
apiKeystring The API Key of your application. This key is automatically generated when you set up your application in your Dashboard.

createSession

Optional Parameters


Parameter Type Description
senderIDunsigned 64-bit int A unique, unsigned 64-bit integer in the form of an NSString. This parameter denotes the unique identifier of the application user. If your application creates user ID is larger than 64-bits, you must convert the user ID to an unsigned 64-bit integer to send to Upsight Analytics.
shouldSendApplicationAddedAutomaticallyboolean When TRUE, applicationAdded request will be sent automatically from start method of KTSession object

createSession

Code Example


You need to know your API Key. The senderID can be nil, the SDK will fill this in for you.

[Kontagent setMode:kKontagentSDKMode_TEST];
KTSession* theSession = [Kontagent createSession:@"ApiKey" senderId:@"SenderId"];

Start the session.

[theSession start];

customEvent

Creating a Custom Event


Send this API call when a user performs an action specific to your application. This action can be anything that you deem valuable to track, such as the sale of a specific item, or progression to another level in a game.

customEvent

Required Parameters


Parameter Type Description
nstring The event name, up to 31 characters long, describing the event. Valid characters are a-z, A-Z, 0-9, -, and _.

customEvent

Optional Parameters


Parameter Type Description
lunsigned 8-bit int A level value can be associated to an action to indicate what game level the user is on. It is possible to view aggregate event counts by level. The level must always be a positive integer in the range from 0 to 255. The default value is 0.
vsigned int An arbitrary value you assign to associate with the event. The default value is 0.
st1string An alpha-numeric label, up to 31 characters long, to categorize the event. The characters - and _ are also valid. Not optional if st2 is used.
st2string An alpha-numeric label, up to 31 characters long, to categorize the event. The characters - and _ are also valid. Not optional if st3 is used.
st3string An alpha-numeric label, up to 31 characters long, to categorize the event. The characters - and _ are also valid.
datastring Additional data, a JSON object string representing a dictionary or map of key-value pairs. Click here for more information.

customEvent

Code Example


Basic custom event with no parameters

[Kontagent customEvent:<event_name> optionalParams:nil];

Advanced custom event

KTParamMap* paramMap = [[[KTParamMap alloc] init] autorelease];
[paramMap put:@"st1" value:<subtype1>];
[paramMap put:@"st2" value:<subtype2>];
[paramMap put:@"st3" value:<subtype3>];
[paramMap put:@"l" value:<level>];
[paramMap put:@"v" value:<value>];
[paramMap put:@"data" value:<data>];
[Kontagent customEvent:<event_name> optionalParams:paramMap];

revenueTracking

Revenue Tracking (Monetization)


This message provides information for tracking revenue and monetization transactions by users.

Note If you are funnelling your data from the Upsight SDK into the Upsight Analytics Dashboard, do not send both Monetization messages through the Upsight Enterprise SDK and In-App Purchase Tracking through the Upsight SDK. Doing so will cause double-counting in your purchase data. To ensure your purchase data is accurate, if you are using both the Upsight SDK and the Upsight Enterprise SDK, only send in-app purchase tracking through the Upsight SDK, not both.

revenueTracking

Required Parameters


Parameter Type Description
vint The revenue value in cents. All values must be a positive integer value and passed in cents, not dollars. Example: $1.25 should be passed as 125. The maximum value that can be passed is 1000000 ($10,000).

revenueTracking

Optional Parameters


Parameter Type Description
datastring Additional data, a JSON object string representing a dictionary or map of key-value pairs. Click here for more information.

revenueTracking

Code Example


[Kontagent revenueTracking:<value> optionalParams:nil];

[Kontagent revenueTracking:cents optionalParams:paramMap];

applicationAdded

Application Added


Call this method if startSession is called, and shouldSendApplicationAddedAutomatically is set to FALSE.

applicationAdded

Required Parameters


No required parameters.

applicationAdded

Optional Parameters


No optional parameters.

applicationAdded

Code Example


[Kontagent applicationAdded:nil]