mgonto / angularytics

The solution to tracking page views and events in a SPA with AngularJS
MIT License
630 stars 70 forks source link

Error: ga is not deined #49

Open Paolo1991 opened 8 years ago

Paolo1991 commented 8 years ago

I installed angularytics and follow the doc, but when i run i meet error: ReferenceError: ga is not defined

privetr commented 8 years ago

Same problem here

Paolo1991 commented 8 years ago

@privetr you still need add google analytics script. You add this code before the angularytics define: <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', 'YOUR ANALYTICS KEY', 'auto'); ga('send', 'pageview'); </script>

metal3d commented 8 years ago

Maybe you may add it in README or in any documentation page. Thanks :)

zcoon commented 8 years ago

@vanthanh9176 the Google analytics script should be added within the index.html, correct?

Paolo1991 commented 8 years ago

Yes, Google analytics script have to add within the index.html