feat: replace chb with consent groups and preserve runtime config (api#317, #17)
deploy-preland / deploy zoomstage.online (push) Successful in 42s
deploy-preland / deploy zoomstage.online (push) Successful in 42s
This commit is contained in:
1 parent
188b78a115
commit
89cc16eb4a
12 files changed
+208
-9
No files matched your search
@@ -4,6 +4,7 @@ require_once __DIR__ . '/i18n.php';
|
||||
require_once __DIR__ . '/components/asset-url.php';
|
||||
require_once __DIR__ . '/components/site-domain.php';
|
||||
require_once __DIR__ . '/components/theme-preference.php';
|
||||
require_once __DIR__ . '/components/cons-utm.php';
|
||||
|
||||
$configFile = __DIR__ . '/config.json';
|
||||
$config = file_exists($configFile) ? json_decode(file_get_contents($configFile), true) : [];
|
||||
@@ -13,6 +14,7 @@ if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
}
|
||||
|
||||
Yii::init($config['default_language'] ?? 'ru');
|
||||
$config = prelandNormalizeConsConfig($config);
|
||||
|
||||
function getWeightedRandom($weights)
|
||||
{
|
||||
@@ -40,10 +42,11 @@ function getWeightedRandom($weights)
|
||||
return (string)end($keys);
|
||||
}
|
||||
|
||||
$get_params = $_GET;
|
||||
$get_params = prelandNormalizeConsQuery($_GET, $config['utm']['cons']);
|
||||
|
||||
if (isset($config['utm']) && is_array($config['utm'])) {
|
||||
foreach ($get_params as $key => $value) {
|
||||
if ($key === 'cons') continue;
|
||||
if (!isset($config['utm'][$key])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user