angulartics / angulartics-google-analytics

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

Unenclosed ga triggering error #72

Closed jasonbodily closed 8 years ago

jasonbodily commented 8 years ago

The source code appears to include:

$analyticsProvider.registerSetUserProperties(function (properties) {
    if(properties) {
      // add custom dimensions and metrics to each hit
      var dimsAndMets = dimensionsAndMetrics(properties);
      ga('set', dimsAndMets);
    }
  });

In all other places in the code, ga is enclosed with if(window.ga) {} however, here it is not. This throws an error if ga is not present.

DanWilkerson commented 8 years ago

This is fixed via https://github.com/angulartics/angulartics-google-analytics/pull/71 (will log "method not found" to console).