Getting Started with Marin iOS SDK
Everything you need to start building audiences and tracking conversions in your apps.
Here is how to import the Marin iOS SDK into your app
- Setup CocoaPods (dependency management for iOS apps) if you have not already. See guide here.
- Download the SDK to your computer.
- Open a terminal and navigate to your project directory.
- Create a Podfile in your project if you don't have one already. See guide here.
- 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'
- Run this command in your projects directory in a terminal console
$ pod install
to add the Marin iOS SDK to your workspace.
- Import the header of the SDK into your project. To do this, we recommend importing the Marin SDK into your AppDelegate.
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
Next, initialize the SDK by executing the following code snippet using the Advertiser ID from the previous step with the
didFinishLaunchingWithOptionsmethod in your AppDelegate.
[Marin start:@"< advertiser id goes here >"];
- Now that the SDK is installed and initialized, you will begin tracking app opens.
Here is how to track an event. By Tracking this event this will create a related
[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];
Updated less than a minute ago