angulartics / angulartics-google-analytics

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

Avoid non-function if GA tracker not present yet #114

Closed lucianosantana closed 6 years ago

lucianosantana commented 6 years ago

There might be cases where the GA tracker must be loaded with some delay. With the current implementation this completely breaks the functionality of sending events to Google Analytics. The problem is that the dispatchToGa function is defined once, on the module's config phase and if for any reason the GA script is not loaded yet, then it won't do any action, never.

The proposed solution is to perform the verification of which tracker is being used on every call, and then dispatch to the correspondent function.

timelf123 commented 6 years ago

thank you!

timelf123 commented 6 years ago

0.5.0 released

DanWilkerson commented 6 years ago

Didn't realize what this was doing, but seems a sensible improvement. Thank you.