<!--
{
  "documentType" : "article",
  "framework" : "SKAdNetworkforWebAds",
  "identifier" : "/documentation/SKAdNetworkforWebAds/generating-a-signature-for-attributable-web-ads",
  "metadataVersion" : "0.1.0",
  "role" : "article",
  "title" : "Generating a signature for attributable web ads"
}
-->

# Generating a signature for attributable web ads

Initiate install-validation by providing the signed parameters for an attributable web ad.

## Discussion

A user’s device calls the [`Get a Signed Web Ad Impression Payload`](/documentation/SKAdNetworkforWebAds/Get-a-signed-SKAdNetwork-ad-payload-for-a-web-ad.) endpoint on your server when a user taps the web ad that you create using the instructions in [Creating an attributable ad link](/documentation/SKAdNetworkforWebAds/creating-an-attributable-ad-link). To respond to the request, you need to provide the values in the [`AdImpressionResponse`](/documentation/SKAdNetworkforWebAds/AdImpressionResponse), which includes a cryptographic signature.

To generate the signature, combine the required values from the [`signature`](/documentation/SKAdNetworkforWebAds/signature) object and cryptographically sign the resulting string. Use the ad network ID and PKCS#8 private key that you establish when registering to use the API. For more information, see <doc://com.apple.documentation/documentation/StoreKit/registering-an-ad-network>.

### Combine the parameters

Create the UTF-8 string using the required [`signature`](/documentation/SKAdNetworkforWebAds/signature) object parameters.

> Important:
> Lowercase the string representation of the nonce from the ``doc://com.apple.skadnetworkforwebads/documentation/SKAdNetworkforWebAds/signature`` object. Failing to do so results in an invalid signature. Only ads with valid signatures can get ad attributions.

Combine the values into a UTF-8 string with an invisible separator (`‘\u2063’`) between them, in the exact order the code below shows:

```c
version + '\u2063' + ad_network_id + '\u2063' + source_identifier + '\u2063' + itunes_item_id + '\u2063' + nonce + '\u2063' + source_domain + '\u2063' + fidelity_type + '\u2063' + timestamp
```

### Sign the combined string

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

- Your PKCS#8 private key.
- The Elliptic Curve Digital Signature Algorithm (ECDSA) with a SHA-256 hash.

The resulting Digital Encoding Rules (DER)-formatted binary value is the signature.

### Encode the signature

Encode the binary signature you generate into a Base64 string. The result is your ad network attribution signature. The signature string should look similar to the following:

```swift
MEQCIEQlmZRNfYzKBSE8QnhLTIHZZZWCFgZpRqRxHss65KoFAiAJgJKjdrWdkLUOCCjuEx2RmFS7daRzSVZRVZ8RyMyUXg==
```

For more information about Base64 encoding, see <doc://com.apple.documentation/documentation/Foundation/Data/base64EncodedString(options:)>.

### Use the generated signature string

After you generate the signature, use this value in the `signature` parameter of the [`AdImpressionResponse`](/documentation/SKAdNetworkforWebAds/AdImpressionResponse). If the user installs and launches the advertised app, the attribution-winning ad network receives an install-validation postback. For more information about postbacks, see <doc://com.apple.documentation/documentation/StoreKit/verifying-an-install-validation-postback>.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)