如果不推荐使用 iAD,如何将 advertiserId 发送到 Segment-Analytics

How to send advertiserId to Segment-Analytics if iAD is deprecated

我正在尝试通过细分整合 Facebook 应用事件。

来自Segment Integration Docs

You will have to be sure that the IDFA is working within your app, which involves adding the iAD framework.

Once you have added this, you will start to see the context.device.advertiserId populate and the context.device.adTrackingEnabled flag set to true.

但是,iAD was deprecated!

来自 Apple 文档:

iAd Framework
On your next regular app update or submission, you should remove the deprecated iAd framework and connection.

当我在 Segment 中打开调试器时,值不存在:

"context": {
    "device": {
      "id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
      "manufacturer": "Apple",
      "model": "x86_64",
      "type": "ios"
    },
}

When submitting to the AppStore, I'm flagging YES to IDFA as a Segment requirement。所以我可以想象它以某种方式连接。

有人知道如何将 advertiserIdadTrackingEnabled = true 发送到 Segment 吗?

我用这两行代码解决了问题:

import AdSupport

ASIdentifierManager.sharedManager().advertisingTrackingEnabled

只有使用这两行,Segment-Analytics 才能将数据发送到他们的服务器。

"device": {
  "adTrackingEnabled": true,
  "advertisingId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
  "id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
  "manufacturer": "Apple",
  "model": "x86_64",
  "type": "ios"
},