Код редирека на другой ленд и сохранение меток
Рандом между двумя
<script>
(function () {
const variant = Math.random() < 0.5 ? 'a' : 'b';
// Если выпал вариант B — редиректим и сохраняем UTM-метки
if (variant === 'b' && window.location.pathname === '/7retete_de_cina') {
const searchParams = window.location.search; // всё, что после ?
window.location.href = 'https://fitnessmama.md/7retete_de_cina_2025' + searchParams;
}
})();
</script>
<script>
(function () {
// Если utm_groupe уже есть — ничего не делаем
if (window.location.search.includes('utm_groupe=')) return;
const variant = Math.random() < 0.5 ? 'a' : 'b';
const currentPath = window.location.pathname;
if (currentPath === '/7retete_de_cina') {
const searchParams = window.location.search;
const separator = searchParams ? '&' : '?';
if (variant === 'b') {
window.location.href = 'https://fitnessmama.md/7retete_de_cina_2025' + searchParams + separator + 'utm_groupe=b';
} else {
window.location.href = window.location.origin + currentPath + searchParams + separator + 'utm_groupe=a';
}
}
})();
</script>
Всегда на один лэнд
<script>
(function () {
// Получаем все параметры из URL (всё после ?)
const params = window.location.search;
// Формируем финальный адрес с метками
const target = 'https://fitnessmama.school/waitlist_black_friday_25' + params;
// Выполняем редирект
window.location.href = target;
})();
</script>
(function () {
const current = window.location;
if (current.pathname === '/live12') {
const separator = current.search ? '&' : '?';
window.location.href = 'https://fitnessmama.school/webinar_bt' + current.search + separator + 'utm_group=test';
}
})();