electerious / ackee-tracker

Transfer data to Ackee.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Option to Disable

devotoare opened this issue · comments

I know there's an ignoreLocalhost option but I develop using docker behind a reverse proxy so my sites have real URLs in development. It would be cool to have an option to just disable to the tracker so I could do something like

disable: process.env.ENV === 'prod' ? false : true

Or the inverse to enable it. Or maybe I'm missing something somewhere and you can totally do this already some other way.

How are you using ackee-tracker? Automatically, Manually or Programmatic?

Using process.env won't be possible as it's not available in the browser. You could wrap an if around the .record() call if you're using the tracker manually or programmatic.

I'm using it via the nuxt-ackee package, I just thought this feature was more suited to the main package since it seems like a thing most people would want.

I guess it's better to disable the tracking outside of ackee-tracker: If you don't want to track, don't call the tracker. This allows the developer to implement a condition that fits to the current environment.