Comments (6)
Come across the same problem, as @joernroeder said, I just pass a modifier to .connectToHistory
:
const modifier = function (location) {
const loc = window.location;
location.path = `${loc.origin}${loc.pathname}${loc.hash}`;
return location;
};
from piwik-react-router.
have you seen and applied the post in the piwik faq? https://piwik.org/faq/how-to/faq_188/
from piwik-react-router.
Yes, but this is not my case because url sended to piwik not contain hash.
After analyze code and testing when i add remove initial slash
currentPath = currentPath.replace(/^\//, '');
before line https://github.com/joernroeder/piwik-react-router/blob/master/index.js#L58
url send to piwik is correct (contain context and hash)
from piwik-react-router.
if i understand you right, your main problem is the loos of the context
path. is that correct?
You could add the basename
(in your case context
) to the history object to prefix the app path.
If all the URLs in your app are relative to some other "base" URL, use the basename option. This option transparently adds the given string to the front of all URLs you use.
https://github.com/ReactTraining/history#using-a-base-url
Alternatively you could proxy the history.listen
callback and pass down your modified path via loc.path
to set the currentPath
via https://github.com/joernroeder/piwik-react-router/blob/master/index.js#L51
hope that helps!
cheers jรถrn
from piwik-react-router.
@regdos after thinking about the proxy/modifier today i found other use cases to modify the location (e.g. to add campain parameters or state from outside react). I've ended up adding the functionality of History Modifiers directly into .connectToHistory
. Please head over to the docs to see if it works well for you. I am excited about your feedback.
from piwik-react-router.
@regdos could you resolve the issue? I'm closing this issue for now as the possibility to manipulate the current location before it gets passed to the tracker exists in the module since this version (v0.9.0
).
Thanks for opening this issue as it leaded to a new useful feature of this module and feel free to reopen it if you need any help. cheers
from piwik-react-router.
Related Issues (20)
- should it be addeded to server side code? HOT 1
- Can't find variable: document HOT 4
- React-Native Support
- add optional proxy function argument to .connectToHistory
- Feature request: Being able to skip initialization of Piwik HOT 2
- Feature request: Allow setting of custom error tracking handler HOT 1
- Page title updating past track event? HOT 3
- TypeError: Cannot read property 'parentNode' of undefined HOT 10
- Dynamic piwik URL HOT 1
- `PiwikTracker.track` sends URLs with appended slash HOT 1
- Rename this package to matomo-react-router HOT 1
- CSP (Content Security Policy) HOT 1
- React Router v4 Support HOT 6
- react-router-dom HOT 4
- Does it support matomo? HOT 2
- getBaseUrl should take port into account
- You cannot change <Router history>
- connectToHistory typescript definition does not accept same arguments as the function.
- tracking not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from piwik-react-router.