• Home
  • All
  • How to get started with the e-Marketer iOs SDK

Table of Contents

How to get started with the e-Marketer iOs SDK

This is as simple as to download the SDK archive from here. Extract it. Then create a new xcode project, or open an existing one, and drag the eMarketerIosSdk.swift file from Finder to the “Project Navigator” panel on the left of the xcode screen, where other project files are.

The SDK is ready. To feel like it works add the following swift code to viewDidLoad() of your ViewController, or somewhere else:

do
{   let tracker = try eMarketerTracker(apiKey: "0011223344556677889900112233445566778899")
    tracker.navigate(documentName: "ViewController")
    tracker.done()
}
catch
{   print(error)
}

Use your API key instead of “0011223344556677889900112233445566778899”. API keys for your account can be found on e-Marketer in the “Settings” → “Integrations” page here. You need the full-featured key.

The code above logs a navigation to page called “ViewController”.

You can look up this request on e-Marketer  Live Visits Dashboard. In filters, select “Pages” → “only containing” → “ViewController”.