Getting Started with Marin iOS SDK

Everything you need to start building audiences and tracking conversions in your apps.

Installation

Here is how to import the Marin iOS SDK into your app

  1. Setup CocoaPods (dependency management for iOS apps) if you have not already. See guide here.
  2. Download the SDK to your computer.
  3. Open a terminal and navigate to your project directory.
  4. Create a Podfile in your project if you don't have one already. See guide here.
  5. Reference the Marin iOS SDK in your Podfile
pod 'Marin-iOS-SDK', path: '../path/to/unzipped/Marin iOS SDK directory'

Note: The SDK currently supports iOS 6.0 and later. Please be sure your application targets an iOS platform version equal to or greater than 6.0.

Your Podfile should look similar to this:

source 'https://github.com/CocoaPods/Specs'

platform :ios, '6.0'

pod 'Marin-iOS-SDK', path: '../path/to/unzipped/Marin iOS SDK directory'
  1. Run this command in your projects directory in a terminal console
$ pod install

to add the Marin iOS SDK to your workspace.

Setup

  1. Import the header of the SDK into your project. To do this, we recommend importing the Marin SDK into your AppDelegate.
#import <Marin-iOS-SDK/Marin.h>
  1. Next, look up the "Advertiser ID" for the advertiser you want the SDK to talk to in your Perfect Audience account. You can find the Advertiser ID by visiting the "User Tracking" page in your "Manage" navigation tab and looking at the top right of the User Tracking page

  2. Next, initialize the SDK by executing the following code snippet using the Advertiser ID from the previous step with the didFinishLaunchingWithOptions method in your AppDelegate.

[Marin start:@"< advertiser id goes here >"];
  1. Now that the SDK is installed and initialized, you will begin tracking app opens.

Commands

Here is how to track an event. By Tracking this event this will create a related
segment.

[Marin trackEvent:@"event1" withMetadata:nil];

Here is how to track a product viewing:

[Marin trackProductView:@"product1" withMetadata:nil];

And here is how to track an event with the extra data needed for a conversion. Conversions need to be setup in the app to read these events.

[Marin trackEvent:@"Purchase"
       withOrderId:@"12345"
           revenue:@"19.99"
conversionMetadata:nil
          metadata:nil];

Did this page help you?