-
Notifications
You must be signed in to change notification settings - Fork 163
Open
Labels
Description
Hi, for the sake of avoiding an if around every Analytics.trackEvent line we have in our code, I'd like to have a way to disable this module when a UA account is not defined (that's an option that our users will have to use or not).
Unfortunately disableAnalytics requires an account or gives a stack trace exception, so I worked it around like this:
mod.config(/*@ngInject*/ function (AnalyticsProvider, analyticsId) {
if (analyticsId)
AnalyticsProvider.setAccount(analyticsId);
else {
AnalyticsProvider.setAccount(''); // else fails on next line
AnalyticsProvider.disableAnalytics(true);
}
})This works ok (and any page change and event tracking generate no errors), but is there a recommended way to achieve this?
Reactions are currently unavailable