_referral object into memory with the source ad’s data.
With that information you can attribute the lead, route by campaign, personalize the first reply, or log the source in your CRM—without manually reconciling data between Meta Ads Manager and the conversational channel.
How it works
When a user clicks a Click to WhatsApp ad, WhatsApp opens with a starter message and Meta attaches the ad’s referral data to that first interaction. Jelou detects that data and automatically inserts it into the conversation’s memory under the_referral variable.
No Marketplace installation is required. The
_referral object is injected automatically whenever the conversation originates from a Click to WhatsApp ad.Detecting whether a chat comes from an ad
To know if a conversation arrived from a Meta ad, check whether the_referral variable exists in memory. When the conversation originates from an ad, Jelou inserts the following object:
_referral does not exist in memory, the conversation did not originate from a Click to WhatsApp ad (for example, a user messaging the number directly).
Learn more about how to read these variables in: Memory.
Field reference
Available fields depend on the ad. An image ad won’t include
video_url, and some fields may arrive empty depending on how the creative is configured.Using it in your flow
Inside any node you can access the ad data with the memory syntax{{$memory._referral.field}}. For example:
{{$memory._referral.source_type}}→ad{{$memory._referral.ctwa_clid}}→ click identifier for attribution{{$memory._referral.body}}→ the ad copy the user saw
1
Check whether the conversation comes from an ad
At the start of the flow, evaluate whether
_referral exists in memory. If it does, the conversation arrived from a Click to WhatsApp ad.2
Save the attribution for reuse
Keep
ctwa_clid and source_id in memory or send them to your CRM to attribute the lead to the source campaign.3
Personalize or route based on the ad
Use
body, source_url, or source_id to tailor the agent’s first reply, route to the right team, or trigger an internal notification.Related articles
Memory
How to read and persist variables across conversations and nodes.
Google Ads
Attribute WhatsApp conversations to your Google Ads campaigns.