How to install the iOS SDK

(We also have a video available that explains this process.)

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, initialize the SDK by executing the following code snippet witn the didFinishLaunchingWithOptionsmethod 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];

Feedback and Knowledge Base