Tagging your iOS App


The iOS SDK enables application developers to tag their application to enable measurement and reporting in Narratiive's dashboard. 

Instructions are provided for implementing the SDK using X-Code.

Unique Browser (UUID)

The unique browser identifier used the identifierForVendor Objective-C system call. The discussion on the value for this is provided below.

For details on how this identifier works, see Apple's official documentation.

Sessions and Duration

The sessions (visits) and duration are maintained by the SDK. Cookies are not required to track sessions and duration, however the methodology for calculating sessions and duration is written to mimic the cookie based metrics.

Page Impressions

A page impression is recorded by the SDK every time the tracker methods are invoked. You can manually invoke impressions on screens using the track instance methods.

User Agent

The user agent string is collected using the navigator.userAgent javascript property from WebKit.


1. Download the libEmTracker library and header from the downloads section below.

2. Add both to your iOS application.

3. In AppDelegate.m, in the appropriate place for your application entry point (e.g. didFinishLanchingWithOptions), add the following calls to track the initial page view:

// Import statement, At the top of the file.
#import "EmTracker.h"
EmTracker *tracker = [EmTracker sharedInstance];

// replace "test" with an app name, allowed characters are a-z0-9-  Spaces can not be included
// replace "testiOS.com" with your domain name
// replace "sdk-key-here" with the app key as provided by EM
[tracker configure:@"test" tld:@"testiOS.com" sdkKey:@"sdk-key-here"];

// Actually track the default event and specify content
// Use Empty string if content descriptor not required
[tracker trackContent:@”contentDescip"];

Important: Please do not reverse the TLD. The domain labels should appear in their natural order and must be valid domain names.

If you need to change other settings, please refer to the EmTracker.h header file for a reference of iOS-specific options (and tracker methods) and how to use them.

Using With Swift

To use the library within a Swift application, you need to import it using a bridging header and then import the header file ( EmTracker.h) within it.

How to create a Bridging Header

  1. In your Swift project, create a new file. When prompted, select Objective-C File.
  2. Give this file a temporary name, such as placeholder.m.
  3. Click Finish, and Xcode will prompt you to create a Bridging Header. If it doesn't, you probably already have a Bridging Header in your project.
  4. Press Create Bridging Header to continue. Xcode will automatically create the new header file for you.
  5. Delete your placeholder.h and placeholder.m files from the project. You will notice a new file called {APPLICATION_NAME}-Bridging-Header.h.
  6. Add the following import statement to the new Bridging Header:
    #import "EmTracker.h 


Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.