## Discrepancy between audience data in Tealium and mobile apps
- Property tracker CTA experiment is limited to `particular audience type` at the moment (TODO: more context about audience type later)
- People have been seeing the property tracker CTA even though they have already tracked a property
- The hidden menu indicates that these users have not fallen out of the track ready audience (TODO: Insert Audience ID and sheet here)
- However, after consulting with @Ish from data services team, we later found that these users have, in fact, not been assigned to the track ready audience
- There might be a bit of a synchorinsation issue between the data we receive on the mobile apps vs whats in Tealium
- The mobile apps are leveraging [cached visitor profile](https://docs.tealium.com/platforms/ios-swift/module-list/visitor-service/#class-tealium)
- The visitor profile is transformed into `MarketingProfile` and saved on disk for future use
- The [update](https://docs.tealium.com/platforms/ios-swift/module-list/visitor-service/#class-visitorservicedelegate) of the visitor profile is not observed (TODO: line of code from github)
## Testing Strategy
- Login with an account that has no audiences (we might need to clear all audiences if using an existing account)
- Put the user IN the track ready audience (TBD - we'll need help to do this since we want to simulate a real syncing scenario)
- Restart the app a few times (for the audience data to be synced correctly)
- Intercept connections with Charles to see the visitor profile data we're getting from Tealium
- [ ] Verify through the hidden menu that the user has been bucketed correctly into the track ready audience
- [ ] Verify that the property tracker CTA experiment is shown on the landing screen
- Put the user OUT of the track ready audience and restart the app a couple of times (Q: by tracking the property?)
- Again, intercept connections with Charles to see the visitor profile data we're getting from Tealium
- [ ] Verify through the hidden menu that the user has been rolled out from the track ready audience
- [ ] Verify that the property tracker CTA experiment is no longer shown on the landing screen
## Investigations
- Identify whether we can leverage [`VisitorServiceDelegate`](https://docs.tealium.com/platforms/ios-swift/module-list/visitor-service/#class-visitorservicedelegate) to get real-time updates for visitor profiles
- Verify that Android does not have this problem!
## Findings So Far (TBD)
- @Ish has mentioned an issue with Tealium events doubling up behind the scenes. This could potentially cause issues when a user is tracking and un-tracking properties in quick successions
- The property count can go below 0 (into negative counts). Once it goes into negative number, the user would have to track the same amount of property + the negative offset (until the count is bigger than 0) to potentially be bucketed into one of the property tracker audiences. This could have an implication on when a user falls in/out of the `Track Ready` audience
- To paint a scenario for the above, say User A does a particular set of actions within the app and gets bucketed into the `Track Ready` audience
- User A tracks a property, gets bucketed into the `Property Tracker` audience and falls out of the `Track Ready` audience.
- They un-track the same property soon after. The untrack event doubles up and causes the property count that User A has to -1
- User A falls out of the `Property Tracker` audience and possibly back into the `Track Ready` audience
- In order for User A to be bucketed back into the `Property Tracker` and out of the `Track Ready` audience, they'd have to track a property twice (increasing the count by 2, therefore making the final count 1)
- #stack-stars is aware of this and is currently working on a fix
- We're still trying to investigate the timeframe in which the Tealium data is synced properly on the mobile apps
### Android
- Tealium audience data is fetched every 5 min according to the [docs](https://docs.tealium.com/platforms/android-kotlin/module-list/visitor-service/#visitor-profile-refresh-interval)
- According to the requests we're seeing and the spike results done by what used to be the growth-mobile team, a tracking event will be followed directly by a visitor profile update (TODO: insert git issue). The number of updates is throttled to just one per 10 seconds (TODO: insert git issue spike results)
- Ideally, the profile/audience data we're seeing from Tealium is the latest but we have yet to confirm this.
### iOS
- The refresh interval of Tealium audience data is set to 1 min
- For each usage tracking, the request will go through the Tealium module chain. Accordingly, when there is at least one visitor service attached, the visitor profile manager will request a refresh and store such profile to the cache. (TODO: add the line of code from tealium-swift)