Skip to content

Conversation

@Jon-edge
Copy link
Collaborator

@Jon-edge Jon-edge commented Sep 24, 2025

Fix mirroring between accountReferral's installerId and accountAppleAdsAttribution

Also rename the reported value to start fresh

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Requirements

If you have made any visual changes to the GUI. Make sure you have:

  • Tested on iOS device
  • Tested on Android device
  • Tested on small-screen device (iPod Touch)
  • Tested on large-screen device (tablet)


Note

Restricts Apple Ads attribution to iOS with success/fail tracking, renames the analytics field, simplifies attribution fetching to return undefined when unavailable, and updates the changelog.

  • Analytics & Attribution:
    • iOS-only seeding of accountAppleAdsAttribution in createAccountReferral with AAA_Success/AAA_Failed events (AccountReferralActions.ts).
    • Remove mirroring logic on load for accountAppleAdsAttribution.
    • Rename analytics param from refAccountAppleAdsAttribution to accountAppleAdsAttribution (tracking.ts).
    • Add new tracking events: AAA_Success, AAA_Failed.
  • Attribution Fetching:
    • getAppleAdsAttribution now returns undefined on non‑iOS or failures; adjusts retry/error handling (FirstOpenActions.tsx).
  • Changelog:
    • Add fix entry noting mirroring logic between installerId and accountAppleAdsAttribution.

Written by Cursor Bugbot for commit 21b5340. This will update automatically on new commits. Configure here.

@chatgpt-codex-connector
Copy link

💡 Codex Review

// First try the disk:
try {
if (account?.disklet?.setText == null) return
if (account?.localDisklet?.setText == null) return
const [cacheText, referralText] = await Promise.all([
// Cache errors are fine:
account.localDisklet.getText(REFERRAL_CACHE_FILE).catch(() => '{}'),
// Referral errors mean we aren't affiliated:
account.disklet.getText(ACCOUNT_REFERRAL_FILE)
])
const cache = asDiskReferralCache(JSON.parse(cacheText))
const referral = unpackAccountReferral(JSON.parse(referralText))
// Reference info server promo data to see if:
// 1. Any of these `activePromotions` are no longer valid (e.g. a
// promotion expired)
// 2. If the current `installerId` should get copied into
// `activePromotions` due to new matching promotion info
referral.activePromotions = await getActivePromoIds({
promoIds: referral.activePromotions,
installerId: referral.installerId,
countryCode: getState().ui.countryCode
})
dispatch({ type: 'ACCOUNT_REFERRAL_LOADED', data: { cache, referral } })
await saveAccountReferral(getState())

[P1] Losing late Apple Ads attribution for existing accounts

Removing the getFirstOpenInfo fallback means loadAccountReferral no longer repopulates accountAppleAdsAttribution when it is missing. Apple Search Ads attribution often becomes available hours or days after install, so accounts created before the data exists will now persist with accountAppleAdsAttribution undefined even if the device later obtains valid attribution. Because logEvent now reports the account-level field, analytics for those users will stay empty and the installerId/attribution pair will never be mirrored. Consider keeping the fallback or scheduling a refresh so late-arriving attribution is stored on the account.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment on lines 51 to 57
const cache = asDiskReferralCache(JSON.parse(cacheText))
const referral = unpackAccountReferral(JSON.parse(referralText))

// Ensure accountAppleAdsAttribution mirrors device-level attribution when missing or empty
const existingAttrib = referral.accountAppleAdsAttribution
const isAttribMissing =
existingAttrib == null ||
(existingAttrib.campaignId == null && existingAttrib.keywordId == null)
if (isAttribMissing) {
const { appleAdsAttribution } = await getFirstOpenInfo()
if (appleAdsAttribution != null) {
referral.accountAppleAdsAttribution =
asAppleAdsAttribution(appleAdsAttribution)
}
}

// Reference info server promo data to see if:
// 1. Any of these `activePromotions` are no longer valid (e.g. a
// promotion expired)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Losing late Apple Ads attribution for existing accounts

Removing the getFirstOpenInfo fallback means loadAccountReferral no longer repopulates accountAppleAdsAttribution when it is missing. Apple Search Ads attribution often becomes available hours or days after install, so accounts created before the data exists will now persist with accountAppleAdsAttribution undefined even if the device later obtains valid attribution. Because logEvent now reports the account-level field, analytics for those users will stay empty and the installerId/attribution pair will never be mirrored. Consider keeping the fallback or scheduling a refresh so late-arriving attribution is stored on the account.

Useful? React with 👍 / 👎.

Copy link
Collaborator Author

@Jon-edge Jon-edge Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will just have to live with it not working if the value doesn't make it in after the retries in loadAccountReferral

The whole point is to make sure we are guaranteeing only new accounts have the attribution. If we really need to later we can add a "attributionFailed" flag or something.

Added reporting to compensate

cursor[bot]

This comment was marked as outdated.

swansontec

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

…ppleAdsAttribution`

Also rename the reported value to start fresh
It is known that Apple Ads attribution is not always successful, so we need to
track the success/failure of the attribution process.
We may need to expand attribution beyond the first login, but keeping it simple for now.
@Jon-edge Jon-edge enabled auto-merge September 27, 2025 00:00
@Jon-edge Jon-edge disabled auto-merge September 27, 2025 00:00
@Jon-edge Jon-edge merged commit bc4e422 into develop Sep 27, 2025
2 of 3 checks passed
@Jon-edge Jon-edge deleted the jon/fix/aaa-3 branch September 27, 2025 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants