angulartics / angulartics-google-analytics

Google Analytics plugin for Angulartics
MIT License
133 stars 86 forks source link

additionalAccountHitTypes is undefined #79

Closed mrudult closed 7 years ago

mrudult commented 7 years ago

Hi guys, I randomly get the error Error: i.settings.ga.additionalAccountHitTypes is undefined. It was working fine before v0.3.0. Can anyone help me on this? Thanks

DanWilkerson commented 7 years ago

@mrudult Are you setting your configs like this?

$analyticsProvider.settings.ga = { ... }

The additionalAccountHitTypes setting is new in v0.3.0; it allows you to control which hit types are duplicated to the accounts listed in $analyticsProvider.settings.ga.additionalAccountNames. By default it is instantiated like this:

  // Set the default settings for this module
  $analyticsProvider.settings.ga = { 
    additionalAccountNames: undefined,
    // Select hits to send to all additional accounts
    additionalAccountHitTypes: {
      pageview: true,
      event: true,
      exception: false,
      ecommerce: false,
      userTiming: false,
      setUserProperties: false,
      userId: false
    },  
    disableEventTracking: null,
    disablePageTracking: null,
    userId: null,
    enhancedEcommerce: false       
  };

That may be an oversight on our part - we might add checking for that object before trying to use it into the mix.

DanWilkerson commented 7 years ago

Since I haven't heard from you @mrudult I'm going to close this issue for the time being, under the assumption that you got it worked out. Please chime in if otherwise.