la-haus / flutter-segment

Segment.io library for flutter
MIT License
22 stars 139 forks source link

Missing advertisingId and adTrackingEnabled #21

Closed ariefwijaya closed 2 years ago

ariefwijaya commented 2 years ago

Refer to the segment official docs:

  1. ios https://segment.com/docs/connections/sources/catalog/libraries/mobile/ios/#ad-tracking-and-idfa
  2. android https://segment.com/docs/connections/sources/catalog/libraries/mobile/android/#analytics-android-and-unique-identifiers

We need to add option to enable/disable advertising id.

ariefwijaya commented 2 years ago

For now, I'm using this plugin to get the advertising_id and pass it to the flutter-segment from the app side. I figure out this could be included in our flutter-segment plugin. But, wdyt? @danielgomezrico

danielgomezrico commented 2 years ago

And so that will require to add this https://pub.dev/packages/advertising_id inside flutter-segment?

I see from the documentation you shared that they expose a way to get that directly, why do you need that other dependency?

ariefwijaya commented 2 years ago

yes and also we need to have a config to enable/disable the advertising id. Because I think, the segment supports this feature.

Please read: https://segment.com/docs/connections/sources/catalog/libraries/mobile/android/#analytics-android-and-unique-identifiers https://segment.com/docs/connections/sources/catalog/libraries/mobile/ios/#ad-tracking-and-idfa

I prefer to use another dependency rather than create them manually inside our flutter-segment is because to make it easier to maintain and also because of this notes from the segment:

Note: From 4.10.1, Segment no longer collects the Android ID to comply with Google’s User Data Policy.

So I think, we can just use that other dependency instead

ariefwijaya commented 2 years ago

Closed this issue, better to add advertising id outside flutter-segment plugin

Mik77o commented 2 years ago

For now, I'm using this plugin to get the advertising_id and pass it to the flutter-segment from the app side. I figure out this could be included in our flutter-segment plugin. But, wdyt? @danielgomezrico

@ariefwijaya How was advertisingId added manually? I added something like this on the Flutter side.

     SegmentDefaultOptions.instance.options = {
          'context': {
            'device': {
              'adTrackingEnabled': true,
              'advertisingId': advertisingId,
            }
          }
        };

Some of the fields for device field that were visible before are no longer present. It looks like the device part has been overwritten. Only the type: ios left.

From Segment:

before my changes

    "device": {
      "id": "test",
      "manufacturer": "test",
      "model": "test',
      "name": "test",
      "type": "ios"
    },

now (Adding a configuration manually)

    "device": {
      "adTrackingEnabled": true,
      "advertisingId": "00000000-0000-0000-0000-000000000000",
      "type": "ios"
    },