Add enableTracking function and allow lazy loading
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
disabledwhen creating the Matomo instance, which skips loading the scripts - Extracting the
enableTrackingfunction from the object returned byuseMatomoand 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 :)
No opinions here?

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.