posthog-flutter icon indicating copy to clipboard operation
posthog-flutter copied to clipboard

No config set from dart

Open alexsunderlion opened this issue 3 years ago • 10 comments

I haven't seen any method to set configuration(API_KEY, POSTHOG_HOST, TRACK_APPLICATION_LIFECYCLE_EVENTS, DEBUG) from dart layer. Better to have config/init function to set API_KEY and other option based on dynamic environment from flutter.

alexsunderlion avatar Aug 23 '22 11:08 alexsunderlion

Up on this issue. Just to be clear: currently, the only way to set configuration is to hardcode them in info.plist for iOS?

metafounder avatar Sep 23 '22 11:09 metafounder

any update on this issue?

metafounder avatar Mar 09 '23 13:03 metafounder

Yes, we are only able to hardcode them in info.plist

alexsunderlion avatar Mar 09 '23 13:03 alexsunderlion

I agree with this, I'm using FlutterFlow and there is now an easy way to edit platform specific code there, an init function is needed for such scenarios.

danielmeza avatar Jun 14 '23 00:06 danielmeza

No updates, sorry, but we will consider it for the next major version.

marandaneto avatar Oct 09 '23 06:10 marandaneto

+1 would be great to have it as all other libs provide ability to pass tokens via init. We have different tokens for different envs and also would like to avoid hardcoding things in Info.plist

Maxim-Filimonov avatar Oct 09 '23 12:10 Maxim-Filimonov

Adding that this is necessary to enable tracking of lifecycle events while staying compliant with cookie laws in the European Union.

flodaniel avatar Jun 06 '24 09:06 flodaniel

Adding that this is necessary to enable tracking of lifecycle events while staying compliant with cookie laws in the European Union.

It's possible to disable already so it's already compliant, only needed if you want to enable it again at runtime.

marandaneto avatar Jun 06 '24 10:06 marandaneto

On Android, you could have a Manifest per flavor, see comment. On iOS, you could use eg PlistBuddy, see comment.

marandaneto avatar Jun 25 '24 07:06 marandaneto

In our app the users can select their region (EU vs. non-EU) at runtime, so I also want to make the choice about posthog lifecycle events at runtime.

flodaniel avatar Jun 25 '24 10:06 flodaniel

PR is up

marandaneto avatar Oct 02 '24 14:10 marandaneto