Apple’s SKAdNetwork | End-to-End Validation

Post on December 10, 2020 by Pramod Jadhav

Pramod Jadhav Senior Principal Software Engineer Development: Emerging Solutions

Apple introduced new features and changes with iOS 14, two of these are developer-centric updates that could have an impact on in-app advertising.

The ATT (App Tracking Transparency) framework, which manages access to the IDFA (Identifier for Advertisers), will require user consent. With the shift of IDFA opt-out to opt-in, many users may not opt-in for tracking. This could impact the advertising and user acquisition ecosystem on iOS.

Apple introduced the SKAdNetwork in 2018, a different approach to campaign measurement for when user-level data is not available. With iOS 14, the SKAdNetwork framework gets a version upgrade, which could relieve some of the impact from reduced IDFA access for mobile app install attribution.

SKAdNetwork Overview

SKAdNetwork is the Apple framework which validates advertiser-driven app installations. It allows registered advertising networks to attribute app installations to a particular campaign. This enables advertisers to measure campaign effectiveness while maintaining user privacy.

The ad network API involves three participants:

  • Ad network: sign ads and receive install/postback notifications
  • Publisher App/Source App: Display ads provided by the ad networks
  • Advertiser App: It appear in the signed ads

The following diagram describes the path of an install validation. App A is the source/publisher app that displays an ad. App B is the advertised app that the user installs.

**SKAdNetwork passing data back to ad platforms (Source: Apple)

  1. The Ad Network registers to SKAdNetwork and supplies a signed ad to the publisher app
  2. The publisher app (A) displays the ad by calling the loadProduct(withParameters:completionBlock:) method. It also must have the ad network ID in its Info.plist
  3. The advertiser app (B) calls registerAppForAdNetworkAttribution() and optionally updates a conversion value using updateConversionValue(_:)
  4. Once the 24-48 hour timer expires, the device sends a postback to the registered SKAdNetwork endpoint.

This looks simple but there was a wait for a postback after app installs. It was unexpected to not get a postback after doing all required setup, no error logs, no easy debugging process available to know if something went wrong under the hood.

Finally, after multiple re-runs, setup adjustments and the SKAdNetwork team’s help, we received a postback. The next section explains the standard setup.

Setup

In the validation flow this includes the publisher app, advertiser app, and APIs for getting signed ads and consuming postback requests from Apple.

Registration

This includes one-time registration with Apple to get a dedicated SKAdNetwork ID, using registering an ad network. When registering, you:

  • Receive your ad network ID
  • Create an elliptic curve cryptographic key pair and share your public key with Apple, for signature verification
  • Provide a URL for receiving SKAdNetwork install validation postback requests

Note: At our registration time we used prime192v1 curve as the Apple guidesuggests, but it has changed now to prime256v1, required to generate private-public key pair

After requesting an SKAdNetwork ID from Apple, within a couple of days we received a response from Apple, that our ID was created and they need a postback API where Apple will trigger the postback request.

Ad Server & Postback API

Requires two API endpoints to test the SKAdNetwork flow end-to-end

  • Ad server – Generates a signed ad and responds with all SKAdNetwork information as part of the ad response
  • Postback API – Receives postback though HTTP-POST method

Our ad server is based on RTB (Real time bidding) specifications and it sends SKAdNetwork information as skadn object in the bid response. Demonstrative code is available here.

Prepare Publisher App

It is ideal to use a published app from the App Store, however it is also acceptable to use any developer profile signed app, loaded from Xcode on the device for testing purpose. Follow the below steps to prepare the app:

  • Add the ad network’s ID received from Apple to its Info.plist: see Configuring the Participating Apps.
  • Ensure you use source-app-id as `0` while generating a signature if using a test developer profile signed app for SKAdNetwork v2.

For our test we created own test app using OpenWrap SDK, refer to Sample Publisher Application source code for more details.

Prepare Live Advertiser App

The application is downloaded from App Store and in the installation process it initiates the attribution event. This app should:

Note, to use updateConversionValue(_:), The app should be built with Xcode 12.x. Ideal place to call registerAppForAdNetworkAttribution() is the app’s entry point, i.e. app delegate.

Refer to Sample App, which shows sample code for calling app registration for ad network attribution and updating the conversion value.

We used OpenWrap SDK App, which is available on the App Store, as an advertiser app for testing.

Test on a device

You need to use a physical device for testing as simulators do not have access to the App Store.

Apple recently introduced the SKAdNetwork profile, which saves the 24-48 hours wait for postback notification. You can install it on your test device to reduce the postback timeline from 24-48 hours to 5-10 minutes. This is particularly useful for debugging purposes. You can download it using an Apple developer account here.

We tested our publisher app on an iPhone running iOS 14. App interaction screens are below, showing installation of the OpenWrap SDK iOS Application.

Troubleshooting Steps

As result, we have some tips which can save you time:

  • Ensure your publisher app has a proper SKAdNetwork ID configured correctly in plist.
  • Postback will be sent directly from the device to the registered SKAdNetwork endpoint, so make sure a device is connected. If your publisher app is dev-signed, then Apple will ignore the privacy thresholds (finding that this is a test) and always send the postback with source-app-id as 0.
  • Keep in mind that it can take up to 48 hours to receive a postback from the device starting from the registerAppForAdNetworkAttribution() call or last updateConversionValue(_:) call. You can install Apple’s SKAdNetwork Profile to reduce the timeline for debugging purposes.
  • Ensure all data types are correct for values passed to loadProduct(withParameters:completionBlock:) call.
  • To check logs generated by the App Store app on your device you can follow these instructions, App store logging Instructions, requiring a developer login. Please ensure that the sysdiagnose log is captured 11 minutes or later after advertised app has been installed and opened.

Early investigation of SKAdNetwork helped us make our platform ready for customers who wants to use SKAdNetwork, to help measuring campaign effectiveness. In addition, PubMatic OpenWrap SDK added SKAdNetwork support in 1.6.2 release. Please find more details here. To help you understand the flow, you can view our sample source code.