Files
pricebuddy/config/url_matching.php
Jeremy 2cac0b54a1 fix: address review findings on URL matching
- config/url_matching.php: trim each exploded env value before filtering
  empties, so "foo, bar" yields normalised names without whitespace
- ClientConfigApiTest: authenticate the minimal-token test with only
  client-config:read, proving the endpoint is not gated on other abilities
- UrlNormalizeForMatchTest: snapshot and restore the env vars instead of
  unconditionally unsetting them, and pin the trimming behaviour
- api.md: tag the URL example fence as text
- drop two unused fixture assignments
2026-08-07 23:08:27 +10:00

42 lines
1.7 KiB
PHP

<?php
return [
/*
|--------------------------------------------------------------------------
| Tracking query parameters
|--------------------------------------------------------------------------
|
| Query parameters dropped when building the normalised match key for a URL.
| Values here are matched against the full parameter name.
|
| Set URL_MATCHING_TRACKING_PARAMS_EXTRA to a comma separated list to APPEND
| to these defaults. After changing it, run `php artisan urls:renormalize`
| to rebuild the stored match keys, otherwise existing rows keep the old
| key and matching silently misses.
|
*/
'tracking_params' => array_merge([
'_gl', 'aff', 'affid', 'algo_pvid', 'dclid', 'epik', 'fbclid', 'gbraid',
'gclid', 'igshid', 'irclickid', 'keywords', 'mc_cid', 'mc_eid', 'msclkid',
'psc', 'qid', 'ref', 'spm', 'sr', 'srsltid', 'tag', 'th', 'ttclid',
'twclid', 'wbraid', 'yclid',
], array_filter(array_map('trim', explode(',', (string) env('URL_MATCHING_TRACKING_PARAMS_EXTRA', ''))), fn (string $value): bool => $value !== '')),
/*
|--------------------------------------------------------------------------
| Tracking query parameter prefixes
|--------------------------------------------------------------------------
|
| Any parameter whose name starts with one of these is dropped. Appended to
| with URL_MATCHING_TRACKING_PARAM_PREFIXES_EXTRA.
|
*/
'tracking_param_prefixes' => array_merge([
'_bta', 'aff_', 'affiliate', 'pd_rd_', 'ref_', 'utm_',
], array_filter(array_map('trim', explode(',', (string) env('URL_MATCHING_TRACKING_PARAM_PREFIXES_EXTRA', ''))), fn (string $value): bool => $value !== '')),
];