<!--
{
  "availability" : [
    "iOS: 14.5.0 -",
    "iPadOS: 14.5.0 -",
    "macCatalyst: 14.5.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIEventAttribution",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIEventAttribution"
  },
  "title" : "UIEventAttribution"
}
-->

# UIEventAttribution

An object that contains event attribution information for Web AdAttributionKit.

```
@MainActor class UIEventAttribution
```

## Overview

Apps use event attribution objects to send data to the browser when opening an external website that supports Web AdAttributionKit (formerly known as Private Click Measurement, or PCM). For more information on the proposed PCM web standard, see [Introducing Private Click Measurement](https://webkit.org/blog/11529/introducing-private-click-measurement-pcm/) and [Private Click Measurement Draft Community Group Report](https://privacycg.github.io/private-click-measurement/).

> Note:
> Mac apps built with Mac Catalyst don’t support Web AdAttributionKit.

You can’t subclass [`UIEventAttribution`](/documentation/UIKit/UIEventAttribution).

### Define an endpoint

In order to use Web AdAttributionKit, your app defines an `Info.plist` key called <doc://com.apple.documentation/documentation/BundleResources/Information-Property-List/NSAdvertisingAttributionReportEndpoint> that contains the URL to which the browser sends event attribution data. When an externally linked website reports that a conversion has occurred, the browser forwards your app’s event attribution data to the endpoint specified in the `Info.plist`. If your app’s `Info.plist` doesn’t contain this key, the browser won’t be able to forward the Web AdAttributionKit data when a conversion occurs.

Send event attribution data to the browser only when your app opens an external link as a result of a user tapping a control that sits below a [`UIEventAttributionView`](/documentation/UIKit/UIEventAttributionView) in the app’s view hierarchy. The event attribution view verifies that the user tapped a control. If that control doesn’t sit below an event attribution view, the system won’t send the Web AdAttributionKit data to the browser when opening the external link.

### Create an event attribution data object

Here’s how you create a [`UIEventAttribution`](/documentation/UIKit/UIEventAttribution) object:

```swift
let adURL = URL(string: "https://shop.example/tabletStandDeluxe.html")!
let eventAttribution =
    UIEventAttribution(sourceIdentifier: 4,
                       destinationURL: adURL,
                       sourceDescription: "Banner ad for Tablet Stand Deluxe.",
                       purchaser: "Shop Example, Inc.")
```

### Send event attribution data to the browser

Once you create a [`UIEventAttribution`](/documentation/UIKit/UIEventAttribution) object, send it to the browser when your app opens a URL as the result of a user tap. If the external website reports a conversion within 7 days, the browser forwards the data from the [`UIEventAttribution`](/documentation/UIKit/UIEventAttribution) object to the specified remote server sometime between 24 and 48 hours after the conversion.

There are two different ways to send event attribution data when your app opens an external link, depending on whether your app uses [`UIScene`](/documentation/UIKit/UIScene) or [`UIApplication`](/documentation/UIKit/UIApplication) for life cycle management. For more information on application life cycle management, see [Managing your app’s life cycle](/documentation/UIKit/managing-your-app-s-life-cycle).

> Important:
> The browser, and not your app, sends the event attribution data to the remote server. If the user’s selected browser doesn’t support Web AdAttributionKit, the event attribution fails even if the external website reports a conversion.

If your app uses [`UIScene`](/documentation/UIKit/UIScene)-based life cycle management, create a [`UIScene.OpenExternalURLOptions`](/documentation/UIKit/UIScene/OpenExternalURLOptions) object, assign the event attribution object you created to its [`eventAttribution`](/documentation/UIKit/UIApplication/OpenExternalURLOptionsKey/eventAttribution) property, and call [`open(_:options:completionHandler:)`](/documentation/UIKit/UIScene/open(_:options:completionHandler:)):

```swift
let sceneOpenURLOptions = UIScene.OpenExternalURLOptions()
sceneOpenURLOptions.eventAttribution = eventAttribution

self.view.window?.windowScene?.open(adURL,
                                    options: sceneOpenURLOptions,
                                    completionHandler: nil)
```

If your app uses [`UIApplication`](/documentation/UIKit/UIApplication)-based life cycle management, create a dictionary that contains the [`eventAttribution`](/documentation/UIKit/UIApplication/OpenURLOptionsKey/eventAttribution) key with the [`UIEventAttribution`](/documentation/UIKit/UIEventAttribution) object you created as its value, and call [`open(_:options:completionHandler:)`](/documentation/UIKit/UIApplication/open(_:options:completionHandler:)), passing the dictionary using the `options` parameter.

```swift
let appOpenURLOptions: [UIApplication.OpenExternalURLOptionsKey : Any] = [
    .eventAttribution: eventAttribution
]
UIApplication.shared.open(adURL,
                          options: appOpenURLOptions,
                          completionHandler: nil)
```

### Send event attribution data to SFSafariViewController

If your app displays a web page in <doc://com.apple.documentation/documentation/SafariServices/SFSafariViewController> after a person taps an ad, add a [`UIEventAttributionView`](/documentation/UIKit/UIEventAttributionView) subview to the ad view or control in order to measure taps. When a person taps the ad, follow these steps:

1. Create an <doc://com.apple.documentation/documentation/SafariServices/SFSafariViewController/Configuration-swift.class> object.
2. Assign the [`UIEventAttribution`](/documentation/UIKit/UIEventAttribution) object you created to the <doc://com.apple.documentation/documentation/SafariServices/SFSafariViewController/Configuration-swift.class/eventAttribution> property of the <doc://com.apple.documentation/documentation/SafariServices/SFSafariViewController/Configuration-swift.class> object.
3. Initialize an <doc://com.apple.documentation/documentation/SafariServices/SFSafariViewController> instance with the configuration object, and present it. <doc://com.apple.documentation/documentation/SafariServices/SFSafariViewController> validates that a tap on a [`UIEventAttributionView`](/documentation/UIKit/UIEventAttributionView) initiated the navigation to the webpage. If not, it discards the attribution data.

## Topics

### Creating event attribution objects

[`init(sourceIdentifier:destinationURL:sourceDescription:purchaser:)`](/documentation/UIKit/UIEventAttribution/init(sourceIdentifier:destinationURL:sourceDescription:purchaser:))

Initializes a new event attribution object.

### Setting attribution details

[`destinationURL`](/documentation/UIKit/UIEventAttribution/destinationURL)

The destination URL to attribute.

[`purchaser`](/documentation/UIKit/UIEventAttribution/purchaser)

The entity that purchased the ad or content.

[`reportEndpoint`](/documentation/UIKit/UIEventAttribution/reportEndpoint)

The URL that receives attribution data.

[`sourceDescription`](/documentation/UIKit/UIEventAttribution/sourceDescription)

A string describing the source tapped to launch the external link.

[`sourceIdentifier`](/documentation/UIKit/UIEventAttribution/sourceIdentifier)

A number that identifies the source of the attribution.



---

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)