matomo-tracker icon indicating copy to clipboard operation
matomo-tracker copied to clipboard

Add enableTracking function and allow lazy loading

Open opsidao opened this issue 3 years ago • 3 comments

As a solution to #478 here a propose adding a enableTracking function to MatomoTracker which does the loading of the matomo.js file and the emission of the correct events. This function is just an extraction of the last part of the initializer on the MatomoTracker that is exposed through the useMatomo hook, allowing users to delay loading the actual matomo library by:

  • Passing disabled when creating the Matomo instance, which skips loading the scripts
  • Extracting the enableTracking function from the object returned by useMatomo and call it when they know that users have given consent for tracking.

A simplified usage example is included in the README file.


Before opening a pull request, please ensure:
  • [X] You've added or updated the README.md if needed
  • [X] Your code has the necessary tests written
  • [X] You have updated the CHANGELOG.md unreleased sections

Be kind to code reviewers, please try to keep pull requests as small and focused as possible :)

opsidao avatar Jan 19 '22 15:01 opsidao

No opinions here?

opsidao avatar Jan 31 '22 15:01 opsidao

anyone there

opsidao avatar Mar 10 '22 10:03 opsidao

Sorry for the lack of replies, I am currently swamped with a lot of other work so I do not have time to review these changes.

jonkoops avatar May 04 '22 10:05 jonkoops