In short
A person clicks the WhatsApp button on a site, writes “Hello, how much is it?”, and a manager creates a deal. The CRM has the phone number and the text. It does not know which campaign brought the person: the chat opened in the app, and the app sends nothing to the site except the message itself.
A form on the site has a hidden field for this. A messenger has no hidden field. So KO passes the source in the only place the messenger does not change: the text.
A visit ID in the first message
WhatsApp button on the site
The tracking script adds a first-message template with the visit ID to the link
“Hello! I would like to know the price. ko48213”
- Template. The project has a first-message text with a place for the visit ID. The tracking script adds this text to the WhatsApp and Telegram links on the site. The person clicks the button, and the chat opens with the message already typed.
- Which buttons. WhatsApp links in all common forms
(
wa.me,api.whatsapp.com, the web version, the app link and the Android button) and Telegram links (t.me,tg:). You can give the template to all buttons or only to some. If a link already had its own text, the template can keep it. - Deal field. A bot or a chat integration in the CRM writes the first message into a deal field. You set this up in the CRM. KO reads the field, finds the ID and links the lead to the visit.
- Field history. If the bot writes every new message into the field, the first one with the ID is already replaced. In that case KO reads the field history from the first value and takes the first ID it finds.
In analytics this number has other names too: visit ID, session ID, tracking code. It works much like a promo code: a short string in the text that later shows where the person came from. The difference is that the tracking script adds it, not the person, and each visit has its own. It is not a visitor ID: it belongs to one visit to the site and to the campaign that brought it.
People often edit the typed text: they add a question or change the greeting. This is fine. KO looks for the visit ID in the whole message and checks that a visit with this ID exists in the same project.
The visit ID gets into the message only when the person writes through the button on the site. Only the ID links the chat to a visit: KO does not compare the phone number from the chat with visits.
When there is no visit ID
The person can delete the ID from the typed text. Or the template has no place for the ID. In that case KO looks for a visit that was shown a template with the same text shortly before the message, and takes the nearest one in time. If the person changed the text, this match does not work.
This is a backup, and with one template for the whole site it is a weak one. If several visitors were on the site in those minutes, the lead can get the source of another visit. In a report, this link looks the same as a link by visit ID.
The match is more exact when there are many templates. You can have dozens or hundreds of them, one for each button and channel: a rule picks the template by the link text, the page, UTM tags, the device or the visitor’s country. The fewer visits saw the same text, the less often another visit is close in time.
Even then, the ID in the template is the base, and the text match is only a backup: a person who changed the text drops out of it.
Where a link is not possible
The visit ID arrived
A click on the site button, the ID is in the first message
KO finds the visit, and the lead gets its campaign and tags
Source foundNo visit ID in the message
The person deleted the ID, or the template had none
KO looks for a visit with the same template shortly before the message and takes the nearest one
A guessNot through the button
The phone number was copied, found in contacts, or the chat was opened by a widget
There was no template, so nothing links the message to a visit
No sourceNo to analytics
The visitor said no in the cookie banner
The tracking script adds no visit ID, the button opens the chat as usual
No source- Not through the button. The person copied the phone number from the page, found it in their contacts, or wrote later from the app. There was no template, so nothing links the message to a visit.
- A widget opens the chat, not a link. If a widget script opens the chat window, the tracking script has no link to add the template to.
- The visitor said no to analytics. The tracking script adds no visit ID, and the button opens the chat as usual. What else a no turns off is in Cookies and consent.
- Viber and Skype. The tracking script records a click on such a button as an event in the visit, but adds no visit ID to the message. A lead from there has no source.
A messenger lead without a visit ID arrives without a campaign. The “No visitor” card in the “Leads” journal does not count messenger messages: writing outside the site is a normal path, not a fault. How KO sorts leads without a visit is in How a lead finds its visit.
The visit ID has no name and no phone number in it. This is a product decision, not a legal assessment. The site owner decides what to tell visitors about the ID in the message and in the site policy.
In practice
- A messenger passes only text, so the source travels in the text: a visit ID in the first message of a WhatsApp or Telegram button.
- The first message must reach a deal field in the CRM. KO takes the ID from there and finds the visit.
- Without a visit ID, only a text and time match is left. It is a guess, and in a report it looks like an exact link. It is more exact when each button and channel has its own template.
- A copied phone number, a widget without a link, a no to analytics, Viber and Skype: no source.
- Leads from forms work differently, see Leads from forms.
Updated