angulartics / angulartics-google-tag-manager

34 stars 35 forks source link

Include angulartics / angulartics-gtm code in GTM Custom HTML Tag #10

Closed smhmic closed 8 years ago

smhmic commented 8 years ago

Reviewing the angulartics code, it seems like there is no requisite for the angularities library & plugin code to be loaded on-page; it'd function just as well if it were deployed via GTM. Is that the case?

If so, would that be a viable option to provide as an additional Container export (or at least mention in the README)?

DanWilkerson commented 8 years ago

Interesting idea! I spent about an hour trying to hack this to work. The short answer is no, this will not work.

The long answer appears to me to be that we can't get a reference to the initial configuration provider without making changes in our app initially, and so when we dynamically add modules, they get handled by a different injector.

There's no benefit in this context to using Angulartics over the historyChange listener in GTM, though, as far as I can see (besides maybe some of the configurations you can add with Angulartics). The real benefit of Angulartics is utilizing the library within the app for event tracking et al, IMO. Could you share more about some benefits you see to this approach?

Philosophically speaking, I'd say never include libraries of any kind through GTM. It's dangerous and can cause some serious headaches for devs. It's a really quick way to break a client's site.