Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce "real" hook to force set the visitor IP from a plugin #20054

Open
peterbo opened this issue Nov 25, 2022 · 2 comments
Open

Introduce "real" hook to force set the visitor IP from a plugin #20054

peterbo opened this issue Nov 25, 2022 · 2 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.

Comments

@peterbo
Copy link
Contributor

peterbo commented Nov 25, 2022

For quite some use cases, I'd like to be able to set the visitor's IP address, exactly like the "cip" parameter does. The current hook "Tracker.setVisitorIp" is mainly used for anonymizing the IP address in the PrivacyManager, which is set too late in the request workflow (afterRequestProcessed).

An potential use case is VAST tracking - the client IP address can be delivered by X-Forwarded-For, or X-Device-IP or X-Client-IP. In some cases, there will be IP addresses in all of those headers and you'll have to run this through plugin business logic to set the correct one.

Summary

Introduce a hook to set the client IP address early in the request workflow (just like the cip parameter). Perhaps, we can also rename the "Tracker.setVisitorIp" because the name implies, that this method is not only for saving a certain IP address, but also for setting the IP before it gets processed by e.g. fingerprinting, visitor recognition, geolocation, etc.

@peterbo peterbo added Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. To Triage An issue awaiting triage by a Matomo core team member labels Nov 25, 2022
@peterhashair peterhashair added this to the For Prioritization milestone Nov 27, 2022
@peterhashair peterhashair removed the To Triage An issue awaiting triage by a Matomo core team member label Nov 27, 2022
@sgiehl
Copy link
Member

sgiehl commented Nov 28, 2022

@peterbo Did you try using a RequestProcessor for that? I think the method manipulateRequest should be called before anything is done with the request parameters, so it could be used to maniuplate the cip parameter for example. (But setting it, might also require a correct token_auth set for the request)

@peterbo
Copy link
Contributor Author

peterbo commented Nov 29, 2022

Hey @sgiehl ! - Yes, I'm going to use that as a workaround, until there is a hook. Thanks for the hint!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

No branches or pull requests

3 participants