How Redirect Works in Leeloo and How to Pass Traffic Source and UTM Tags
What is redirect in Leeloo?
Redirect in Leeloo allows you to send a subscriber to a specific Telegram bot via the correct LGT (mini-landing). You can also pass additional parameters in the URL: traffic source, custom fields, UTM tags, and other values.
This is useful for tracking traffic sources, assigning bonuses, audience segmentation, and message personalization.
Redirect link format
https://app.leeloo.ai/telegram/messenger-redirect/traffic_source?parameters
Explanation:
traffic_source — a unique identifier associated with a specific mini-landing (LGT), bot, and flow.
?parameters — any values you want to pass, for example:
bonus=100
,utm_source=facebook
.
How to get the traffic source for redirect?
Open the desired LGT (mini-landing) created in Leeloo.
Go to the Traffic tab.
Find the needed traffic source in the table.
Copy the link, for example:
https://leel.me/ss7t7u?traffic_mark=7fnutr
From this link, you only need the
traffic_mark
value, which is the part after=
:
7fnutr
Then the working link will look like:
https://app.leeloo.ai/telegram/messenger-redirect/7fnutr
What’s important to consider?
To save custom fields in the subscriber’s profile, they must first be created in Leeloo (in the “Settings” → “Fields” section).
All parameters passed after
?
in the link are automatically saved in the subscriber’s profile as values of corresponding custom fields, if those fields already exist.Use unique
traffic_mark
values for different traffic sources. This will ensure accurate subscriber tracking and analytics.Parameter names must not contain spaces, Cyrillic characters, or special symbols. Only use Latin letters, numbers, and underscores
_
.
How to pass UTM tags through your website to Leeloo.Ai ?
Create a redirect to Leeloo.Ai via a button on your website
Replace
traffic_mark
in the code
After you receive the traffic_mark
, open the code and replace the traffic_mark
part in the base link:
<script>
document.addEventListener("DOMContentLoaded", function() {
// Получаем все параметры из URL текущей страницы
var urlParams = new URLSearchParams(window.location.search);
var utmParams = urlParams.toString();
// Базовая ссылка на вашего Telegram-бота (замените на ваш traffic_mark)
var baseLink = "https://app.leeloo.ai/telegram/messenger-redirect/traffic_mark";
// Проверяем, есть ли UTM-метки
if (utmParams) {
// Добавляем параметры к ссылке
var finalLink = baseLink + "?" + utmParams;
} else {
// Если UTM-меток нет, используем базовую ссылку
var finalLink = baseLink;
}
// Находим все элементы с классом кнопки или ссылкой, указывающие на вашего бота
var telegramLinks = document.querySelectorAll('a[href*="ref"]');
// Обновляем каждую ссылку
telegramLinks.forEach(function(link) {
link.setAttribute("href", finalLink);
});
});
</script>
Replace traffic_mark
with the actual identifier of your traffic.
Replace in the field
href*="ref"
In the line:
var telegramLinks = document.querySelectorAll('a[href*="ref"]');
Replace "ref"
with the class of your button or link. For example, if you have a link with the class leeloo-redirect-btn
, update the line as follows:
var telegramLinks = document.querySelectorAll('a.leeloo-redirect-btn');
Insert the code into your website’s layout
Now that you’ve updated the code with the required traffic_mark
and button class, insert it into your website’s layout where the redirect should be used.
In this way, when a visitor clicks the link, UTM tags will be passed and used to track traffic and personalize messages in Leeloo.
How to send data from your website to Leeloo.Ai?
Set up a redirect to
http://leeloo.ai
when a button is clicked on your website.Create the necessary fields in your http://Leeloo.Ai dashboard.
In the instruction below, replace the redirect link on line 5 with your own:
const baseUrl = "https://app.leeloo.ai/telegram/messenger-redirect/lwizsr";
On line 6, specify the name of the variable corresponding to the field you previously created in http://Leeloo.Ai :
const finalUrl = `${baseUrl}?variable=${country}`;
<script>
function goToLink() {
const country = encodeURIComponent(document.getElementById('countryInput').value.trim());
if (country) {
const baseUrl = "https://app.leeloo.ai/telegram/messenger-redirect/lwizsr";
const finalUrl = `${baseUrl}?variable=${country}`;
window.location.href = finalUrl;
} else {
alert("Please enter a country.");
}
}
</script>