-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Add more options for global URL parameter exclusions #22729
base: 5.x-dev
Are you sure you want to change the base?
Add more options for global URL parameter exclusions #22729
Conversation
012110b
to
f6b5ff4
Compare
f6b5ff4
to
3abdabe
Compare
0a0f2c0
to
8269536
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@caddoo As you've requested a review, I've decided to roughly look through the changes and already leave some comments/thoughts even though the PR might not yet be fully finished.
plugins/SitesManager/vue/src/ManageGlobalSettings/ExcludeQueryParameterSettings.vue
Outdated
Show resolved
Hide resolved
plugins/SitesManager/vue/src/ManageGlobalSettings/ManageGlobalSettings.vue
Outdated
Show resolved
Hide resolved
Co-authored-by: Marc Neudert <[email protected]>
Co-authored-by: Marc Neudert <[email protected]>
Co-authored-by: Marc Neudert <[email protected]>
…Settings.vue Co-authored-by: Marc Neudert <[email protected]>
3a0d40e
to
b80ece9
Compare
1e2954b
to
0998402
Compare
plugins/SitesManager/Controller.php
Outdated
@@ -73,6 +79,11 @@ public function getGlobalSettings() | |||
$globalSettings['excludedQueryParametersGlobal'] = API::getInstance()->getExcludedQueryParametersGlobal(); | |||
$globalSettings['excludedUserAgentsGlobal'] = API::getInstance()->getExcludedUserAgentsGlobal(); | |||
$globalSettings['excludedReferrersGlobal'] = API::getInstance()->getExcludedReferrersGlobal(); | |||
$globalSettings['exclusionTypeForQueryParams'] = API::getInstance()->getExclusionTypeForQueryParams(); | |||
|
|||
if ($globalSettings['exclusionTypeForQueryParams'] !== 'custom_exclusions') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ($globalSettings['exclusionTypeForQueryParams'] !== 'custom_exclusions') { | |
if ($globalSettings['exclusionTypeForQueryParams'] !== SitesManager::URL_PARAM_EXCLUSION_TYPE_NAME_CUSTOM_EXCLUSIONS) { |
We should prefer the constant if we have it.
Though I am wondering why we need that check here, and not also in another place where the query parameters are accessed:
matomo/plugins/SitesManager/SitesManager.php
Lines 335 to 342 in c5d3fad
public static function getTrackerExcludedQueryParameters($website) | |
{ | |
$excludedQueryParameters = $website['excluded_parameters']; | |
$globalExcludedQueryParameters = API::getInstance()->getExcludedQueryParametersGlobal(); | |
$excludedQueryParameters .= ',' . $globalExcludedQueryParameters; | |
return self::filterBlankFromCommaSepList($excludedQueryParameters); | |
} |
Is there any special case where these two areas should differ in a way that cannot be managed inside the API methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, the controller should be dumb, so I've removed that check. The API handles this already. Take a look and let me know if that's what you are thinking, and you can resolve the thread.
Co-authored-by: Marc Neudert <[email protected]>
Description:
This PR introduces configurable exclusion types for query parameters, offering users predefined options to tailor which parameters are excluded from tracking and reporting. Previously, users could only manually define a custom list of exclusions. Now, with this addition, we provide options that cater to broader needs, such as excluding common PII (Personally Identifiable Information) parameters, to make configuration easier and more accessible.
Key Changes and Decisions
Original Intention for Parameter Retention: Initially, I considered allowing excluded parameters to remain in place when switching between non-custom exclusion types. This would let users easily toggle exclusion types without needing to reconfigure the list. However, to maintain backend simplicity, I opted not to retain excluded parameters across types.
Backwards Compatibility: This update is designed to be backwards compatible. If a user already has custom exclusions configured, the system will infer the exclusion type as "custom," ensuring that existing setups continue to function seamlessly without manual adjustments.
New Vue Component – ExcludedQueryParameterSettings: I created a dedicated Vue component to handle the exclusion configuration, as the ManageGlobalSettings component had become quite large and was handling multiple responsibilities. This new component helps isolate exclusion-related logic, making the codebase easier to maintain and extend.
Duplication of Exclusions Type List: The list of exclusion type parameters appears in both the backend and frontend. I chose to keep them separate for better readability and maintainability, especially from a development perspective. Since the list of excluded parameters is unlikely to change frequently, this approach should not introduce significant maintenance overhead.
Tracker Cache Expiry: After setting the exclusion type, I've expired the tracker cache. I'm not sure if this is needed?
Review