matomo-org / matomo-sdk-ios

Matomo iOS, tvOS and macOS SDK: a Matomo tracker written in Swift
MIT License
388 stars 164 forks source link

Add option for default `isOptedOut` #401

Closed b123400 closed 2 years ago

b123400 commented 3 years ago

I submitted an App to App Store and got rejected. Apple says tracking should be off by default and user should be able to opt-in, which makes sense to me. The current implementation doesn't tell the difference between an user-intended isOptedOut = false and the default false.

Is this feature welcomed? I can send a PR.

brototyp commented 3 years ago

Hey @b123400, thanks for your report.

I am not sure if I get your idea. The Matomo implementation currently has a parameter to opt out. You basically want to implement an opt in, right?

What do you think about something like this?

let matomoTracker = // your initialization for the Matomo tracker
matomoTracker.isOptedOut = !yourConfiguration.userOptedInForTracking

That should result in the same thing.

I don't really want to change the implementation of the MatomoTracker to be optIn, since this would break the functionality for all existing users.

b123400 commented 3 years ago

Yes that's correct. I was thinking about adding an extra option defaultIsOptedOut = false, that way we can preserve the existing behaviour and still allowing opt-in.

!yourConfiguration.userOptedInForTracking works, and that's the way I am currently using. But since I was rejected by Apple for being opt-out instead of opt-in, I guess somebody else might also need this functionality.

brototyp commented 2 years ago

Alright. Cool. Then let's keep it this way.