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

List of user agents to exclude could support regular expressions #14186

Closed
mattab opened this issue Mar 12, 2019 · 3 comments · Fixed by #16766
Closed

List of user agents to exclude could support regular expressions #14186

mattab opened this issue Mar 12, 2019 · 3 comments · Fixed by #16766
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.

Comments

@mattab
Copy link
Member

mattab commented Mar 12, 2019

Currently it is not clear whether we support regular expressions for the setting "List of user agents to exclude".
In the list of IP addresses it says Regular expressions such as /^sess.*|.*[dD]ate$/ are suported.

Suggested:

  • Check regular expression works when excluding user agents
  • add Regular expressions such as /^Good-example-of-regex-here$/ are supported.
  • rename suported to supported in the existing message (typo)
@mattab mattab added Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change. c: Usability For issues that let users achieve a defined goal more effectively or efficiently. labels Mar 12, 2019
@mattab mattab modified the milestone: 3.11.0 Mar 12, 2019
@tsteur tsteur added the Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement. label Mar 12, 2019
@sgiehl
Copy link
Member

sgiehl commented Mar 13, 2019

Note: Regular expressions are currently not supported for useragents. See

protected function isUserAgentExcluded()
{
$excludedAgents = $this->getAttributes('excluded_user_agents', 'global_excluded_user_agents');
if (!empty($excludedAgents)) {
foreach ($excludedAgents as $excludedUserAgent) {
// if the excluded user agent string part is in this visit's user agent, this visit should be excluded
if (stripos($this->userAgent, $excludedUserAgent) !== false) {
return true;
}
}
}
return false;
}

@simoncrowe
Copy link

Thanks for your reply @sgiehl.

Is there any plan to add regular expression matching for "list of user agents to exclude" in the future, or should I assume that we (Ubiquity Press) will need to implement this feature ourselves?

@sgiehl
Copy link
Member

sgiehl commented Mar 20, 2019

@simoncrowe the issue is currently not planned within the next releases. If you would contribute the changes needed for that in a PR we would be happy to review and merge that.
Alternatively if you would like to sponsor the development of that feature, feel free to get in touch with us: https://matomo.org/faq/new-to-piwik/faq_21953/

@mattab mattab added this to the Backlog (Help wanted) milestone Jan 21, 2020
@mattab mattab changed the title Does "list of user agents to exclude" allow for regular expressions? List of user agents to exclude could support regular expressions Jan 21, 2020
@mattab mattab added Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. and removed Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change. c: Usability For issues that let users achieve a defined goal more effectively or efficiently. labels Jan 21, 2020
diosmosis pushed a commit that referenced this issue Jan 1, 2021
)

* Add regular expression support to list of user agents to exclude

- Added regex support to Administration -> Websites -> Settings ->
Global list of user agents to exclude
- Made sure old tests that use stripos() pass
- Added new tests
- Added a sentence to the inline help area about regex support
- Fixed a typo elsewhere as specified in the original issue.

Closes #14186.

Updated method and tests following code review

Update plugins/WebsiteMeasurable/MeasurableSettings.php

Co-authored-by: Stefan Giehl <stefan@matomo.org>

Update system tests

* Update screenshots for UI tests affected by the copy changes
@mattab mattab added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Jan 15, 2021
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. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants