Article

Generating the Signature to Validate an Installation

Initiate install validation by displaying an ad with signed parameters.

Overview

The process of install validation informs an ad network when users install and launch a product purchased after viewing an ad. Ad networks initiate validation by providing signed information, including a campaign ID, when displaying the ad. Later, if the ad results in a conversion, Apple notifies the ad network with a postback that includes the same campaign ID.

The method you call to display an advertised product and initiate a validation, loadProduct(withParameters:completionBlock:), requires a signature key that you generate. To generate the signature (SKStoreProductParameterAdNetworkAttributionSignature), you combine the required values from Ad Network Install Validation Keys and sign the resulting string.

Combine the Parameters

In the first step of generating the signature, use the following values of Ad Network Install Validation Keys:

SKStoreProductParameterAdNetworkIdentifier

The ad network identifier you registered with Apple.

SKStoreProductParameterAdNetworkCampaignIdentifier

A campaign number you provide.

SKStoreProductParameterITunesItemIdentifier

The item identifier of the product to advertise.

SKStoreProductParameterAdNetworkNonce

A unique UUID value that you provide for each ad impression. The string representation of this nonce used in the signature must be in lowercase.

SKStoreProductParameterAdNetworkTimestamp

A timestamp you generate near the time of the ad impression.

Combine the values into a UTF-8 string with an invisible separator ('\u2063') between them, in the order exactly as shown:

ad-network-id + '\u2063' + campaign-id + '\u2063' + itunes-item-id + '\u2063' + nonce + '\u2063' + timestamp

Sign the Combined String

Sign the combined UTF-8 string with the following key and algorithm:

  • Your PKCS#8 private key, downloaded from App Store Connect.

  • The Elliptic Curve Digital Signature Algorithm (ECDSA) with a SHA-256 hash.

The result should be a Digital Encoding Rules (DER)-formatted binary value, which is the signature.

Encode the Signature

Encode the binary signature you generated into a Base64 string. The result is your ad network attribution signature, SKStoreProductParameterAdNetworkAttributionSignature. The signature string will look similar to:

MEQCIEQlmZRNfYzKBSE8QnhLTIHZZZWCFgZpRqRxHss65KoFAiAJgJKjdrWdkLUOCCjuEx2RmFS7daRzSVZRVZ8RyMyUXg==

Use the Generated Signature String

After you generate the signature, you have all the required Ad Network Install Validation Keys values. You are ready to call loadProduct(withParameters:completionBlock:) and intiate a validation.

If the user installs and launches the advertised product, you will receive an install validation postback. See Verifying an Install Validation Postback.

See Also

Initiating Install Validation

Ad Network Install Validation Keys

The keys for validating and associating an app installation with an ad campaign.