### Configure Install Attribution Cooldown
Source: https://developer.apple.com/documentation/adattributionkit/configuring-attribution-rules-for-your-app
Sets the installation cooldown period to 24 hours. The system will wait for this duration after an install conversion before accepting new conversions.
```xml
AttributionCooldown
install-cooldown-hours
24
```
--------------------------------
### Example AdAttributionKit Postback JSON
Source: https://developer.apple.com/documentation/adattributionkit/identifying-the-parameters-in-a-postback
This is an example of the JSON stanza your servers receive from AdAttributionKit. It contains key-value pairs representing attribution data.
```json
{
"jws-string": "eyJraWQiOiJhcHBsZS1kZXZlbG9wbWVudC1pZGVudGlmaWVyXC8xIiwiYWxnIjoiRVMyNTYifQ.eyJwb3N0YmFjay1pZGVudGlmaWVyIjoiODU1NDZFQjctRkQzOS00NEJDLTg5OTAtQzk4QTRBQzM2QTQ5IiwicHVibGlzaGVyLWl0ZW0taWRlbnRpZmllciI6MCwibWFya2V0cGxhY2UtaWRlbnRpZmllciI6ImNvbS5hcHBsZS5BcHBTdG9yZSIsImltcHJlc3Npb24tdHlwZSI6ImFwcC1pbXByZXNzaW9uIiwiYWQtbmV0d29yay1pZGVudGlmaWVyIjoiZGV2ZWxvcG1lbnQuYWRhdHRyaWJ1dGlvbmtpdCIsImRpZC13aW4iOnRydWUsInBvc3RiYWNrLXNlcXVlbmNlLWluZGV4IjowLCJjb252ZXJzaW9uLXR5cGUiOiJyZS1lbmdhZ2VtZW50Iiwic291cmNlLWlkZW50aWZpZXIiOiIxMjM0IiwiYWR2ZXJ0aXNlZC1pdGVtLWlkZW50aWZpZXIiOjEwNzM4MDI3NzU2fQ.bAdNwKd6OfHK9tofvjjua4X_JPcFTxXPQSspD9gZkinw97pY7R1aI-LSjl-oxZZF3_K2H5JK5TSEBee4_1U4oQ",
"conversion-value": 24,
"ad-interaction-type": "click",
"country-code": "US"
}
```
--------------------------------
### Call beginView() to Start Impression
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/beginview%28%29
Call `beginView()` within a do-catch block to handle potential errors during the view impression process. This example shows how to initiate the view-through impression recording.
```swift
func handleAdAppeared(impression: AppImpression) async {
do {
try await impression.beginView()
}
catch {
print("Failed to begin view-through impression: \(error).")
}
}
```
--------------------------------
### PostbackUpdate.ConversionType.install
Source: https://developer.apple.com/documentation/adattributionkit/postbackupdate/conversiontype/install
Represents the installation of an app following an ad interaction. In attribution reports, this is conveyed using the strings 'download' or 'redownload'.
```APIDOC
## PostbackUpdate.ConversionType.install
### Description
The value that represents the installation of an app after an ad interaction.
### Method
N/A (Enum Case)
### Endpoint
N/A (Enum Case)
### Parameters
N/A
### Request Example
N/A
### Response
#### Success Response (N/A)
N/A
#### Response Example
N/A
### Discussion
In the attribution report, the framework represents this using the strings _download_ or _redownload_ , depending on the kind of installation.
```
--------------------------------
### Configure Global Install Attribution Window (View)
Source: https://developer.apple.com/documentation/adattributionkit/configuring-attribution-rules-for-your-app
Sets the global attribution window for view impressions to 3 days. This configuration is placed within the `AttributionWindows` dictionary in your app's `Info.plist`.
```xml
AdAttributionKitConfigurations
AttributionWindows
global
install
view
3
```
--------------------------------
### Configure Per-Ad Network Install Attribution Window (Click)
Source: https://developer.apple.com/documentation/adattributionkit/configuring-attribution-rules-for-your-app
Sets the attribution window for click impressions to 23 days for the ad network with the ID 'test.adattributionkit'. This configuration allows for granular control over attribution windows for specific ad partners.
```xml
AttributionWindows
test.adattributionkit
install
click
23
```
--------------------------------
### Compact JWS Impression Example
Source: https://developer.apple.com/documentation/adattributionkit/generating-jws-impressions
This is an example of a fully signed compact JWS impression, formatted as a UTF-8 string, ready to be passed into the AdAttributionKit API. It combines the signed header and payload.
```text
eyJraWQiOiJleGFtcGxlLmFkYXR0cmlidXRpb25raXQiLCJhbGciOiJFUzI1NiJ9.eyJhZHZlcnRpc2VkLWl0ZW0taWRlbnRpZmllciI6MTEwODE4NzM5MCwiYWQtbmV0d29yay1pZGVudGlmaWVyIjoiZXhhbXBsZS5hZGF0dHJpYnV0aW9ua2l0IiwiaW1wcmVzc2lvbi10eXBlIjoiYXBwLWltcHJlc3Npb24iLCJlbGlnaWJsZS1mb3ItcmUtZW5nYWdlbWVudCI6dHJ1ZSwidGltZXN0YW1wIjoxNzE5NTk5OTU3MjM5LCJwdWJsaXNoZXItaXRlbS1pZGVudGlmaWVyIjo1ODM4NDkyLCJpbXByZXNzaW9uLWlkZW50aWZpZXIiOiI1NDRCOEZBRC0wQUQ1LTQ0MzQtOThCMi0zMjcxMTNBRjg0REIiLCJzb3VyY2UtaWRlbnRpZmllciI6NTIzOX0.zxQ_HcpB7pK6lWOms4LZ8uK3sZu_0S-bPR0My7UY4QlEAYFP-wp5eN1WuHOmNwoPD5cgazpwA3o5xq-fhfpOEQ
```
--------------------------------
### Example JWS Header Structure
Source: https://developer.apple.com/documentation/adattributionkit/identifying-the-parameters-in-a-postback
This structure represents the JWS header of the postback, containing the encryption algorithm and key identifier used by Apple.
```json
{
"kid": "apple-development-identifier/1",
"alg": "ES256"
}
```
--------------------------------
### handleTap(reengagementURL:)
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/handletap%28reengagementurl%3A%29
Processes click-through interactions on custom rendered ad content and delivers a URL to the advertised app if it is installed.
```APIDOC
## handleTap(reengagementURL:)
### Description
Processes click-through interactions on your custom rendered ad content, and delivers a URL to the advertised app if it’s installed.
### Method
Swift Instance Method
### Parameters
#### Path Parameters
- **reengagementURL** (URL) - Required - A universal link into the advertised app that the framework attempts to open.
### Discussion
Use this method to provide a URL to deeply link someone into an advertised app if they have the app installed. If the system can validate that a person tapped the custom rendered ad content, it attempts to either launch one of the installed marketplaces to show the product page to install the advertised app, or performs a reengagement if the advertised app is already installed, and opens the reengagement URL.
```
--------------------------------
### Example JWS Payload Structure
Source: https://developer.apple.com/documentation/adattributionkit/identifying-the-parameters-in-a-postback
This structure represents the decoded JWS payload of the postback, containing detailed attribution information signed by Apple.
```json
{
"postback-identifier": "85546EB7-FD39-44BC-8990-C98A4AC36A49",
"publisher-item-identifier": 0,
"marketplace-identifier": "com.apple.AppStore",
"impression-type": "app-impression",
"ad-network-identifier": "development.adattributionkit",
"did-win": true,
"postback-sequence-index": 0,
"conversion-type": "re-engagement",
"source-identifier": "1234",
"advertised-item-identifier": 10738027756
}
```
--------------------------------
### AppImpression - handleTap(reengagementURL:)
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/handletap%28%29
Processes click-through interactions on your custom rendered ad content and delivers a URL to the advertised app if it's installed. This is an alternative to the basic handleTap() method.
```APIDOC
## POST /websites/developer_apple_adattributionkit/handleTap/reengagement
### Description
Processes click-through interactions on your custom rendered ad content and delivers a URL to the advertised app if it's installed. This is an alternative to the basic handleTap() method.
### Method
POST
### Endpoint
/websites/developer_apple_adattributionkit/handleTap/reengagement
### Parameters
#### Query Parameters
- **impression** (AppImpression) - Required - The AppImpression object associated with the ad.
- **reengagementURL** (URL) - Required - The URL to the advertised app for re-engagement.
### Request Example
(Example not provided in source text)
### Response
#### Success Response (200)
Indicates that the click-through interaction was processed successfully.
#### Response Example
(No specific response body is defined for success, typically an empty response or a success status)
### Error Handling
- **Error**: Throws an error if the tap cannot be validated or if the method is called after the 15-minute window.
```
--------------------------------
### GET PostbackUpdate.conversionTag
Source: https://developer.apple.com/documentation/adattributionkit/postbackupdate/conversiontag
Retrieves the conversion tag associated with a PostbackUpdate instance.
```APIDOC
## GET PostbackUpdate.conversionTag
### Description
The conversionTag property is an instance property used to identify conversion values. It is available in iOS 18.4+ and iPadOS 18.4+.
### Property Definition
`let conversionTag: String?`
```
--------------------------------
### AppImpression - handleTap()
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/handletap%28%29
Processes click-through interactions on your custom rendered ad content. If the system can validate the tap, it attempts to launch the App Store or re-engage with an installed app. This method must be called within 15 minutes of creating the AppImpression instance and requires a UIEventAttributionView to be present on top of the ad content.
```APIDOC
## POST /websites/developer_apple_adattributionkit/handleTap
### Description
Processes click-through interactions on your custom rendered ad content. If the system can validate the tap, it attempts to launch the App Store or re-engage with an installed app. This method must be called within 15 minutes of creating the AppImpression instance and requires a UIEventAttributionView to be present on top of the ad content.
### Method
POST
### Endpoint
/websites/developer_apple_adattributionkit/handleTap
### Parameters
#### Query Parameters
- **impression** (AppImpression) - Required - The AppImpression object associated with the ad.
### Request Example
```swift
func handleAdTapped(impression: AppImpression) async {
do {
// This fails if a person didn't tap a `UIEventAttributionView`.
try await impression.handleTap()
}
catch {
print("Failed to perform click-through impression: \(error).")
}
}
```
### Response
#### Success Response (200)
Indicates that the click-through interaction was processed successfully.
#### Response Example
(No specific response body is defined for success, typically an empty response or a success status)
### Error Handling
- **Error**: Throws an error if the tap cannot be validated or if the method is called after the 15-minute window.
```
--------------------------------
### GET /PostbackUpdate/conversionTypes
Source: https://developer.apple.com/documentation/adattributionkit/postbackupdate/conversiontypes
Defines the conversion types used by the system to determine which postbacks to update.
```APIDOC
## Property: conversionTypes
### Description
An array of conversion types the system uses to determine which postbacks to update with this postback update. If set to nil, the system updates all types of postbacks by default.
### Type
[PostbackUpdate.ConversionType]?
### Availability
- iOS 18.0+
- iPadOS 18.0+
- Mac Catalyst
```
--------------------------------
### Update postbacks by conversion type
Source: https://developer.apple.com/documentation/adattributionkit/receiving-ad-attributions-and-postbacks
Use PostbackUpdate to specify whether to update install or reengagement postbacks. This allows for distinct conversion value attribution based on the user's conversion type.
```swift
private func attributeCustomerAccountCreated() async {
do {
// Updates any active install postbacks with a conversion value of 20.
let installPostbackUpdate = PostbackUpdate(fineConversionValue: 20, lockPostback: false, conversionTypes: [.install])
try await Postback.updateConversionValue(installPostbackUpdate)
// Updates any active reengagement postbacks with a conversion value of 12.
let reengagementPostbackUpdate = PostbackUpdate(fineConversionValue: 12, lockPostback: false, conversionTypes: [.reengagement])
try await Postback.updateConversionValue(installPostbackUpdate)
}
catch {
print("Failed to update postback conversion value: \(error)")
}
}
```
--------------------------------
### Define PostbackUpdate.ConversionType Enumeration
Source: https://developer.apple.com/documentation/adattributionkit/postbackupdate/conversiontype
Defines the possible types of conversions for postbacks. Use this enumeration to specify whether a conversion represents an app installation or a user re-engaging with an existing app.
```swift
enum ConversionType
```
--------------------------------
### Process Ad Tap with Reengagement URL
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/handletap%28reengagementurl%3A%29
Use this method to provide a URL to deeply link someone into an advertised app if they have the app installed. The URL must be a universal link for the advertised app.
```swift
func handleTap(reengagementURL: URL) async throws
```
--------------------------------
### Get Error Description
Source: https://developer.apple.com/documentation/adattributionkit/adattributionkiterror/description
Use this property to retrieve a string that describes the error. Available on iOS 17.4+, iPadOS 17.4+, and Mac Catalyst.
```swift
var description: String { get }
```
--------------------------------
### Add Ad Network Identifiers to Info.plist
Source: https://developer.apple.com/documentation/adattributionkit/configuring-a-publisher-app
Include this array in your Xcode project's Information Property List to specify ad networks eligible for install validation. Ensure each ad network ID is a string value.
```plist
"AdNetworkIdentifiers": [
"f2d92a.adattributionkit",
"2jida.adattributionkit"
]
```
--------------------------------
### Instance Method: beginView()
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/beginview%28%29
Begins recording a view-through impression when ad content corresponding to the impression becomes visible. Available on iOS 17.4+, iPadOS 17.4+, and Mac Catalyst.
```APIDOC
## Instance Method: beginView()
### Description
Begins recording a view-through impression when ad content corresponding to the impression becomes visible.
### Method
`async throws`
### Endpoint
N/A (Instance Method)
### Parameters
This method does not take any parameters.
### Request Example
```swift
func handleAdAppeared(impression: AppImpression) async {
do {
try await impression.beginView()
}
catch {
print("Failed to begin view-through impression: \(error).")
}
}
```
### Response
This method does not return a value directly but can throw an error if the process fails.
#### Error Handling
- `Error`: Thrown if the view-through impression recording fails.
```
--------------------------------
### init(fineConversionValue:lockPostback:conversionTag:coarseConversionValue:conversionTypes:)
Source: https://developer.apple.com/documentation/adattributionkit/postbackupdate/init%28fineconversionvalue%3Alockpostback%3Aconversiontag%3Acoarseconversionvalue%3Aconversiontypes%3A%29
Initializes a new PostbackUpdate instance with specific conversion parameters.
```APIDOC
## init(fineConversionValue:lockPostback:conversionTag:coarseConversionValue:conversionTypes:)
### Description
Initializes a PostbackUpdate object to manage attribution conversion data.
### Parameters
- **fineConversionValue** (Int) - Required - The fine-grained conversion value.
- **lockPostback** (Bool) - Required - Whether to lock the postback.
- **conversionTag** (String) - Required - The conversion tag string.
- **coarseConversionValue** (CoarseConversionValue?) - Optional - The coarse conversion value, defaults to nil.
- **conversionTypes** ([PostbackUpdate.ConversionType]?) - Optional - An array of conversion types, defaults to nil.
### Request Example
```swift
let update = PostbackUpdate(
fineConversionValue: 1,
lockPostback: true,
conversionTag: "example_tag"
)
```
--------------------------------
### Initialize PostbackUpdate
Source: https://developer.apple.com/documentation/adattributionkit/postbackupdate/init%28fineconversionvalue%3Alockpostback%3Acoarseconversionvalue%3Aconversiontypes%3A%29
Use this initializer to create a new postback update. Provide the fine conversion value, a boolean indicating if the postback should be locked, and optionally, the coarse conversion value and an array of conversion types. Defaults are nil for optional parameters.
```swift
init(
fineConversionValue: Int,
lockPostback: Bool,
coarseConversionValue: CoarseConversionValue? = nil,
conversionTypes: [PostbackUpdate.ConversionType]? = nil
)
```
--------------------------------
### PostbackUpdate.ConversionType.reengagement
Source: https://developer.apple.com/documentation/adattributionkit/postbackupdate/conversiontype/reengagement
Represents a user re-engaging with an app they have previously installed. This is applicable for iOS 18.0+, iPadOS 18.0+, and Mac Catalyst.
```APIDOC
## PostbackUpdate.ConversionType.reengagement
### Description
The value that represents someone re-engaging with an app they’ve previously installed.
### Supported Platforms
iOS 18.0+
iPadOS 18.0+
Mac Catalyst
### Code Representation
```swift
case reengagement
```
### Discussion
In the attribution report, the framework represents this using the string `_re-engagement_`.
```
--------------------------------
### init(fineConversionValue:lockPostback:coarseConversionValue:conversionTypes:)
Source: https://developer.apple.com/documentation/adattributionkit/postbackupdate/init%28fineconversionvalue%3Alockpostback%3Acoarseconversionvalue%3Aconversiontypes%3A%29
Creates a new postback update with the conversion values, conversion types, and lock indication provided.
```APIDOC
## init(fineConversionValue:lockPostback:coarseConversionValue:conversionTypes:)
### Description
Creates a new postback update with the conversions values, conversion types, and lock indication you provide.
### Parameters
- **fineConversionValue** (Int) - Required - An integer that represents the fine conversion value.
- **lockPostback** (Bool) - Required - A Boolean value that indicates whether the system can lock the postback, reducing the system time to deliver a signal.
- **coarseConversionValue** (CoarseConversionValue?) - Optional - An optional enumeration value that represents the coarse conversion value. Defaults to nil.
- **conversionTypes** ([PostbackUpdate.ConversionType]?) - Optional - An optional array of conversion types the system uses to determine which postbacks to update. Defaults to nil.
```
--------------------------------
### Initialize PostbackUpdate
Source: https://developer.apple.com/documentation/adattributionkit/postbackupdate/init%28fineconversionvalue%3Alockpostback%3Aconversiontag%3Acoarseconversionvalue%3Aconversiontypes%3A%29
Use this initializer to set up a postback update with conversion details. Requires conversion value and lock postback settings. Available for iOS 18.4+, iPadOS 18.4+, and Mac Catalyst.
```swift
init(
fineConversionValue: Int,
lockPostback: Bool,
conversionTag: String,
coarseConversionValue: CoarseConversionValue? = nil,
conversionTypes: [PostbackUpdate.ConversionType]? = nil
)
```
--------------------------------
### handleView() Instance Method
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/handleview%28%29
Handles a view through ad impression. Call this method on the app impression to register a person’s viewing of the ad content.
```APIDOC
## Instance Method
# handleView()
### Description
Handles a view through ad impression. Call this method on the app impression to register a person’s viewing of the ad content.
### Method
`async throws`
### Endpoint
N/A (Instance Method)
### Parameters
None
### Request Example
```swift
// Assuming 'appImpression' is an instance of AppImpression
await appImpression.handleView()
```
### Response
#### Success Response
This method does not return a value upon success.
#### Response Example
N/A
```
--------------------------------
### App Configuration
Source: https://developer.apple.com/documentation/AdAttributionKit
Configure publisher and advertised apps to participate in ad campaigns and set up attribution rules.
```APIDOC
## Configuring Publisher App
### Description
Set up a publisher app to participate in ad campaigns.
### Method
POST
### Endpoint
/configure/publisher_app
## Configuring Advertised App
### Description
Prepare an advertised app to participate in ad campaigns.
### Method
POST
### Endpoint
/configure/advertised_app
## Configuring Attribution Rules
### Description
Tune aspects of attribution flow, including the time available to register impressions and the minimum time your app is willing to accept conversions.
### Method
PUT
### Endpoint
/configure/attribution_rules
```
--------------------------------
### Get Publisher Item ID
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/publisheritemid
Access the publisher app's item ID. Available on iOS 17.4+, iPadOS 17.4+, and Mac Catalyst.
```swift
var publisherItemID: UInt64 { get }
```
--------------------------------
### Check Device Support for App Impressions
Source: https://developer.apple.com/documentation/adattributionkit/appimpression
A static property that indicates whether the framework supports app impressions on the current device.
```swift
static var isSupported: Bool
```
--------------------------------
### Get Ad Network ID
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/adnetworkid
Retrieve the advertising network ID for an ad impression. This property is available on iOS 17.4+, iPadOS 17.4+, and Mac Catalyst.
```swift
var adNetworkID: String { get }
```
--------------------------------
### Configure Global and Per-Ad Network Attribution Windows
Source: https://developer.apple.com/documentation/adattributionkit/configuring-attribution-rules-for-your-app
This configuration includes global attribution settings for view impressions and specific settings for the ad network 'com.apple.test.itms11.2', including a click attribution window of 5 days and ignoring view interaction types. This demonstrates a combined configuration within the `AdAttributionKitConfigurations` dictionary.
```xml
AdAttributionKitConfigurations
AttributionWindows
global
install
view
3
com.apple.test.itms11.2
install
ignoreInteractionType
view
click
5
```
--------------------------------
### Initialize AppImpression with JWS
Source: https://developer.apple.com/documentation/adattributionkit/appimpression
Creates a new app impression using a compact JSON Web Signature (JWS). Ensure the JWS is valid for proper initialization.
```swift
init(compactJWS: String) async throws
```
--------------------------------
### Generate Public Key from Private Key
Source: https://developer.apple.com/documentation/AdAttributionKit/registering-an-ad-network
After generating the private key, use this OpenSSL command to create the corresponding public key. This public key will be shared with Apple for signature verification. Replace `companyname` as needed.
```bash
openssl ec -in companyname_adattribuitionkit_private_key.pem -pubout -out companyname_adattribuitionkit_public_key.pem
```
--------------------------------
### Record click-through impressions using AppImpression
Source: https://developer.apple.com/documentation/adattributionkit/presenting-ads-in-your-app
Call the `handleTap()` method on an `AppImpression` object after a user taps on an ad. This records a click-through impression and can launch the App Store or the advertised app.
```swift
func handleAdTapped(impression: AppImpression) async {
do {
// This fails if a person didn't tap `UIEventAttributionView`.
try await impression.handleTap()
}
catch {
print("Failed to perform click through impression: \(error).")
}
}
```
--------------------------------
### AdAttributionKit - isSupported
Source: https://developer.apple.com/documentation/adattributionkit/postback/issupported
Checks if the AdAttributionKit framework supports postbacks on the current device.
```APIDOC
## GET /websites/developer_apple_adattributionkit/isSupported
### Description
A Boolean value that indicates whether the framework supports postbacks on a person’s device.
### Method
GET
### Endpoint
/websites/developer_apple_adattributionkit/isSupported
### Parameters
This endpoint does not accept any parameters.
### Request Example
```
GET /websites/developer_apple_adattributionkit/isSupported
```
### Response
#### Success Response (200)
- **isSupported** (Boolean) - `true` if the current device supports postbacks; otherwise, `false`.
#### Response Example
```json
{
"isSupported": true
}
```
### Discussion
Check this value to ensure the current device supports postbacks before calling methods on a `Postback`.
```
--------------------------------
### Declare beginView() Method
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/beginview%28%29
This is the declaration of the `beginView()` method. It is an asynchronous function that can throw errors.
```swift
func beginView() async throws
```
--------------------------------
### PostbackUpdate Structure
Source: https://developer.apple.com/documentation/adattributionkit/postbackupdate
Details about the PostbackUpdate structure, its initializers, properties, and enumerations.
```APIDOC
## PostbackUpdate
Values you use to update properties in a postback, such as the conversion value.
### Structure
```swift
struct PostbackUpdate
```
### Initializers
`init(fineConversionValue: Int, lockPostback: Bool, coarseConversionValue: CoarseConversionValue?, conversionTypes: [PostbackUpdate.ConversionType]?)`
Creates a new postback update with the conversions values, conversion types, and lock indication you provide.
`init(fineConversionValue: Int, lockPostback: Bool, conversionTag: String, coarseConversionValue: CoarseConversionValue?, conversionTypes: [PostbackUpdate.ConversionType]?)`
### Instance Properties
`let coarseConversionValue: CoarseConversionValue?`
An enumeration that represents the coarse conversion value.
`let conversionTag: String?`
`let conversionTypes: [PostbackUpdate.ConversionType]?`
An array conversion type the system uses to determine which postbacks to update with this postback update.
`let fineConversionValue: Int`
An integer that represents the fine conversion value.
`let lockPostback: Bool`
A Boolean value that indicates whether the system should lock the postback, reducing system time deliver a signal
### Enumerations
`enum ConversionType`
Values that describe the types of conversions.
### See Also
`struct Postback`
A structure that provides methods you use to update conversion values for ad attributions.
`enum CoarseConversionValue`
Values that describe developer-defined, relative-attribution conversion values.
```
--------------------------------
### Instance Method: hash(into:)
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/hash%28into%3A%29
The hash(into:) method is used to hash the essential components of a value by passing them into a hasher. This is crucial for data structures that require hashing, such as sets and dictionaries.
```APIDOC
## Instance Method: hash(into:)
### Description
A function that hashes the essential components of the value by passing them into the hasher.
### Method
Instance Method
### Endpoint
N/A (Instance Method)
### Parameters
#### Path Parameters
N/A
#### Query Parameters
N/A
#### Request Body
N/A
### Request Example
N/A
### Response
#### Success Response (200)
N/A
#### Response Example
N/A
### See Also
- Comparing and hashing ad impressions: `static func == (AppImpression, AppImpression) -> Bool`
```
--------------------------------
### AppImpression Methods
Source: https://developer.apple.com/documentation/adattributionkit/appimpression
Methods for initializing an impression and handling ad interactions like views and taps.
```APIDOC
## init(compactJWS: String)
### Description
Creates a new app impression with the provided compact JSON Web Signature (JWS).
### Parameters
- **compactJWS** (String) - Required - The compact JWS string representing the impression.
---
## func beginView()
### Description
Begins recording a view-through impression when ad content becomes visible.
---
## func endView()
### Description
Ends the view-through impression when the ad content disappears.
---
## func handleTap()
### Description
Processes click-through interactions on custom rendered ad content.
---
## func handleTap(reengagementURL: URL)
### Description
Processes click-through interactions and delivers a URL to the advertised app if installed.
### Parameters
- **reengagementURL** (URL) - Required - The URL to deliver to the advertised app.
```
--------------------------------
### Record view-through impressions with custom rendered ads in SwiftUI
Source: https://developer.apple.com/documentation/adattributionkit/presenting-ads-in-your-app
Use the `handleView()` method from `AppImpression` to record a view-through impression when custom ad content is displayed. Ensure `shouldRecordView()` returns true to track the impression.
```swift
struct AdContentView: View {
let impression: AppImpression
var body: some View {
VStack {
// Advertisement content
}
.onDisappear(perform: { handleAdDisappeared() })
.onTapGesture(perform: { handleAdTapped() })
}
init(impression: AppImpression) {
self.impression = impression
}
func handleAdDisappeared() {
guard shouldRecordView() else {
return
}
Task {
do {
try await impression.handleView()
}
catch {
print("Failed to end view through impression: \(error).")
}
}
}
func shouldRecordView() -> Bool {
// TODO: Implement logic to determine if you need to record the view impression to your own system based on your app's ad display requirements.
return false
}
}
```
--------------------------------
### Generate Private Key for Ad Network
Source: https://developer.apple.com/documentation/AdAttributionKit/registering-an-ad-network
Use this OpenSSL command in Terminal to generate a private key for signing ads. Replace `companyname` with your company's name. This key is crucial for AdAttributionKit operations.
```bash
openssl ecparam -name prime256v1 -genkey -noout -out companyname_adattribuitionkit_private_key.pem
```
--------------------------------
### AppImpression Initializer
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/init%28compactjws%3A%29
Creates a new app impression with the provided compact JSON Web Signature (JWS). Available on iOS 17.4+, iPadOS 17.4+, and Mac Catalyst.
```APIDOC
## Initializer init(compactJWS:)
### Description
Creates a new app impression with the provided compact JSON Web Signature (JWS).
### Method
Initializer
### Endpoint
N/A (Initializer)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
```swift
do {
let impression = try await AppImpression(compactJWS: compactJWS)
print("Impression advertised item ID: \(impression.advertisedItemID)")
}
catch {
print("Failed to decode impression: \(error)")
}
```
### Response
#### Success Response (200)
An `AppImpression` object is created.
#### Response Example
```json
{
"advertisedItemID": "example.com/product/123"
}
```
### Parameters
#### `compactJWS` (String) - Required
A string that represents a JWS.
```
--------------------------------
### Generate a private key for AdAttributionKit
Source: https://developer.apple.com/documentation/adattributionkit/registering-an-ad-network
Creates an ECDSA private key using the prime256v1 curve for signing ads.
```bash
openssl ecparam -name prime256v1 -genkey -noout -out companyname_adattribuitionkit_private_key.pem
```
--------------------------------
### Generate a public key from a private key
Source: https://developer.apple.com/documentation/adattributionkit/registering-an-ad-network
Extracts the PEM-encoded PKCS #8 EC public key from an existing private key file.
```bash
openssl ec -in companyname_adattribuitionkit_private_key.pem -pubout -out companyname_adattribuitionkit_public_key.pem
```
--------------------------------
### AdAttributionKit - isSupported
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/issupported
Checks if the AdAttributionKit framework supports app impressions on the current device. This is crucial for ensuring compatibility before utilizing AppImpression functionalities.
```APIDOC
## AdAttributionKit isSupported
### Description
A Boolean value that indicates whether the framework supports app impressions on a person’s device.
### Method
`static var isSupported: Bool { get }`
### Return Value
`true` if the current device supports app impressions; otherwise, `false`.
### Discussion
Check this value to ensure the current device supports app impressions before calling methods on an `AppImpression`.
### Supported Platforms
iOS 18.0+
iPadOS 18.0+
Mac Catalyst
```
--------------------------------
### Initialize AppImpression with JWS
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/init%28compactjws%3A%29
Use this initializer to create an AppImpression object from a compact JWS string. Ensure the JWS is valid to avoid errors. This method is asynchronous and can throw errors.
```swift
do {
let impression = try await AppImpression(compactJWS: compactJWS)
print("Impression advertised item ID: \(impression.advertisedItemID)")
}
catch {
print("Failed to decode impression: \(error)")
}
```
--------------------------------
### Postback API Overview
Source: https://developer.apple.com/documentation/adattributionkit/postback
The Postback structure provides methods to update conversion values for ad attributions. It is available on iOS 17.4+, iPadOS 17.4+, and Mac Catalyst.
```APIDOC
## Postback API
### Description
A structure that provides methods you use to update conversion values for ad attributions.
### Supported Platforms
iOS 17.4+
iPadOS 17.4+
Mac Catalyst
### Type Properties
`static var isSupported: Bool`
A Boolean value that indicates whether the framework supports postbacks on a person’s device.
`static var reengagementOpenURLParameter: String`
A string that represents the query parameter that AdAttributionKit appends to the URL to indicate that a reengagement has occurred.
### Type Methods
`static func updateConversionValue(PostbackUpdate) async throws`
Updates the conversion value using the given postback update configuration.
`static func updateConversionValue(Int, coarseConversionValue: CoarseConversionValue, lockPostback: Bool) async throws`
Updates the conversion value with the provided fine and coarse conversion values, and optionally locks the postback, reducing the amount of time the system needs to deliver a signal.
`static func updateConversionValue(Int, lockPostback: Bool) async throws`
Updates a conversion value with the provided fine and coarse conversion values, and optionally locks the postback, reducing the system time to deliver a signal.
### Related Structures
- `PostbackUpdate`: Values you use to update properties in a postback, such as the conversion value.
- `CoarseConversionValue`: Values that describe developer-defined, relative-attribution conversion values.
```
--------------------------------
### Related Methods
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/handleview%28%29
Related methods for managing view-through impressions.
```APIDOC
## See Also
### Displaying view-through ads
`func beginView() async throws`
Begins recording a view-through impression when ad content corresponding to the impression becomes visible.
`func endView() async throws`
Ends the view-through impression when the ad content corresponding to the impression disappears.
```
--------------------------------
### Handle Ad View
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/handleview%28%29
Call this method on the app impression to register a person’s viewing of the ad content. Requires iOS 26.2+ or iPadOS 26.2+.
```swift
func handleView() async throws
```
--------------------------------
### Compare App Impressions for Equality
Source: https://developer.apple.com/documentation/adattributionkit/appimpression
Returns a Boolean value indicating whether two AppImpression values are equal.
```swift
static func == (AppImpression, AppImpression) -> Bool
```
--------------------------------
### Check AdAttributionKit Support
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/issupported
Use this Boolean property to determine if the current device supports app impressions. Always check this before calling methods on an AppImpression object.
```swift
static var isSupported: Bool { get }
```
--------------------------------
### Accessing the conversionTag property
Source: https://developer.apple.com/documentation/adattributionkit/postbackupdate/conversiontag
Use this property to retrieve or set the conversion tag string associated with a postback update.
```swift
let conversionTag: String?
```
--------------------------------
### Postback Verification
Source: https://developer.apple.com/documentation/AdAttributionKit
Verify the cryptographic signature of a postback to ensure its validity after an ad conversion.
```APIDOC
## Verifying a Postback
### Description
Ensure the validity of a postback you receive after an ad conversion by verifying its cryptographic signature.
### Method
POST
### Endpoint
/postbacks/verify
```
--------------------------------
### AdAttributionKitError.conversionTagNotSupported
Source: https://developer.apple.com/documentation/adattributionkit/adattributionkiterror/conversiontagnotsupported
Represents an error where a postback update fails because the conversion tag is not supported.
```APIDOC
## AdAttributionKitError.conversionTagNotSupported
### Description
The postback update failed due to an unsupported use of conversion tag.
### Availability
- iOS 18.4+
- iPadOS 18.4+
- Mac Catalyst
### Definition
```swift
case conversionTagNotSupported
```
```
--------------------------------
### Define conversionTagNotSupported error case
Source: https://developer.apple.com/documentation/adattributionkit/adattributionkiterror/conversiontagnotsupported
Represents an error where the conversion tag is not supported during a postback update.
```swift
case conversionTagNotSupported
```
--------------------------------
### Access ad impression properties
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/advertiseditemid
List of additional properties available for ad impressions.
```swift
var adNetworkID: String
```
```swift
var compactJWSRepresentation: String
```
```swift
var eligibleForReengagement: Bool
```
```swift
var id: UUID
```
```swift
var keyID: String
```
```swift
var publisherItemID: UInt64
```
```swift
var sourceID: Int
```
```swift
var timestamp: Date
```
--------------------------------
### Update Conversion Value - Advertised App
Source: https://developer.apple.com/documentation/adattributionkit
Call this method to register a conversion by updating the conversion value when a person first launches the app. Optionally, continue to update the conversion value as the person engages with the app.
```swift
updateConversionValue(_:lockPostback:)
```
```swift
updateConversionValue(_:coarseConversionValue:lockPostback:)
```
--------------------------------
### Access compactJWSRepresentation property
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/compactjwsrepresentation
Retrieves the compact JWS representation string for an impression.
```swift
var compactJWSRepresentation: String { get }
```
--------------------------------
### Handle Ad Taps with handleTap()
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/handletap%28%29
Call the impression's handleTap method to process a user's tap on ad content. This code fails if a UIEventAttributionView was not tapped. Ensure the impression instance is not older than 15 minutes.
```swift
func handleAdTapped(impression: AppImpression) async {
do {
// This fails if a person didn't tap a `UIEventAttributionView`.
try await impression.handleTap()
}
catch {
print("Failed to perform click-through impression: \(error).")
}
}
```
--------------------------------
### End View-Through Impression
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/endview%28%29
Call this method to end a view-through impression when the ad content disappears. Ensure proper error handling for the asynchronous operation.
```swift
func endView() async throws
```
```swift
func handleAdDisappeared(impression: AppImpression) async {
do {
try await impression.endView()
}
catch {
print("Failed to end view-through impression: \(error).")
}
}
```
--------------------------------
### Instance Property: eligibleForReengagement
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/eligibleforreengagement
A Boolean value that indicates whether this impression is eligible for reengagement. Available on iOS 18.0+, iPadOS 18.0+, and Mac Catalyst.
```APIDOC
## Instance Property: eligibleForReengagement
### Description
A Boolean value that indicates whether this impression is eligible for reengagement.
### Availability
iOS 18.0+ iPadOS 18.0+ Mac Catalyst
### Declaration
```swift
var eligibleForReengagement: Bool { get }
```
```
--------------------------------
### Update conversion value using PostbackUpdate
Source: https://developer.apple.com/documentation/adattributionkit/postback/updateconversionvalue%28_%3A%29
Updates the conversion value using the provided PostbackUpdate configuration. This method is asynchronous and may throw an error.
```swift
static func updateConversionValue(_ postbackUpdate: PostbackUpdate) async throws
```
--------------------------------
### Update Conversion Value in AdAttributionKit
Source: https://developer.apple.com/documentation/adattributionkit/postback/updateconversionvalue%28_%3Acoarseconversionvalue%3Alockpostback%3A%29
Use this method to update the fine and coarse conversion values. Setting `lockPostback` to `true` can reduce the time needed to deliver a signal.
```swift
static func updateConversionValue(
_ fineConversionValue: Int,
coarseConversionValue: CoarseConversionValue,
lockPostback: Bool
) async throws
```
--------------------------------
### Check for AdAttributionKit reengagement URL
Source: https://developer.apple.com/documentation/adattributionkit/postback/reengagementopenurlparameter
Verify if a URL contains the reengagement query parameter by checking the URL components.
```swift
func isAdAttributionKitReengagementURL(url: URL) -> Bool {
guard let components = URLComponents(url: url, resolvingAgainstBaseURL: true),
let queryItems = components.queryItems else {
return false
}
return queryItems.contains { $0.name == Postback.reengagementOpenURLParameter }
}
```
--------------------------------
### Ad Attribution Testing
Source: https://developer.apple.com/documentation/AdAttributionKit
Test ad attributions using Developer Mode or downloaded profiles to reduce time windows and inspect postbacks.
```APIDOC
## Testing Ad Attributions with Developer Mode
### Description
Reduce the time-window for ad attributions and inspect postbacks using a proxy during testing.
### Method
POST
### Endpoint
/test/attributions/developer_mode
## Creating Postbacks in Developer Settings
### Description
Test development postbacks for your advertised app without interacting with ads from a publisher app.
### Method
POST
### Endpoint
/test/postbacks/developer_settings
## Testing Ad Attributions with a Downloaded Profile
### Description
Reduce the time-window for ad attributions and inspect postbacks using a proxy during testing.
### Method
POST
### Endpoint
/test/attributions/downloaded_profile
```
--------------------------------
### Hash App Impression
Source: https://developer.apple.com/documentation/adattributionkit/appimpression
Hashes the essential components of an AppImpression value by passing them into a hasher.
```swift
func hash(into: inout Hasher)
```
--------------------------------
### Hash AppImpression components
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/hash%28into%3A%29
Defines the method signature for hashing AppImpression values using a provided hasher.
```swift
func hash(into hasher: inout Hasher)
```
--------------------------------
### Equality Operator ==(_:_:)
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/%3D%3D%28_%3A_%3A%29
Compares two AppImpression instances for equality.
```APIDOC
## ==(_:_:)
### Description
Returns a Boolean value that indicates whether two AppImpression values are equal.
### Method
Static Function
### Parameters
- **lhs** (AppImpression) - Required - A value to compare.
- **rhs** (AppImpression) - Required - Another value to compare.
### Return Value
- **Bool** - Returns true if the values are equal; false, otherwise.
```
--------------------------------
### Declare conversionTypes Property
Source: https://developer.apple.com/documentation/adattributionkit/postbackupdate/conversiontypes
An array of conversion types the system uses to determine which postbacks to update with this postback update. If nil, the system updates all types of postbacks by default.
```swift
let conversionTypes: [PostbackUpdate.ConversionType]?
```
--------------------------------
### Access advertisedItemID property
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/advertiseditemid
Retrieves the unique identifier for the advertised item as a 64-bit unsigned integer.
```swift
var advertisedItemID: UInt64 { get }
```
--------------------------------
### compactJWSRepresentation Property
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/compactjwsrepresentation
A string that presents the compact representation of the impression’s JSON Web Signature (JWS). Available on iOS 17.4+, iPadOS 17.4+, and Mac Catalyst.
```APIDOC
## compactJWSRepresentation
### Description
A string that presents the compact representation of the impression’s JSON Web Signature (JWS).
### Availability
iOS 17.4+,
iPadOS 17.4+,
Mac Catalyst
### Syntax
```swift
var compactJWSRepresentation: String { get }
```
### See Also
#### Accessing ad impression properties
- `var adNetworkID: String` - The advertising network ID.
- `var advertisedItemID: UInt64` - The advertised item’s ID.
- `var eligibleForReengagement: Bool` - A Boolean value that indicates whether this impression is eligible for reengagement.
- `var id: UUID` - The impression’s unique ID.
- `var keyID: String` - The JSON Web Signature (JWS) key ID.
- `var publisherItemID: UInt64` - The publisher app’s item ID.
- `var sourceID: Int` - A four-digit integer that ad networks define to represent the ad campaign.
- `var timestamp: Date` - The impression’s timestamp, in milliseconds since 1970.
```
--------------------------------
### updateConversionValue(_:coarseConversionValue:lockPostback:)
Source: https://developer.apple.com/documentation/adattributionkit/postback/updateconversionvalue%28_%3Acoarseconversionvalue%3Alockpostback%3A%29
Updates the conversion value with the provided fine and coarse conversion values, and optionally locks the postback to reduce signal delivery time.
```APIDOC
## updateConversionValue(_:coarseConversionValue:lockPostback:)
### Description
Updates the conversion value with the provided fine and coarse conversion values, and optionally locks the postback, reducing the amount of time the system needs to deliver a signal.
### Method
static func
### Parameters
- **fineConversionValue** (Int) - Required - An integer that defines the fine conversion value.
- **coarseConversionValue** (CoarseConversionValue) - Required - One of the CoarseConversionValue values.
- **lockPostback** (Bool) - Required - A Boolean value that indicates whether the system can lock the postback, reducing system time to deliver a signal.
### Request Example
static func updateConversionValue(
_ fineConversionValue: Int,
coarseConversionValue: CoarseConversionValue,
lockPostback: Bool
) async throws
```
--------------------------------
### JWS Impression Generation
Source: https://developer.apple.com/documentation/AdAttributionKit
Create a JSON Web Signature (JWS) for use with app impressions in AdAttributionKit.
```APIDOC
## Generating JWS Impressions
### Description
Create a JSON Web Signature (JWS) for use with app impressions in AdAttributionKit.
### Method
POST
### Endpoint
/impressions/jws
```
--------------------------------
### Process Ad Tap
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/handletap%28reengagementurl%3A%29
Processes click-through interactions on your custom rendered ad content. This method is used when a specific reengagement URL is not provided.
```swift
func handleTap() async throws
```
--------------------------------
### Access eligibleForReengagement property
Source: https://developer.apple.com/documentation/adattributionkit/appimpression/eligibleforreengagement
Retrieves the Boolean value indicating reengagement eligibility for an impression.
```swift
var eligibleForReengagement: Bool { get }
```
--------------------------------
### Update conversion value method signature
Source: https://developer.apple.com/documentation/AdAttributionKit/Postback/updateConversionValue%28_%3AlockPostback%3A%29
Use this static method to update conversion values and control postback timing. Requires iOS 17.4 or later.
```swift
static func updateConversionValue(
_ fineConversionValue: Int,
lockPostback: Bool
) async throws
```
--------------------------------
### Access reengagementOpenURLParameter property
Source: https://developer.apple.com/documentation/adattributionkit/postback/reengagementopenurlparameter
Access the static string property to identify the query parameter key used by AdAttributionKit.
```swift
static var reengagementOpenURLParameter: String { get }
```
--------------------------------
### Ad Network Registration
Source: https://developer.apple.com/documentation/AdAttributionKit
Register your ad network with Apple to use AdAttributionKit APIs for your ad campaigns.
```APIDOC
## Registering an Ad Network
### Description
Use the AdAttributionKit APIs for your ad campaigns after registering your ad network with Apple.
### Method
POST
### Endpoint
/register/adnetwork
```