# AppStance

The AppStance integration sends Superwall subscription and payment events to the AppStance platform for Apple Ads ROAS optimization. Automatically forward iOS transaction data with Apple Search Ads attribution for campaign performance analysis.

> **Note**

This integration is currently in **Beta**. Features and behavior may change. If you encounter any issues, please reach out to support.



In the **Analytics** section within **Integrations**, you can connect your AppStance account to Superwall.

AppStance (formerly Search Ads Optimization / SAO) is an Apple Ads ROAS optimization platform. This integration automatically forwards iOS subscription lifecycle events along with Apple Search Ads attribution data to AppStance, enabling you to measure and optimize your Apple Ads campaign performance.

Required fields [#required-fields]

Fill out the following fields and **click** the **Enable AppStance** button at the bottom right to save your changes:

* **Integration ID:** Must be set to `appstance`.
* **Anonymous User Behavior:** Whether to send or skip events for anonymous users (optional).

Features [#features]

* **Apple Ads ROAS Optimization**: Connects subscription revenue to Apple Search Ads campaigns
* **Automatic ASA Attribution**: Forwards Apple Search Ads attribution fields (org, campaign, ad group, keyword, and more)
* **iOS-Only Filtering**: Automatically filters out non-App Store events (Play Store and Stripe events are skipped)
* **Production-Only**: Sandbox events are skipped to keep optimization data clean
* **No Authentication Required**: The AppStance endpoint is public and does not require API keys
* **Device Identifier Forwarding**: Sends IDFV and IDFA when available

Configuration [#configuration]

Optional settings [#optional-settings]

| Field                     | Description                                | Example                  |
| ------------------------- | ------------------------------------------ | ------------------------ |
| `anonymous_user_behavior` | Whether to send events for anonymous users | `"send"` or `"dontSend"` |

Example configuration [#example-configuration]

```json
{
  "anonymous_user_behavior": "send"
}
```

Event mapping [#event-mapping]

AppStance uses its own event name mapping, which differs from the standard Superwall event mapping used by other integrations.

| Superwall Event         | Period Type | AppStance Event Name |
| ----------------------- | ----------- | -------------------- |
| `initial_purchase`      | `TRIAL`     | `free_trial`         |
| `initial_purchase`      | Any other   | `initial_purchase`   |
| `renewal`               | Any         | `renewal`            |
| `cancellation`          | Any         | `cancellation`       |
| `billing_issue`         | Any         | `billing_issue`      |
| `product_change`        | Any         | `product_change`     |
| `non_renewing_purchase` | Any         | `initial_purchase`   |
| `test`                  | Any         | `test`               |

Event payload [#event-payload]

Every event sent to AppStance includes the following fields:

Core fields [#core-fields]

| Field                 | Type    | Description                                                           |
| --------------------- | ------- | --------------------------------------------------------------------- |
| `user_id`             | string  | User identifier (uses `originalAppUserId` or `originalTransactionId`) |
| `install_timestamp`   | number  | Timestamp from `purchasedAt`                                          |
| `country_code`        | string  | Country code of the user                                              |
| `store`               | string  | Always `APP_STORE` (non-iOS events are filtered out)                  |
| `event_unique_id`     | string  | Unique event identifier                                               |
| `event_name`          | string  | Mapped event name (see table above)                                   |
| `event_timestamp`     | number  | Timestamp of the event                                                |
| `period_type`         | string  | Subscription period type                                              |
| `price_usd`           | number  | Transaction price in USD                                              |
| `proceeds_usd`        | number  | Proceeds after store fees in USD                                      |
| `is_trial_conversion` | boolean | Whether this event is a trial-to-paid conversion                      |

Revenue fields [#revenue-fields]

| Field                  | Type   | Description                               |
| ---------------------- | ------ | ----------------------------------------- |
| `revenue_raw_amount`   | number | Price in the original purchased currency  |
| `revenue_raw_currency` | string | Currency code of the original transaction |

Transaction fields [#transaction-fields]

| Field                     | Type    | Description                                  |
| ------------------------- | ------- | -------------------------------------------- |
| `bundle_id`               | string  | App bundle identifier                        |
| `transaction_id`          | string  | Transaction identifier                       |
| `original_transaction_id` | string  | Original transaction identifier              |
| `product_id`              | string  | Product identifier                           |
| `new_product_id`          | string  | New product identifier (for product changes) |
| `is_small_business`       | boolean | Whether the Small Business Program applies   |
| `environment`             | string  | Transaction environment                      |
| `project_id`              | string  | Superwall project identifier                 |
| `application_id`          | string  | Application identifier (currently null)      |

Apple Search Ads attribution [#apple-search-ads-attribution]

AppStance extracts Apple Search Ads (ASA) attribution data from user attributes and includes it in every event payload. This is the core data that powers Apple Ads ROAS optimization.

| Field                   | Description                                  |
| ----------------------- | -------------------------------------------- |
| `asa_org_id`            | Apple Search Ads organization ID             |
| `asa_campaign_id`       | Campaign identifier                          |
| `asa_adgroup_id`        | Ad group identifier                          |
| `asa_keyword_id`        | Keyword identifier                           |
| `asa_ad_id`             | Ad identifier                                |
| `asa_country_or_region` | Country or region for the campaign           |
| `asa_conversion_type`   | Conversion type (e.g., Download, Redownload) |
| `asa_click_date`        | Date of the ad click                         |
| `asa_claim_type`        | Claim type                                   |
| `asa_impression_date`   | Date of the ad impression                    |

For ASA attribution data to be available, ensure your app has the [Apple Search Ads integration](/docs/integrations/apple-search-ads) configured and that the Superwall SDK is collecting attribution data on the client side.

Device identifiers [#device-identifiers]

AppStance includes device identifiers from user attributes when available:

| Field  | Description                                       |
| ------ | ------------------------------------------------- |
| `idfv` | Identifier for Vendor                             |
| `idfa` | Identifier for Advertisers (requires ATT consent) |

These identifiers are extracted from `userAttributes` on the event. If your app collects IDFA (after obtaining App Tracking Transparency consent), it will be forwarded automatically.

Sandbox handling [#sandbox-handling]

AppStance is a **production-only** integration. Sandbox events are automatically skipped and are not sent to AppStance. This ensures that test transactions do not affect your ROAS optimization data.

Additionally, only App Store (iOS) events are forwarded. Events originating from Google Play Store or Stripe are filtered out, since AppStance is focused exclusively on Apple Ads optimization.

User identification [#user-identification]

The integration identifies users using the following hierarchy:

1. **Primary**: `originalAppUserId` (if available)
2. **Fallback**: `originalTransactionId` (always present)

If `anonymous_user_behavior` is set to `"dontSend"`, events for users without a resolved identity are skipped.

Testing the integration [#testing-the-integration]

1\. Trigger a test event [#1-trigger-a-test-event]

Use the `test` event type to verify connectivity. The integration maps `test` events to the `test` event name in AppStance.

2\. Trigger production events [#2-trigger-production-events]

Since AppStance skips sandbox events, you will need to test with production transactions:

* iOS: Use TestFlight with a sandbox Apple ID. Note that StoreKit Configuration files do not generate App Store Server Notifications, so webhooks and downstream integrations will not fire.
* Verify that events appear in your AppStance dashboard.

3\. Verify ASA attribution [#3-verify-asa-attribution]

Confirm that Apple Search Ads attribution fields are populated:

1. Ensure the Apple Search Ads integration is enabled in Superwall.
2. Install your app via an Apple Search Ad (or use a test campaign).
3. Make a purchase and check that `asa_campaign_id` and related fields are present in AppStance.

Best practices [#best-practices]

1. **Enable Apple Search Ads**: Ensure the [Apple Search Ads integration](/docs/integrations/apple-search-ads) is configured so that ASA attribution data flows through to AppStance.
2. **Collect IDFA**: Request App Tracking Transparency consent to maximize device identifier coverage for attribution matching.
3. **Set User IDs Early**: Send `originalAppUserId` to Superwall as early as possible so that AppStance can consistently identify users across events.
4. **Use Anonymous User Filtering**: Set `anonymous_user_behavior` to `"dontSend"` if you want to exclude events that lack a resolved user identity.
5. **Monitor Production Data**: Since sandbox events are filtered, verify your integration using production transactions or the `test` event type.

Troubleshooting [#troubleshooting]

Events not appearing in AppStance [#events-not-appearing-in-appstance]

1. **Check Platform**: Only iOS (App Store) events are sent. Play Store and Stripe events are automatically filtered out.
2. **Check Environment**: Sandbox events are skipped. Ensure you are testing with production transactions.
3. **Check Anonymous Users**: If `anonymous_user_behavior` is `"dontSend"`, events for anonymous users are skipped.

Missing ASA attribution data [#missing-asa-attribution-data]

1. **Check Apple Search Ads Integration**: Ensure the Apple Search Ads integration is enabled in Superwall settings.
2. **Check SDK Version**: The Superwall SDK must be collecting ASA attribution data on the client side.
3. **Check Timing**: There is a delay between app install via a search ad and when Apple sends attribution data. Events that fire before attribution data arrives will have empty ASA fields.

Events not mapping correctly [#events-not-mapping-correctly]

1. **Check Event Type**: Verify the Superwall event name matches one of the supported types in the event mapping table.
2. **Check Period Type**: For `initial_purchase` events, the period type determines whether the event maps to `free_trial` or `initial_purchase`.
3. **Non-renewing purchases**: These are mapped to `initial_purchase` in AppStance regardless of period type.