2021-05-16 10:30:04 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2022-01-20 22:16:37 +03:00
|
|
|
use Shlinkio\Shlink\Core\Config\EnvVars;
|
2021-08-07 12:05:20 +03:00
|
|
|
|
2022-09-17 12:27:56 +03:00
|
|
|
return (static function (): array {
|
|
|
|
/** @var string|null $disableTrackingFrom */
|
|
|
|
$disableTrackingFrom = EnvVars::DISABLE_TRACKING_FROM->loadFromEnv();
|
2021-05-16 10:30:04 +03:00
|
|
|
|
2022-09-17 12:27:56 +03:00
|
|
|
return [
|
2021-05-16 10:30:04 +03:00
|
|
|
|
2022-09-17 12:27:56 +03:00
|
|
|
'tracking' => [
|
|
|
|
// Tells if IP addresses should be anonymized before persisting, to fulfil data protection regulations
|
|
|
|
// This applies only if IP address tracking is enabled
|
|
|
|
'anonymize_remote_addr' => (bool) EnvVars::ANONYMIZE_REMOTE_ADDR->loadFromEnv(true),
|
2021-05-16 10:30:04 +03:00
|
|
|
|
2022-09-17 12:27:56 +03:00
|
|
|
// Tells if visits to not-found URLs should be tracked. The disable_tracking option takes precedence
|
|
|
|
'track_orphan_visits' => (bool) EnvVars::TRACK_ORPHAN_VISITS->loadFromEnv(true),
|
2021-05-16 10:30:04 +03:00
|
|
|
|
2022-09-17 12:27:56 +03:00
|
|
|
// A query param that, if provided, will disable tracking of one particular visit. Always takes precedence
|
|
|
|
'disable_track_param' => EnvVars::DISABLE_TRACK_PARAM->loadFromEnv(),
|
2021-05-16 10:30:04 +03:00
|
|
|
|
2022-09-17 12:27:56 +03:00
|
|
|
// If true, visits will not be tracked at all
|
|
|
|
'disable_tracking' => (bool) EnvVars::DISABLE_TRACKING->loadFromEnv(false),
|
2021-05-16 10:30:04 +03:00
|
|
|
|
2022-09-17 12:27:56 +03:00
|
|
|
// If true, visits will be tracked, but neither the IP address, nor the location will be resolved
|
|
|
|
'disable_ip_tracking' => (bool) EnvVars::DISABLE_IP_TRACKING->loadFromEnv(false),
|
2021-05-16 10:30:04 +03:00
|
|
|
|
2022-09-17 12:27:56 +03:00
|
|
|
// If true, the referrer will not be tracked
|
|
|
|
'disable_referrer_tracking' => (bool) EnvVars::DISABLE_REFERRER_TRACKING->loadFromEnv(false),
|
2021-10-10 23:00:22 +03:00
|
|
|
|
2022-09-17 12:27:56 +03:00
|
|
|
// If true, the user agent will not be tracked
|
|
|
|
'disable_ua_tracking' => (bool) EnvVars::DISABLE_UA_TRACKING->loadFromEnv(false),
|
2021-05-16 10:30:04 +03:00
|
|
|
|
2022-09-17 12:27:56 +03:00
|
|
|
// A list of IP addresses, patterns or CIDR blocks from which tracking is disabled by default
|
2022-09-17 13:57:04 +03:00
|
|
|
'disable_tracking_from' => $disableTrackingFrom === null
|
|
|
|
? []
|
|
|
|
: array_map(trim(...), explode(',', $disableTrackingFrom)),
|
2022-09-17 12:27:56 +03:00
|
|
|
],
|
|
|
|
|
|
|
|
];
|
|
|
|
})();
|