Method References


  • iOS 5.0 and above
  • include SystemConfiguration.framework and libsqlite3.dylib

Include library

  1. Download iOS library and include it into your project (In XCode drag'n'drop Innometrics.framework folder to "frameworks")
  2. Create config file innometrics_config.plist in the project root. Values for config you can find in the GUI: Install "iOS Data Collection" app, create first section (name of your ios app), go to Settings tab.

Example of config file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<key>innometrics_company_id</key> <string>1</string>
<key>innometrics_bucket</key>              <string>bucketname</string>
<key>innometrics_section</key>      <string>sectionname</string>
<key>innometrics_app_key</key>             <string>appkey</string>
<key>innometrics_events_limit</key>        <integer>1000</integer>
<key>innometrics_debug</key>               <false/>

Before using InnometricsAPI you need to include header file InnometricsAPI.h and get instance of InnometricsAPI class:

#import <Innometrics/InnometricsAPI.h>


InnometricsAPI *api = [InnometricsAPI sharedManager];

Send data to profile

  1. To track user events call InnometricsAPI method - (void)trackEvent:(NSString *)eventDefinition data:(NSDictionary *)eventData. It takes two arguments: eventDefinition - name of the event, eventData - dictionary containing parameters of this event.
    For instance to collect data about searches done by user you can use this code:

    - (IBAction) clickSearch:(id)sender {
    NSMutableDictionary *temp = [NSMutableDictionary dictionary];
        [temp setObject:@"search type" forKey:[self searchType]];
        [temp setObject:@"search string" forKey:[self searchString]];
        NSString *eventName = @"eventSearch";
        [api trackEvent:eventName data:temp];

  2. To set profile attribute use setAttributeWithKey, it creates new attribute in current collect application and section, or overrides it if attribute with the same key already exists.
  3. Session data could be set with setSessionDataWithKey
  4. Also, there is a possibility to track exceptions with (void)trackException:(NSException *)caughtException method:

    @try {
    NSArray *emptyArray = @[];
    NSObject *obj = [emptyArray objectAtIndex:0];
    [obj description]; // Suppress warning
    @catch (NSException *exception) {
    [api trackException:exception];

    or - (void)trackError:(NSError *)userError

    NSError *jsonParseError = nil;
    [NSJSONSerialization JSONObjectWithData:[badJSonString dataUsingEncoding:NSUTF8StringEncoding]
    [api trackError:jsonParseError]; 

Profiles identification and merging


  • temporary profile ID used in case user isn't authenticated
  • canonical profile ID - user is authenticated in your system.

By default, when you init library (first time get instance of InnometricsAPI) it generates temporary profile ID with md5 from identifierForVendor.

It's unique for each of mobile user within one Vendor. 

If you want you can set your own temporary ID with setTemporaryProfileId.

Once your user is authenticated, you need to set canonical id with (void)setCanonicalProfileId:(NSString *)profileId and then merge data of temporary profile into canonical with (void)mergeProfile. 

Note: After that merged profile will be accessible by both IDs (temporary and canonical).<companyID>/buckets/<bucketName>/profiles/<profileID>?app_key=<appKey>&max_return_events=1000

Debug messages can be enabled in innometrics_config.plist with 


Now you can see in XCode console log what data is sent to Profile Cloud, what profile ID is used and API URLs:

12:03:06.609 INNLog |



IQL - Innometrics Query Language is built to:

  • evaluate segments (return true or false for IQL expression)
  • and to search and filter data in profile

IQL runs in separate thread, so it needs callback to handle query result. To run IQL query call executeIQL:

- (void) executeIQL: (NSString *) iql  withCallback: (IQLQueryBlock) block

After query execution IQLQueryBlock will be called and argument IQLResult will contain query result:

executeIQL:@"collectApp(\"web\").section(\"\").event(\"page-view\").eventData(\"search-string\").neq(\"\").inLast(\"events.minute\",5)" withCallback:^(IQLResult *result, NSError *error) {
    BOOL res = [result found];
    INNLog(@"iql result %@", res);

Internal workflow

Every time application is minimized, library suspends its activity. If you want to suspend network activity of library while iOS app is active you can use methods - (void)suspendBackgroundSync and -(void)resumeBackgroundSynс.

In iOS library data is only sent to Profile Cloud (Android library has local copy of data). IQL execution performed on server. In case when network isn't available data stored locally. Config param innometrics_events_limit limits amount of data that could be stored locally and to limit memory usage for this case.