WWDC Quick Look 💓 By SwiftGGTeam
Meet privacy-preserving ad attribution

Meet privacy-preserving ad attribution

Watch original video

Highlight

PCM and SKAdNetwork eliminate the need to track users for ad attribution.All attribution calculations are done on the device, and reports are sent out with random delays and IP protection.

Core Content

Ad attribution is the cornerstone of digital marketing.Advertisers need to know: Did the ads they invested money in bring about conversions?But traditional attribution methods rely on cross-site tracking – cookies, IDFA – which infringe on user privacy.

Apple’s solution is divided into two lines:

Private Click Measurement (PCM) handles web ad attribution.The user clicks on the ad and completes the purchase on the target website. The advertiser cannot see the user’s identity during the entire process.The browser logs clicks and conversions on the device and randomly sends an aggregated report 24-48 hours later.The report only contains the campaign ID and conversion type, but no user ID.

SKAdNetwork handles app install attribution.The user clicks on the ad, jumps to the App Store, installs and opens the app, and the ad network receives an aggregated report.Reports include ad network ID, publisher app ID, campaign ID, and conversion values, again without user IDs.

The core ideas of these two solutions are the same: move the attribution calculation from the server to the device, and use information entropy limitation and data delay to protect privacy.

Detailed Content

PCM: Web Advertising Privacy Attribution

PCM is a proposed standard from the W3C Privacy Community Group, and Apple is the first to implement it in Safari (05:57).

Web-to-Web Attribution Process

Users click on ads on search sites:

<!-- Add two attributes to the ad link -->
<a href="https://longboardshop.biz/products/lemon-yellow"
   attributionsourceid="55"
   attributiondestination="https://longboardshop.biz">
   Lemon Yellow Longboard
</a>

Key points:

  • attributionsourceid: 8-bit entropy, logo advertising campaign (07:08)
  • attributiondestination: Conversion target website (07:16)
  • Data is stored locally in the browser and is not uploaded (07:19)

The user completes the conversion on the target website:

# The destination website triggers conversion: send a GET request to the source website
GET /pixel?trigger-data=15&priority=6
Host: searchforlongboard.biz

# The source website returns a 302 redirect to the well-known path
HTTP/1.1 302 Found
Location: /.well-known/private-click-measurement/trigger-attribution/
    ?trigger-data=15&priority=6

Key points:

  • trigger-data: 4-digit entropy, identifying the conversion type (such as add to cart = 15) (07:37)
  • priority: 6 bits, high priority can override low priority conversions (09:31)
  • Design compatible with traditional pixels to reduce access costs (09:38)

The browser randomly sends reports after 24-48 hours:

{
  "source_id": 55,
  "trigger_data": 15,
  "source_site": "searchforlongboard.biz",
  "destination_site": "longboardshop.biz"
}

Key points:

  • Reports sent to/.well-known/private-click-measurement/report-attribution/(09:45)
  • Random delay prevents linking user identity through time (08:16)
  • iOS 15 / macOS 12 adds IP address protection to prevent fingerprint tracking (08:28)
  • Report does not contain any user-identifying information (08:51)

App-to-Web Attribution

Display ads in the app and complete the conversion in Safari after clicking:

// Add the reporting endpoint in Info.plist
// NSAdvertisingAttributionReportEndpoint = https://myapp.example.com

// Create an attribution view over the ad
let attributionView = UIEventAttributionView()
attributionView.frame = adButton.frame
view.addSubview(attributionView)

// Create the attribution object when the user clicks the ad
let attribution = UIEventAttribution(
    sourceIdentifier: 55,
    destinationURL: URL(string: "https://longboardshop.biz")!,
    sourceDescription: "Lemon Yellow Longboard Ad",
    purchaser: "SocialAdNet"
)

// Scene-based lifecycle
let options = UIScene.OpenExternalURLOptions()
options.eventAttribution = attribution
UIApplication.shared.open(url, options: options) { _ in }

Key points:

  • UIEventAttributionViewVerifying user gestures to prevent false attribution (12:02)
  • UIEventAttributionContains source ID, destination URL, content description, and buyer information (12:21)
  • in Info.plistNSAdvertisingAttributionReportEndpointDecide where to send reports (11:27)
  • The conversion side is exactly the same as web-to-web (11:00)

Anti-Fraud Mechanism

PCM uses RSA blind signatures to prevent forged attribution (13:37):

  1. The browser obtains the public key of the source website (14:00)
  2. Browsers put attribution messages into “envelopes” (hidden content) (14:15)
  3. The source website signs the envelope and returns it to the browser (14:23)
  4. The browser retrieves the message with the signature of the source website (14:36)
  5. The report is sent with a signature, and the recipient can verify it with the public key (14:46)

Key points:

  • The source site never sees the original message and cannot correlate clicks and conversions (15:02)
  • Blind signatures ensure trustworthy reports without compromising privacy (13:48)

DEBUG MODE

Turn on “Private Click Measurement Debug Mode” in the Safari Develop menu (15:23):

  • Web Inspector enhanced log output (15:38)
  • Report sending interval reduced from 24-48 hours to 10 seconds (15:40)

SKAdNetwork: App Install Attribution

SKAdNetwork involves three parties: advertising network, publisher App, and advertised App (16:14).

Basic process

  1. Users see Longboard App ads on Social App
  2. Click on the ad to generate report data including AdNetwork ID, Publisher App ID, and Campaign ID
  3. Jump to the App Store, install and launch Longboard App
  4. Longboard App calls StoreKit API to trigger attribution reporting
  5. Reports sent to ad networks

Version update

VersionMinimum SystemNew Features
2.1iOS 14.6+256-bit public key, stronger signature verification (18:09)
2.2iOS 14.6+Support for View-Through Attribution (18:35)
2.2iOS 14.6+Multiple Postback and IP Protection (19:14)
2.2iOS 14.6+Postback to Developer(19:48)

View-Through Attribution

Display ads can also be attributed:

let impression = SKAdImpression()
impression.adNetworkIdentifier = "socialadnet.example"
impression.campaignIdentifier = 55
impression.sourceAppStoreItemIdentifier = 1234567890
impression.advertisedAppStoreItemIdentifier = 9876543210
impression.signature = generatedSignature
impression.timestamp = Date()
impression.version = "2.2"

SKAdNetwork.startImpression(impression)
// Ad display ended
SKAdNetwork.endImpression(impression)

Key points:

  • startImpression / endImpressionMark show start and end (18:42)
  • Fidelity type for View-Through is 0, lower than 1 for click attribution (18:55)
  • Prioritize reporting of attribution with high Fidelity (19:07)

Multiple Postback and IP Protection

Supported from iOS 14.6 onwards:

  • The winning network and up to 5 candidate networks receive reports (19:22)
  • Winning network may receive crowd anonymity control value (sourceApp, conversion value) (19:36)
  • Candidate networks do not receive these sensitive values ​​(19:41)
  • Add IP address protection (19:17)

Postback to Developer

Win attribution reports are also sent to the developers of the advertised apps:

<!-- Info.plist -->
<key>NSAdvertisingAttributionReportEndpoint</key>
<string>https://myapp.example.com</string>

Key points:

  • useNSAdvertisingAttributionReportEndpointConfiguring endpoints (20:04)
  • Reports sent to/.well-known/Path (20:16)
  • Shares the same configuration key with PCM app-to-web (20:07)

TESTING BEST PRACTICES

  • The nonce of each impression must be unique to prevent fraud (20:29)
  • The order of parameters is important when creating a signature, refer to the documentation to confirm (20:39)
  • Test postback using development-signed source app, source app ID set to 0 (20:53)
  • Download test profile to speed up postback transmission (21:01)

Core Takeaways

  1. PCM does not require ATT authorization.Since it does not involve tracking users across apps/websites, there is no need to request the App Tracking Transparency permission when using PCM.
  2. SKAdNetwork’s conversion value should be set as early as possible.The postback of iOS 15 has a time window, and the updated conversion value will be lost after the window is closed.It is recommended to call immediately at key user behavior points (installation, registration, payment)updateConversionValue
  3. Supports both PCM and traditional attribution as a transition.PCM is currently only supported by Safari, Chrome/Firefox has its own solution.It is recommended to implement both at the same time and choose according to the browser capabilities.
  4. Use Debug Mode to speed up testing.PCM’s 24-48 hour delay makes debugging a pain, with reports taking 10 seconds to issue after Debug Mode is turned on.
  5. SKAdNetwork 2.2’s View-Through expands attribution scenarios.Display ads are now also attributable, and although they have lower priority than clicks, they cover more user touchpoints.

Comments

GitHub Issues · utterances