You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to set up Ad Tracking and IDFA I noticed the official docs has some setup steps with analytics-ios 4.1 or greater:
Starting iOS 14, applications must prompt users if that app needs to collect their Identifier for Advertisers (IDFA). Going forward with analytics-ios-4.1 and later, Segment doesn’t auto-collect IDFA. If your app or any integrations require the use of IDFA, you need to:
pass the below code snippet to Segment config and start tracking events
prompt the user for consent and collect the IDFA
You can use the following closure snippet to pass the value to analytics-ios as configurations:
@import AdSupport;
...
SEGAnalyticsConfiguration* configuration =[SEGAnalyticsConfiguration configurationWithWriteKey:@"YOUR_WRITE_KEY"];
// Enable advertising collection
configuration.enableAdvertisingTracking = YES;
// Set the block to be called when the advertisingID is needed
// NOTE: In iOS 14, you'll need to manually do authorization elsewhere and only when it has been authorized, return the advertisingIdentifier to segment via the block below
configuration.adSupportBlock = ^{
return[[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
};
[SEGAnalytics setupWithConfiguration:configuration];
Or the option of setting two keys under the context object:
Ad-tracking affects two keys under the context object of every event:
device.adTrackingEnabled
true if SDK is setup with closure and user has consented, false otherwise
device.advertisingId
idfa_value if user opts-in otherwise this key is skipped from event payload
I did this using the second option of adding to the context object, with the IDFA which I got from using this package:
final advertisingId =awaitgetAdvertisingId();
final adTrackingEnabled =awaitgetadTrackingEnabled();
Segment.setContext({
'device': {
'adTrackingEnabled': adTrackingEnabled.toString(),
'advertisingId': advertisingId,
}
});
I wonder if we should add some docs for setting up Ad Tracking and IDFA on iOS? I can do it just want to make sure this is something we want on this repo?
The text was updated successfully, but these errors were encountered:
I see this package is using analytics-ios 4.1.6
When trying to set up Ad Tracking and IDFA I noticed the official docs has some setup steps with analytics-ios 4.1 or greater:
Or the option of setting two keys under the context object:
I did this using the second option of adding to the
context
object, with the IDFA which I got from using this package:I wonder if we should add some docs for setting up Ad Tracking and IDFA on iOS? I can do it just want to make sure this is something we want on this repo?
The text was updated successfully, but these errors were encountered: