tvOS Quick Start

Current tvOS SDK Version 4.12.2.

The TUNE SDK for the native tvOS platform provides application session and event logging functionality. The TUNE SDK for tvOS is available in the form of a framework that you simply include in your tvOS project; it is compatible with Apple TV devices, and both Automatic Reference Counting (ARC) and non-ARC projects on tvOS versions 9.0 and above.

To begin measuring sessions and events, first integrate the TUNE SDK for tvOS with your AppleTV app. After you initiate the “measureSession" method, you can rely on Attribution Analytics to log in-app events (such as purchases, game levels, and any other user engagement).

Follow this Quick Start to get the TUNE SDK up-and-running in no time. If you’re implementing the TUNE SDK for tvOS apps written in the Swift programming language with Xcode 7.1+, then please visit Including TUNE iOS Objective-C SDK in a Swift project.

Supported TMC Solutions

The TUNE SDK for tvOS supports the following TUNE Marketing Console solutions:

  • Attribution Analytics
  • App Store Analytics

Downloading the SDK

The effective size of TUNE SDK for tvOS is up to ~1.1MB when the project tvOS deployment target is 9.0. Before you can download the TUNE SDK, make sure to add your app to the Attribution Analytics platform .

After it’s added to the TUNE platform, you can either Download and install the SDK yourself, or Install the Tune CocoaPod.

The Tune SDK is also available as an open-source framework with libraries for session and event measurement. To access the open source SDK, please visit GitHub.

Implementation

  1. Unzip and copy the Tune_tvos.framework folder into your source tree.
  2. Add the Tune_tvos.framework to your Xcode® project:At the top of the Project Navigator, click the project name.
    1. On the General tab, scroll down to the bottom to see (Linked Frameworks and Libraries).
    2. To add a new framework, click the “+” sign, and then click Add Other….
    3. Browse to and select the Tune_tvos.framework folder, and then click Open.

     

    iOS-framework

  3. Add the following additional frameworks to your project:
    • AdSupport.framework
    • MobileCoreServices.framework
    • StoreKit.framework
    • SystemConfiguration.framework
    • UserNotifications.framework (only on iOS 10+)

Once you have added your AppleTV app to the platform, you can download the SDK whenever you like by navigating to Mobile Apps, clicking on the Download SDK button and choosing your app from the drop down menu.

In your AppDelegate.m, import Tune_tvos and initialize it.

#import <MobileAppTracker_tvos/MobileAppTracker.h>
#import <AdSupport/AdSupport.h>
 
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Account Configuration info - must be set
    [Tune initializeWithTuneAdvertiserId:@"your_advertiser_ID"
                       tuneConversionKey:@"your_conversion_key"];
 
    // Check if a deferred deep link is available and handle opening of the deep link as appropriate in the success tuneDidReceiveDeeplink: callback.
    // Uncomment this line if your MAT account has enabled deferred deep links
    //[Tune checkForDeferredDeeplink:self];
 
    // Uncomment this line to enable auto-measurement of successful in-app-purchase (IAP) transactions as "purchase" events
    //[Tune automateIapEventMeasurement:YES];
 
    return YES;
}
 
- (void)applicationDidBecomeActive:(UIApplication *)application
{
    // MAT will not function without the measureSession call included
    [Tune measureSession];
}
 
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    [Tune applicationDidOpenURL:[url absoluteString] sourceApplication:sourceApplication];
 
    return YES;
}

Things to Keep in Mind

The “your_advertiser_ID” and the “your_conversion_key” values correlate with the Advertiser ID and Conversion Key that TUNE provides when you create your AppleTV App in Attribution Analytics. For information about the advertiser ID and conversion key, please visit Finding Advertiser ID and Conversion Key.

For information about deferred deep linking, please visit Implementing a Deferred Deep Link.

If your app already has a pre-existing user base (people who have already installed your app), TUNE has several options to flag these users as Pre-Existing Users to prevent attributing these users to a marketing partner. For information about migrating existing users, please visit handle existing users prior to SDK implementation.

The TUNE SDK for tvOS supports automatic measurement of successful in-app-purchase events. This feature can be optionally enabled through the corresponding Tune setter. Once auto-measurement is enabled, you do not need to and should not explicitly measure successful “purchase” events to avoid duplicate event measurement. For more info, please visit IAP Event Measurement.

The TUNE SDK for tvOS automatically collects the Identifier for Advertising (IFA) when AdSupport.framework has been imported. IFA collection improves event attribution on iOS. When you use IFA in your tv app, make sure you identify the purpose of its use when submitting your app in iTunes Connect. If you decide against collecting IFA, learn about the Implications of Removing Apple’s IFA.

 

Testing & Troubleshooting

To test the TUNE SDK implementation in your tv app, you can do so straight from the Attribution Analytics platform itself rather than creating a test environment. Please visit Testing Your App.

 

Measuring Events

After you implement the TUNE SDK in your tv app and start logging sessions, you can move on to logging a wide variety of in-app events such as registrations and in-app purchases.

By logging and analyzing in-app events, you can more efficiently optimize both the functionality of your app and your advertising strategies. Bottom line? Understanding how your users interact with your tv app directly impacts your ability to build effective and profitable advertising campaigns by enabling you to compare retention, engagement, and lifetime value (LTV) to your costs.

Or to build your own custom event, please see our Event Builder article.

In-App Events

No Comments

Leave a reply