-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a method in the Google Analytics Provider to explicitly start tracking route changes #282
Comments
i agree. I'd like to see a |
@scttcper could I take a stab at implementing it for the Google Analytics provider? Or would you prefer they be done all at once? |
can just do one if you want, but i wouldn't put it in master until all of them and the docs show how to use it any contribution is more than i've been doing in the last month or 2 and welcome |
add startTracking() method in each provider. it sets up subscriptions to the ReplaySubjects: pageTrack, eventTrack, exceptionTrack, and userTimings BREAKING CHANGE: providers will no longer start tracking events by default. a call to `startTracking()` will be necessary to maintain functionality closes angulartics#282
I've created PR #283 for this Issue, could a maintainer please take a look? |
hey i'm waiting to hear back from one of the other maintainers about updating our npm token thats blocking us from publishing right now. i don't have rights on npm. i'd like to add another breaking change or to as well before getting into master. |
…283) * feat(providers): add method to initiate event tracking add startTracking() method in each provider. it sets up subscriptions to the ReplaySubjects: pageTrack, eventTrack, exceptionTrack, and userTimings BREAKING CHANGE: providers will no longer start tracking events by default. a call to `startTracking()` will be necessary to maintain functionality closes #282 * docs(core,providers): add documentation for `startTracking()` method document that `startTracking()` must be called to initiate router/exception events to be tracked
BREAKING CHANGE: requires angular 6. BREAKING CHANGE: providers will no longer start tracking events by default. a call to startTracking() will be necessary to maintain functionality BREAKING CHANGE: no longer requires passing of providers to Angulartics2Module.forRoot shoutout to @rossedfort closes #282
🎉 This issue has been resolved in version 7.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I'm submitting a ...
Under step 2 of Include it in your application in the angulartics documentation, It says simply injecting the
Angulartics2GoogleAnalytics
provider in your root application component will start tracking route changes. This is true, it works fine, however, the approach goes against some general conventions. The documentation implies to inject the provider into the component, but forgo making it a member of any instances of the component class (implied by lack ofprivate
orpublic
keyword in the constructor). This seems right, however, the value of the provider is never used in the constructor. This causes the TypeScript compiler to complain, if you have the following rule enabled:tsconfig.json
Adding the
public
keyword to the injection, thus making the provider a public member on the instance of the component gets ride of the compiler error (because the compiler can't check if its value is ever used), but makes the code incorrect.Adding the
private
keyword to the injection, thus making the provider a private member on the instance of the component seems more correct, yet again, causes a compiler error, as its value is never usedMy suggestion/request is to implement a method that users would call to explicitly initiate tracking. This ensures the code is conventional.
Unless I'm missing something, TSLint, the TypeScript compiler, and even Angular's Dependency Injection Documentation all indicate this as a code smell.
Thanks for reading, and thanks for this great library.
Using angulartics 5.4.0
The text was updated successfully, but these errors were encountered: