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

Added a config for custom_dimensions_max_length issue-16150 #22582

Open
wants to merge 23 commits into
base: 5.x-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
1bb7b3e
Added a config for custom_dimensions_max_length and refactor plugins/…
jorgeuos Sep 12, 2024
881f62b
Update all submodules (#22560)
innocraft-automation Sep 9, 2024
f292c43
Translations update from Hosted Weblate (#22547)
weblate Sep 12, 2024
c5906fd
Ensure grouping a dimension in ms doesn't fail if ranking query limit…
sgiehl Sep 12, 2024
21859ce
Fix archiving for range periods (#22577)
sgiehl Sep 12, 2024
3a33c46
Update all submodules (#22585)
innocraft-automation Sep 13, 2024
317a19f
Add information about risks associated with giving super user access …
michalkleiner Sep 13, 2024
1371d77
Add configuration for database connection collation (#22564)
mneudert Sep 13, 2024
a8438b3
updates expected test files (#22590)
sgiehl Sep 13, 2024
9168d52
Translations update from Hosted Weblate (#22586)
weblate Sep 13, 2024
16a1e83
Ensure LatestStable release channel uses the version provided from AP…
sgiehl Sep 20, 2024
cbc77ae
Use sha256 instead of md5 for file integrity checks (#22602)
sgiehl Sep 20, 2024
12b1b72
Updates DOMPurify to 2.5.6 (#22610)
sgiehl Sep 23, 2024
3b4bd58
Require Write access for adding annotations in UI (#22604)
sgiehl Sep 23, 2024
6a346df
Resolve merge conflicts for weblate (#22611)
sgiehl Sep 23, 2024
079a7eb
Limit date ranges that end far in the future (#22592)
sgiehl Sep 24, 2024
2beb59d
Improve database collation detection (#22594)
mneudert Sep 25, 2024
cdd7936
Translations update from Hosted Weblate (#22612)
weblate Sep 26, 2024
1de2022
Show install button only when download link present and show informat…
AltamashShaikh Sep 26, 2024
e6b1ec8
[automatic submodule updates] (#22606)
innocraft-automation Sep 26, 2024
ff20526
Handle ignoring of duplicates the same when not using INSERT SELECT (…
sgiehl Sep 27, 2024
1053b6a
Merge branch '5.x-dev' into jorge-issue-16150
jorgeuos Oct 1, 2024
5731d02
Update plugins/CustomDimensions/Tracker/CustomDimensionsRequestProces…
jorgeuos Nov 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions config/global.ini.php
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,12 @@
; If you define Custom Variables for your visitor, for example set the visit type
;Segments[]="customVariableName1==VisitType;customVariableValue1==Customer"

[CustomDimensions]
; The maximum length for custom dimension values stored in the database.
; If this value is -1, no truncation will be applied.
; If the value is too high, it will be capped to 65535.
custom_dimensions_max_length = 250

[Deletelogs]
; delete_logs_enable - enable (1) or disable (0) delete log feature. Make sure that all archives for the given period have been processed (setup a cronjob!),
; otherwise you may lose tracking data.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,17 @@ private function getCustomDimensionsInScope($scope, Request $request)

private static function prepareValue($value)
{
return mb_substr(trim($value), 0, 250);
$inputMaxLength = 250;
// Get the maximum length from the config, defaulting to 250 if not set
$maxLengthConfig = intval(\Piwik\Config::getInstance()->CustomDimensions['custom_dimensions_max_length'] ?? $inputMaxLength);

// Ensure max length is a reasonable number: -1 means no limit, cap at 65535 for TEXT fields
if ($maxLengthConfig === -1) {
$inputMaxLength = 65535; // No limit, but cap it for safety
} else {
$inputMaxLength = min($maxLengthConfig, 65535);
}
return mb_substr(trim($value), 0, $inputMaxLength);
}

public static function buildCustomDimensionTrackingApiName($idDimensionOrDimension)
Expand Down