Closed stevebrowndotco closed 2 years ago
The easiest solution is (imo) to create a proxy service (a service / class that has the same functions that you need from FirebaseAnalytics) and check there.
E.g. FirebaseAnalytics.logEvent(...)
is going to be CustomAnalytics.logEvent(...)
with
class CustomAnalytics {
static logEvent(...) {
if(!environment.production) return;
FirebaseAnalytics.logEvent(...);
}
}
This also enables you to switch to a different analytics provider without refactoring your whole code.
Another (common) solution is to have a development and production project & configuration.
I tried to do something like this:
...but I am flooded with error messages on each FirebaseAnalytics event
Thank you!