mitjans / nuxt-posthog

Posthog module for Nuxt
https://nuxt-posthog.cmitjans.dev
MIT License
27 stars 3 forks source link

✨ Auto disabled in all env except production #36

Closed jd-solanki closed 4 months ago

jd-solanki commented 4 months ago

Hi 👋🏻

Thanks for creating this module. I was checking docs and found that we've first disable the module in dev mode to accidently avoid tracking. Hence, I added below in nuxt config:

disabled: process.env.NODE_ENV !== 'production'

How about adding this to source code. I don't have that much experience with nuxt modules so just suggesting it.

mitjans commented 4 months ago

Could Nuxt Environment overrides fix this for you?

It makes sense to disable this module in all environments except for production, although I would do it under a specific setting.

jd-solanki commented 4 months ago

Thanks. Even if we use env overrides then we do have to specify the env for dev.

This is just my opinion if you don't think this brings anything useful to the table. Feel free to close the issue.

I just want to find out what is the proper way to handle prod & dev.

mitjans commented 4 months ago

You might want to have Posthog activated in an environment other than production for testing. After second thought, I think enabling this module by default in all environments is good. If you want a different behavior in one environment, you can override it with the configuration disabled.