angularytics
angularytics copied to clipboard
Added sanity check: is Google Analytics loaded?
This is just a very small tweak that makes sure ga
is actually defined before calling it.
Since Google Analytics is typically loaded asynchronously and sometimes even by Google Tag Manager which itself is loaded asynchronously, it's possible for ga
to be late to the party.
This oughtta make sure we never call an undefined function.
By the way: I'm not sure why my dist
version includes comments where yours doesn't. I built using the supplied Gruntfile in the main repo. If you have any idea how to fix that I'll gladly edit my pull request.