集成 Angulartics 时出错

Error integrating Angulartics

我正在尝试将 Angulartics 集成到我的 AngularJS 1.0.7 网络应用程序中以用于 Google 分析。尝试加载主页时出现此错误:

Uncaught TypeError: undefined is not a functionangulartics.min.js:6 (anonymous function)angular.js:2892 invokeangulartics.min.js:6 (anonymous function)angular.js:2895 invokeangular.js:2744 (anonymous function)angular.js:130 forEachangular.js:2744 createInjectorangular.js:978 resumeBootstrapInternalangular.js:993 bootstrapangular.js:954 angularInitangular.js:14843 (anonymous function)jquery-1.10.2.min.js:4 x.Callbacks.cjquery-1.10.2.min.js:4 x.Callbacks.p.fireWithjquery-1.10.2.min.js:4 x.extend.readyjquery-1.10.2.min.js:4 q

我添加了这样的模块:

angular.module('myApp', ['myApp.filters', 'myApp.services', 'myApp.directives', 'myApp.controllers', 'myApp.i18n', 'myApp.properties', 'angularSpinner', 'ngCookies', 'ngSanitize', 'ngProgress', 'angularMoment', 'tmh.dynamicLocale', 'angulartics', 'angulartics.google.analytics'])
  .config(['$routeProvider', '$httpProvider', function($routeProvider, $httpProvider, $routeParams) {...}

我已经包含了 javascript 个插件:

<!-- Angulartics -->
    <script src='lib/plugins/angulartics.min.js'></script>
    <script src='lib/plugins/angulartics-ga.min.js'></script>

最后添加了 Google 跟踪代码段(注释最后一行):

<script>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

      ga('create', 'UA-59702007-1', 'auto');
      // Removed requested by Angulartics (see doc) ga('send', 'pageview');

    </script>

终于用 Angularytics 代替 Angulartics 解决了这个问题。我没有集成依赖问题。