revolunet / angular-google-analytics

Google Analytics tracking for your AngularJS apps
MIT License
652 stars 179 forks source link

How to disable logging to the console? #218

Closed CheungJ closed 6 years ago

CheungJ commented 6 years ago

For protractor tests, I have disabled analytics via disableAnalytics(true). However, it's writing the following message to the console:

[1128/123839.712:INFO:CONSOLE(44240)] "Analytics disabled: ..."

Protractor is seeing the message and outputting it to the terminal.

Is there a way to completely prevent all console logs?

justinsa commented 6 years ago
  1. You could provide the service a stub $log service and just noop all calls to it.
  2. You could use offline mode instead of disableAnalytics. Offline mode doesn't load the GA scripts and just logs all calls to an internal queue.
CheungJ commented 6 years ago

Thanks for the speedy response! Your second option worked: AnalyticsProvider.startOffline(true);

Thank you!