Attribution and ad costs
Import ad spend into SubHero and read CPA and ROAS beside subscription proceeds by channel, campaign and ad set.
Acquisition is a project-scoped, read-only import pipeline. Open Acquisition in the console, connect a source, select one primary attribution source, and map its campaign names to billed campaign IDs. Credentials are encrypted and never returned by list/read endpoints. Only project owners and administrators can change connections, mappings, or import files; members can read aggregate metrics.
The primary source selects a coherent channel/campaign/ad-set tuple. Other provider attributions remain stored. Without a match, a subscriber is organic. The importer first matches the provider's customer user ID to the project's app user ID, then a nonempty, non-placeholder device ID only when it resolves to exactly one subscriber. An authenticated provider customer user ID outranks SDK-only claims. Provider-owned conflicting IDs are not transferred between accounts; ambiguous candidates at the same trust level remain unmatched. Each subscriber/provider keeps the earliest install, with the external install ID breaking equal-time ties. A restatement of that same install may correct its fields.
Source setup
These are incoming sources, separate from the outbound analytics destinations under Webhooks & integrations. Their credentials are generally different.
| Source | Account/app identifier | Credential fields | Prerequisites and imported data |
|---|---|---|---|
| AppsFlyer | A stable app identifier | app_id, api_token | Raw Data Pull API access and a current V2 API token. Pulls both organic and non-organic installs, customer user IDs and provider/device IDs. Raw per-install Cost Value/Cost Currency are retained as MMP cost estimates, not a network invoice. |
| Adjust | App token | app_token, api_token | Report Service access. Pulls campaign/adgroup network cost in USD; configure Adjust ad-spend connectors first. Individual installs require a user-level export, described below. |
| Branch | Branch app ID | app_id, access_token | Data Feeds / Custom Exports access, including sensitive identity fields. Creates an eo_install export and resumes its handle until explicitly complete. The Branch key/secret used by outgoing events is not this Access Token. |
| Singular | A stable app identifier | app_name, api_key | Reporting API access. app_name is the exact app filter name from Singular, not a bundle ID. Polls data availability and asynchronous reports; uses original cost and its original currency. Individual installs require a user-level export. |
| Meta Ads | Numeric ad account ID, without act_ | access_token | A system-user or user token with read access to this account (ads_read or an appropriate approved equivalent). Reads ad-set-level Insights; never creates or edits ads. |
| Google Ads | Numeric customer ID, without dashes | developer_token, client_id, client_secret, refresh_token, optional login_customer_id | Authorized OAuth refresh token for Google Ads and an approved developer token. Manager access may require the numeric login customer ID. Reads campaign metrics.cost_micros, already in micros. |
| Apple Search Ads | Numeric organization ID | client_id, team_id, key_id, private_key | Apple Ads API client with reporting permission. Paste the PEM private key; the worker signs a short-lived ES256 client secret, exchanges it for a token, and reads campaign reports. No campaign mutations. |
Saving validates credential format locally and stores encrypted credentials; it does not prove provider access. Use Pull cohort start day to queue verification and a report import. The request returns 202 immediately; the import history records preparation, completion or failure. A successful report verifies access for that request, not historical reconciliation. Pause/resume retains existing spend. Rotate credentials by saving the same source/account again.
Official contracts: AppsFlyer raw installs, Adjust Report Service, Branch Custom Exports, Singular Reporting API, Meta Insights, Google Ads Search, Apple campaign reports.
SDK conversion callbacks
After consent, pass the provider's stable device identifier from its conversion callback to setAttribution(provider:data:consentGranted:) (Swift, async/throwing) or setAttribution(provider, data, consentGranted) (Kotlin, suspending). Use appsflyer_id for AppsFlyer, adid for Adjust, branch_id for Branch, or singular_id for Singular. The native SDKs reject empty and zero-placeholder identifiers. A consent denial clears local identifiers and does not send a registration request.
The SDK registers only these identifiers at POST /v1/attribution, using an attested production SDK session; it never submits channel or campaign claims as attribution truth. The server scopes the claim to that session's project and subscriber. Configure the MMP customer user ID to match the identified app user ID, then import the provider's report to resolve channel and campaign. Sandbox and unattested sessions do not register production attribution. Each installation may register one current value per identifier kind; changing it replaces that installation’s previous claim. An authenticated provider export containing the app user ID may supersede a conflicting SDK-only claim. Registration errors surface to the caller; retry with bounded backoff after transient failures, and respect rate-limit retry instructions. This scoped registration does not establish a vendor-side erasure or permanent opt-out policy.
Adjust and Singular user-level exports
Their aggregate reporting APIs do not identify individual subscribers. Export conversion/install logs through the provider's raw-data export or ETL facility, then upload a CSV using Import an Adjust / Singular user-level CSV export. This adapter does not pretend a cost report is user-level data. The current console upload limit is 8 MiB / 50,000 rows; split larger exports. A malformed row rejects the entire file before any rows are applied. Validated attribution is applied in batches of at most 1,000 rows, with a shared identity lock released between batches. An infrastructure interruption can leave completed batches; replaying the file is safe. This is separate from the atomic financial day replacement.
Configure the export column names below; times must be ISO 8601 or UTC YYYY-MM-DD HH:mm:ss. Provider exports with custom column aliases must be normalized to these names before upload. Only installs belong in this import, not sessions, impressions, or revenue events.
| Field | Adjust export column | Singular export column |
|---|---|---|
| App customer user ID | customer_user_id | custom_user_id |
| Provider device ID | adid | singular_device_id |
| Channel | network_name | network |
| Campaign | campaign_name | campaign_name |
| Ad set | adgroup_name | sub_campaign_name |
| Creative | creative_name | creative_name |
| Install time | installed_at | install_timestamp |
| Optional advertising IDs | idfa, gps_adid | idfa, gps_adid |
Use provider data feeds for the raw export, not an unverified conversion callback masquerading as a server report. The authenticated administrator uploading the file is the trust boundary. Automatic authenticated bucket ingestion of these raw exports is not enabled by the aggregate API connection.
Completeness and reconciliation
At 21:15 UTC the worker requests the previous seven complete UTC dates. Dispatch has its own checkpoint, so a manual historical pull cannot suppress the next nightly restatement. Network reports retain their account reporting-day definition (Meta/Google use account time zones; Apple requests UTC). Match these time zones and attribution windows when reconciling the provider dashboard.
A completed pull replaces the whole project/network/account/day set atomically, including deleting omitted rows. A failed page, expired credential, 429, malformed amount, incomplete async report, unstable total, or source cap preserves the previous complete set. Branch checks its explicit completion state and exported row count. AppsFlyer rejects a day at its one-million-row cap; split/alternate delivery is required rather than silently truncating. Async report handles are checkpointed in acquisition_import_runs, separate from store-receipt import_runs because they have different lifecycle and recomputation contracts.
The cost key is (project, network, account, campaign, adset, day, source currency). Missing ad sets use *. MMP duplicates sum at the exact currency grain; when an explicit campaign total and its ad-set detail coexist, the total is authoritative and detail is omitted. The writer rejects remaining mixed grains within a currency. Ad-set names join/filter costs and attribution; IDs remain the storage key, and unnamed costs fall back to their ID. Network namespaces isolate identical campaign IDs. MMP costs use mmp:<source> and only the primary provider contributes them. A campaign mapping suppresses its MMP estimate only when a direct billed network row exists for that exact campaign/day. Mapping targets are one-to-one within each attribution source to prevent duplicating a billed invoice across aliases. Unmapped billed spend remains visible.
Metric definitions
GET /v1/metrics/acquisition accepts server keys. The console uses the same reader with session membership checks. SDK sessions cannot read financial metrics. All money and ratios are decimal strings; counts are integer strings.
- Cohorts use primary-source install date in UTC, falling back to subscriber first-seen date in UTC. Spend retains the provider reporting day; daily windows may differ near midnight for non-UTC ad accounts. Installs include unmatched primary-source install records; new subscribers count known subjects created in the selected cohort range.
- Payers count each subject's first verified paid purchase once. Trials count known subjects with a verified trial. Proceeds include subsequent verified charges and refunds for the selected cohort through the response's
revenue_throughtimestamp. - CPA = spend / payers; ROAS = proceeds / spend; ROMI = (proceeds − spend) / spend. Zero payers gives null CPA; zero spend gives null ROAS/ROMI and zero CPA when there are payers.
- Original spend is kept in its source currency and integer micros. MMP allocated/converted amounts accept exact decimal or exponent text and round half-even to micros; direct network fields retain their strict unit rules. Reporting-currency conversion uses Step 8's exact rational FX on the spend day; missing FX is unknown, never zero.
- Predicted 180/365-day proceeds use Step 10 segment LTV estimates for each first-paid subject. Missing or stale estimates remain null.
- Country/product/experiment and other subscriber dimensions filter verified facts using the central dimension predicates. The source spend grain cannot allocate cost to those dimensions, so spend/CPA/ROAS are null and
spend_unallocated=true. Channel, campaign and ad-set filters retain comparable costs. No proportional allocation is invented.
Owner-dependent acceptance remains pending: connect at least one real MMP and ad account, compare last month's spend exactly, align currency/time zone/attribution windows, and reconcile installs. Synthetic fixtures and mock API contracts do not substitute for that check.
Privacy boundary
eraseIntegrationIdentity also removes this subject's current attribution and private device claims; ad invoices are aggregate and remain. Confirmed anonymous merges reparent claims and attribution without replacing an existing identified subject's same-provider attribution. Raw MMP payloads, unmatched payload identifiers, and device claims expire after 30 days; each privacy pass processes at most 1,000 rows per table, skips locked/cleared rows, and can replay safely. Provider or SDK confirmation refreshes a claim’s retention clock; expired claims are excluded from matching even before cleanup. Unfinished onboarding retains these claims and raw evidence; incomplete onboarding retains evidence. Aggregate unmatched install dimensions remain after payload scrubbing. Store raw notifications and onboarding catch-up evidence are not pruned here.
These scoped helpers do not implement a general account/store-proof erasure product or vendor-side recall, and do not establish a permanent opt-out from future authorized imports. That broader policy remains owner-defined. This corrects the earlier Step 19 note assigning an unspecified full-erasure workflow to Step 27.