Closed swergas closed 6 years ago
Hey @swergas, thanks for opening the issue and submitting the pull request!
Currently i see the following use cases:
the second case could be done by:
piwik-react-router
injectScript
or alreadyInitialized
should therefore test if a) the piwik.js script is present and b) inspecting the window._paq
object to test if it's a valid piwik instance or not.Of couse we have to deal with async initialization of piwik itself but by doing the test fully dynamically instead of setting boolean options my second use-case wouldn't depend on a pre-instantiated piwik instance and component tree which is initialized at first could set up piwik as well.
This are just some ideas i had when i saw your fork and the changes you made. what do you think?
closing this in favor of #46
Hi
Our web app assembl adds dynamically a piwik tracking script to the DOM of its pages, if an administrator has activated piwik tracking and has provided a piwik site id in the administration panel.
So, as we are progressively migrating our application to React, we would like to use piwik-react-router to track user navigation in React routes, but using an already initialized Piwik tracking script.
I think this solution is better than a solution where we would try to get our piwik configuration data from our application server and then use this data to initialize piwik-react-router.
And I see no other solution than these 2 for now.
Do you have any ideas about this type of use case? I will provide a pull request with the changes we made to skip piwik initialization.
Edit: I provided a PR here: https://github.com/joernroeder/piwik-react-router/pull/42