Important: As of August 13, 2024, this page will no longer be actively maintained. Please refer to the current version of this content here.
Objective-C
After downloading the client, drop the Analytics project files into a Group in your app. To start using it, specify your Analytics API key by calling Indicative‘s launch: method in the didFinishLaunchingWithOptions: method of your app delegate:
[Indicative launch:@"Your-API-Key-goes-here"];
To record an event, simply call the record: method, passing in the name of your event. For example:
[Indicative record:@"Registration"];
To record an event with properties call the record:withProperties: method, like so:
[Indicative record:@"Registration" withProperties:@{
@"Gender": @"Male",
@"Age": @"23"
}];
The record: and record:withProperties: methods add an event object to a queue. Every 60 seconds, the events on this queue will be asynchronously sent to our servers via HTTP POST requests. If debug mode is enabled via the debug BOOL in Indicative.m, the status code and body of our response will be outputted to your device’s logs.
To specify the user who performs an event, call the identifyUser method, passing in the user’s unique identifier. If you choose to not identify the user, Analytics will automatically generate an identifier for the user based on their device’s MAC address.
[Indicative identifyUser:@"TestUser123"];
Swift
Analytics' iOS SDK is written in Objective-C and is compatible with Swift files. To learn more about importing Objective-C into Swift, please see Apple’s documentation here.
After downloading the client, drop the Indicative project files into a Group in your app. To start using it, specify your Analytics API key by calling Indicative‘s launch method in the didFinishLaunchingWithOptions method of your app delegate:
Indicative.launch("Your-API-Key-goes-here")
To record an event, simply call the record method, passing in the name of your event. For example:
Indicative.record("Registration")
To record an event with properties call the record withProperties method, like so:
Indicative.record("Registration", withProperties: [
"Gender": "Male",
"Age": "23"
])
The record and record withProperties methods add an event object to a queue. Every 60 seconds, the events on this queue will be asynchronously sent to our servers via HTTP POST requests. If debug mode is enabled via the debug BOOL in Indicative.m, the status code and body of our response will be outputted to your device’s logs.
To specify the user who performs an event, call the identifyUser method, passing in the user’s unique identifier. If you choose to not identify the user, Analytics will automatically generate an identifier for the user based on their device’s MAC address.
Indicative.identifyUser("TestUser123")