Closed matt-senseye closed 1 year ago
Completely agree with this feature. When I'm using Matomo in my Ionic app, as I track each page on loading, the first page is tracked twice (so always one more page view than there really is).
Seems a good idea to me!
Having the same problem here, and would love this feature!
@Arnaud73 what are your thoughts on this? It would be great to get this merged into the main project if possible, as I'm having some trouble installing my forked version of the library from my app and it seems others would benefit from this change too.
@Arnaud73 , wouldn't it be possible to merge this?
Sorry to insist, but it looks like more and more everyday that the project is no more alive. Is it still ? If yes, this pull request SHOULD be merged in my opinion.
Best,
I did not merge this enhancement as-is, however I implemented this exact suggestion on the new code base (ngx-matomo 1.0 and newer). This option can be found in the config object given to MatomoModule.forRoot(config)
(false
by default).
Thanks for the suggestion!
Summary
This PR adds an additional (optional) parameter to the
init()
function of the injector service which allows the user to initialise Matomo without automatically tracking the initial page load. Behaviour is unchanged by default, but if the user chooses to passtrue
to the new parameter it becomes possible to avoid tracking the initial page load - giving the user more control over when and how the first page event gets tracked.Detailed description of use case
In our application, we needed to:
By subscribing to the Angular router's
events
observable, the pipeline above worked nicely, but we found that ngx-matomo was also automatically capturing the initial page load as part of the process of initialising ngx-matomo. As a result, the events in the Matomo visitor log were inconsistent and the first log for each visit excluded the custom dimensions because they originated from the automatic call totrackPageView
inside ngx-matomo.I think giving the user the ability to disable this functionality would be useful in situations where more control is needed over the page tracking, so am hoping that this contribution would enhance the library.