Closed buuuudzik closed 4 months ago
@buuuudzik thanks for this report! You're 100% in the right here, analytics
shouldn't be called in the constructor, this should be more similar to the AdvertisingID.
I also like the suggestion to check on Background -> Foreground
. We'll add that too as part of this fix.
Thanks @oscb I really appreciate your quick response 👏
@oscb What is the status of this issue? We need to fix it ASAP.
@oscb Great news! Big THANKS!
@oscb I've just checked this version and unfortunately nothing changed. Should I upgrade also Segment to make it works?
@oscb I've upgraded Segment to 2.19.0 and it also didn't help.
I'm creating a segment client in such a way:
const client = createClient({
writeKey,
trackAppLifecycleEvents: true,
trackDeepLinks: true,
collectDeviceId: true,
flushInterval: 5,
maxBatchSize: 15, // 15 x 32kB = 480kB so it's under the batch size limit of 500kb
// Link to docs about size limits: https://segment.com/docs/connections/sources/catalog/libraries/server/http-api/#batch
});
client.add({ plugin: new IdfaPlugin() });
This patch can fix the issue (but it won't detect the change after a device will go background and then foreground):
const client = createClient({
writeKey,
trackAppLifecycleEvents: true,
trackDeepLinks: true,
collectDeviceId: true,
flushInterval: 5,
maxBatchSize: 15, // 15 x 32kB = 480kB so it's under the batch size limit of 500kb
// Link to docs about size limits: https://segment.com/docs/connections/sources/catalog/libraries/server/http-api/#batch
});
const idfaPlugin = new IdfaPlugin();
if (!idfaPlugin.analytics) {
idfaPlugin.analytics = client;
}
client.add({ plugin: idfaPlugin });
@buuuudzik my bad, I was mixing this with another IDFA fix we merged recently. Just fixed the problem in this PR will merge and release as soon as it passes tests.
@buuuudzik 0.7.2 should have the fix, let us know if it doesn't work
@oscb It works! Great work! Thanks
We're using Segment and
IdfaPlugin
in our project. And recently I've found that IDFA isn't properly updated.I'm using a default behaviour of this plugin in such a way:
which means that
shouldAskPermission
is set to true andthis.getTrackingStatus()
from the constructor will be triggered immediately andthis.analytics
is undefined so context won't be updated even if the value has been received from the OS:this.analytics?.context.set({ device: { ...idfa } });
I've found that it works with such a patch:
Questions:
analytics-react-native
version: "@segment/analytics-react-native": "2.15.0", "@segment/analytics-react-native-plugin-idfa": "^0.6.2",Integrations versions (if used): "@segment/analytics-react-native-plugin-appsflyer": "0.5.2",
React Native version: "react-native": "0.70.13",
iOS 17 and older
Steps to reproduce Allow and cancel tracking permission
Expected behavior IDFA should be added to the events only if the user allowed for tracking and not cancelled this permission.
IdfaPlugin
should properly update Segment context in every scenarios.Actual behavior IDFA is not updated properly. When I've had an application with permission granted in the past and then I've cancelled this permission even after fully closing and reopening the app further events still included IDFA.
I've found that![image](https://github.com/segmentio/analytics-react-native/assets/28146020/91b57873-9131-42c4-9f7a-e78d3500d0e4)
this.analytics
inthis.getTrackingStatus()
can beundefined
.