Skip to main content
ClaudeWave
Skill732 estrellas del repoactualizado 15d ago

adattributionkit

AdAttributionKit enables privacy-preserving measurement of ad conversions on iOS 17.4 and later by allowing ad networks, publishers, and advertisers to track install and re-engagement attribution without exposing user-level data. Use it when you need to register ad impressions, handle attribution postbacks, update conversion values, implement re-engagement tracking, or configure iOS apps participating in ad attribution workflows while maintaining privacy through crowd anonymity tiers and time-delayed postback mechanisms.

Instalar en Claude Code
Copiar
git clone --depth 1 https://github.com/dpearson2699/swift-ios-skills /tmp/adattributionkit && cp -r /tmp/adattributionkit/skills/adattributionkit ~/.claude/skills/adattributionkit
Después abre una sesión nueva de Claude Code; el skill carga automáticamente.

SKILL.md

# AdAttributionKit

Privacy-preserving ad attribution for iOS 17.4+ / Swift 6.3. AdAttributionKit
lets ad networks measure conversions (installs and re-engagements) without
exposing user-level data. It supports the App Store and alternative
marketplaces, and interoperates with SKAdNetwork.

Three roles exist in the attribution flow: the **ad network** (signs
impressions, receives postbacks), the **publisher app** (displays ads), and the
**advertised app** (the app being promoted).

## Contents

- [Overview and Privacy Model](#overview-and-privacy-model)
- [Publisher App Setup](#publisher-app-setup)
- [Advertiser App Setup](#advertiser-app-setup)
- [Impressions](#impressions)
- [Postbacks](#postbacks)
- [Conversion Values](#conversion-values)
- [Re-engagement](#re-engagement)
- [Common Mistakes](#common-mistakes)
- [Review Checklist](#review-checklist)
- [References](#references)

## Overview and Privacy Model

AdAttributionKit preserves user privacy through several mechanisms:

- **Crowd anonymity tiers** -- the device limits postback data granularity based
  on the crowd size associated with the ad, ranging from Tier 0 (minimal data)
  to Tier 3 (most data including publisher ID and country code).
- **Time-delayed postbacks** -- postbacks are sent 24-48 hours after conversion
  window close (first window) or 24-144 hours (second/third windows).
- **No user-level identifiers** -- postbacks contain aggregate source
  identifiers and conversion values, not device or user IDs.
- **Hierarchical source identifiers** -- 2, 3, or 4-digit source IDs where the
  number of digits returned depends on the crowd anonymity tier.

In migration and interoperability reviews, explicitly state that the system
evaluates AdAttributionKit and SKAdNetwork impressions together, only one
impression wins per conversion, click-through beats view-through, and recency
breaks ties within click-through impressions before falling back to the most
recent view-through impression.

## Publisher App Setup

A publisher app displays ads from registered ad networks. Add each ad network's
ID to the app's Info.plist so its impressions qualify for install validation.

### Add ad network identifiers

```xml
<key>AdNetworkIdentifiers</key>
<array>
    <string>example123.adattributionkit</string>
    <string>another456.adattributionkit</string>
</array>
```

Ad network IDs must be lowercase. SKAdNetwork IDs (ending in `.skadnetwork`)
are also accepted -- the frameworks share IDs.

### Display a UIEventAttributionView

For click-through custom-rendered ads, place one `UIEventAttributionView` over
each tappable ad/control. It must cover the tappable area and stay above views
that would intercept touches before `handleTap()` succeeds.

```swift
import UIKit

let attributionView = UIEventAttributionView()
attributionView.frame = adContentView.bounds
attributionView.isUserInteractionEnabled = true
adContentView.addSubview(attributionView)
```

## Advertiser App Setup

The advertised app is the app someone installs or re-engages with after seeing
an ad. It must call a conversion value update at least once to begin the
postback conversion window.

### Opt in to receive winning postback copies

Add `AttributionCopyEndpoint` under the top-level `AdAttributionKit` Info.plist
dictionary so the device sends a copy of the winning postback to your server:

```xml
<key>AdAttributionKit</key>
<dict>
    <key>AttributionCopyEndpoint</key>
    <string>https://example.com</string>
</dict>
```

The system derives the well-known endpoint from the registrable domain in the
URL, ignoring subdomains:

```
https://example.com/.well-known/appattribution/report-attribution/
```

Configure your server to accept HTTPS POST requests at that path. The domain
must have a valid SSL certificate.

### Opt in for re-engagement postback copies

Add a second key in the same `AdAttributionKit` dictionary to also receive
copies of winning re-engagement postbacks:

```xml
<key>AdAttributionKit</key>
<dict>
    <key>AttributionCopyEndpoint</key>
    <string>https://example.com</string>
    <key>OptInForReengagementPostbackCopies</key>
    <true/>
</dict>
```

### Update conversion value on first launch

Call a conversion value update as early as possible after first launch to begin
the conversion window:

```swift
import AdAttributionKit

func applicationDidFinishLaunching() async {
    do {
        try await Postback.updateConversionValue(0, lockPostback: false)
    } catch {
        print("Failed to set initial conversion value: \(error)")
    }
}
```

## Impressions

Ad networks create signed impressions using JWS (JSON Web Signature). The
publisher app uses `AppImpression` to register and handle those impressions.

### Create an impression from a JWS

```swift
import AdAttributionKit

let impression = try await AppImpression(compactJWS: signedJWSString)
```

The JWS contains the ad network ID, advertised item ID, publisher item ID,
source identifier, timestamp, and optional re-engagement eligibility flag. See
[references/adattributionkit-patterns.md](references/adattributionkit-patterns.md)
for JWS generation details.

### Check device support

```swift
guard AppImpression.isSupported else {
    // Fall back to alternative ad display
    return
}
```

### View-through impressions

Record a view impression when the ad content has been displayed and dismissed:

```swift
func handleAdViewed(impression: AppImpression) async {
    do {
        try await impression.handleView()
    } catch {
        print("Failed to record view-through impression: \(error)")
    }
}
```

For long-lived ad views, use `beginView()` and `endView()` to track view
duration:

```swift
try await impression.beginView()
// ... ad remains visible ...
try await impression.endView()
```

### Click-through impressions

Respond to ad taps by calling `handleTap()` within 15 minutes of creating the
`AppImpression`; otherwise request a fresh impression. If the advertised app is
not installed, the system ope
accessorysetupkitSkill

Discover and configure Bluetooth and Wi-Fi accessories using AccessorySetupKit. Use when presenting a privacy-preserving accessory picker, defining discovery descriptors for BLE or Wi-Fi devices, handling accessory session events, migrating from CoreBluetooth permission-based scanning, or setting up accessories without requiring broad Bluetooth permissions.

activitykitSkill

Implement, review, or improve Live Activities and Dynamic Island experiences in iOS apps using ActivityKit. Use when building real-time updating widgets for the Lock Screen and Dynamic Island — delivery tracking, sports scores, ride-sharing status, workout timers, media playback, or any time-sensitive information that updates in real time. Also use when working with ActivityKit, ActivityAttributes, Activity lifecycle (request/update/end), Dynamic Island layouts (compact/minimal/expanded), push-to-update Live Activities, or Lock Screen live widgets.

alarmkitSkill

Implement AlarmKit alarms and countdown timers for iOS and iPadOS with Lock Screen, Dynamic Island, StandBy, and paired Apple Watch system UI. Covers AlarmManager scheduling, AlarmAttributes and AlarmPresentation, AlarmButton stop and snooze actions, authorization, state observation, countdown widget-extension handoff, and Live Activity integration. Use when building wake-up alarms, countdown timers, or alarm-style alerts that need Apple's system alarm experience.

app-clipsSkill

Build iOS App Clips with invocation URLs, App Clip Codes, NFC, QR codes, Safari banners, Maps, Messages, target setup, App Store Connect experiences, size/capability constraints, NSUserActivity routing, SKOverlay promotion, App Group/keychain handoff, ephemeral notifications, location confirmation, and full-app migration. Use when creating App Clips or wiring App Clip invocation, experience configuration, or full-app handoff.

app-intentsSkill

Implement App Intents for Siri, Shortcuts, Spotlight, widgets, Control Center, and Apple Intelligence on iOS. Covers AppIntent actions, AppEntity and EntityQuery models, AppShortcutsProvider phrases, IndexedEntity Spotlight indexing, WidgetConfigurationIntent, SnippetIntent, and assistant schemas. Use when exposing app actions or entities to system surfaces.

app-store-optimizationSkill

Optimize App Store product pages for search visibility and conversion. Use for App Store Optimization (ASO), keyword research, app name/subtitle/keyword-field strategy, conversion-focused descriptions and promotional text, screenshot captions and ordering, Custom Product Pages with assigned search keywords, In-App Events, Product Page Optimization tests, localized metadata, ratings/review strategy, and in-app review prompt timing with RequestReviewAction or AppStore.requestReview. Also use when routing ASO vs App Store review, privacy/ATT, or StoreKit implementation boundaries.

app-store-reviewSkill

Prepare for App Store review and prevent rejections. Covers App Store review guidelines, app rejection reasons, PrivacyInfo.xcprivacy privacy manifest requirements, required API reason codes, in-app purchase IAP and StoreKit rules, App Store Guidelines compliance, ATT App Tracking Transparency, EU DMA Digital Markets Act, HIG compliance checklist, app submission preparation, review preparation, metadata requirements, entitlements, widgets, and Live Activities review rules. Use when preparing for App Store submission, fixing rejection reasons, auditing privacy manifests, implementing ATT consent flow, configuring StoreKit IAP, or checking HIG compliance.

apple-on-device-aiSkill

Integrate on-device AI using Foundation Models framework, Core ML, and open-source LLM runtimes on Apple Silicon. Covers Foundation Models (LanguageModelSession, @Generable, @Guide, SystemLanguageModel, structured output, tool calling), Core ML (coremltools, model conversion, quantization, palettization, pruning, Neural Engine, MLTensor), MLX Swift (transformer inference, unified memory), and llama.cpp (GGUF, cross-platform LLM). Use when building tool-calling AI features, working with guided generation schemas, converting models, or running on-device inference.