Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Same '$identify' event being sent on every app background, even after opt-out/not updating user properties #164

Open
aadityaer91 opened this issue Jan 29, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@aadityaer91
Copy link

Expected Behavior

  • If app isn't setting user_properties and opt-put as well, app should not sent '$identify' events.
  • Once set/updated, and sync was successful with API success. It should be cleared from local and shouldn't be sent again and again on every app's background.
  • Previously set custom user_properties should be visible on amplitude dashboard.

Current Behavior

  • As per observation, app is setting custom user properties and it's being sent in APIs as well.
  • Once set, app is opting out as per user request and stop sending events as well as not setting/updating any user properties.
  • Even after restricting, we can monitor single amplitude api call, when iOS app goes to background.
  • On capturing request data, we found that, 'timestamp' of event data is always same even after it's being sent after few minutes. But, 'event_id' is always different and in increasing order. Other data like, session_id, user_properties etc. are always same.
  • Custom user_properties aren't visible on amplitude dashboard for all iOS device.
  • Note: On Android, everything works fine, with same implementation.

Possible Solution

  • Once user_properties set/updated, and sync was successful with API success. It should be cleared from local and shouldn't be sent again and again on every app's background.

Steps to Reproduce

  1. Launch the app, do the initial amplitude setup, as given below.
  2. In first session, as per setup, Set opt-out to false, enable session tracking and set custom user properties.
  3. Monitor API calls while app is running or when app goes in background.
  4. Re-launch the app. So setup update again. This time, disable session tracking, setOptOut to true and don’t set any user properties.
  5. Keep app in background, monitor network, you will see api call to https://api2.amplitude.com/ with request data having event_type: $identify .
  6. Repeat this last step again and again and monitor. API is sending same data having same session_id and timestamp, with new event_id in increasing order.
  1. amplitude setup:
await _analytics.init(amplitudeKey, userId: userId);
await _analytics.setOptOut(!(globals.prefs.isFirstSession.value || globals.prefs.isHereImprovementOn.value));
await _analytics.enableCoppaControl();
await _analytics.setOffline(globals.prefs.isOfflineModeOn.value);
if (globals.prefs.isFirstSession.value || globals.prefs.isHereImprovementOn.value) {
  await _setAmplitudeUserProperties(_analytics);
}
await _analytics.trackingSessionEvents(globals.prefs.isFirstSession.value || globals.prefs.isHereImprovementOn.value);

  1. My use case:
  • Allowing tracking on first session only, if no analytics consent given.
  • And track always if consent is provided.
  • Stop tracking again, if user revoked consent.
  1. Event data in request:
    {
    "session_id": 1706513065590,
    "user_properties": {
    "$set": {
    "Map version": "114.114.73.73",
    "Door-to-door": true,
    "App Theme": "Sync with device",
    "Channel": "Beta",
    "Map Theme": "Sync with device",
    "Traffic": false,
    "Map View": "DEFAULT",
    "SDK deviceID": "0a6aa9"
    }
    },
    "language": "English",
    "event_type": "$identify",
    "sequence_number": 1,
    "user_id": "6e0
    ****c05",
    "country": "United States",
    "api_properties": {
    "tracking_options": {
    "lat_lng": false,
    "city": false,
    "ip_address": false
    }
    },
    "device_id": "7E74355E-B8C3-4486-94AE-DF03D19046B1",
    "event_properties": {

    },
    "uuid": "DA190D21-5F61-4B0C-890C-DA3005EF6BD7",
    "device_manufacturer": "Apple",
    "version_name": "4.11.200",
    "library": {
    "name": "amplitude-flutter",
    "version": "3.16.1"
    },
    "os_name": "ios",
    "platform": "iOS",
    "event_id": 32,
    "carrier": "Unknown",
    "timestamp": 1706513072174,
    "groups": {

    },
    "os_version": "17.2",
    "device_model": "Simulator",
    "group_properties": {

    }
    }

  2. Above logs are from simulator.

Environment

  • SDK Version: 3.16.0
  • Flutter Version: 3.10.5
  • Device: iPhone 15 Pro Max simulator
  • Device OS and Version: iOS 17.2
@aadityaer91 aadityaer91 added the bug Something isn't working label Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant