Capture current and remembered query parameters
You can save a referral or campaign value from a visitor's URL, even if they leave the landing page before they submit your form.
Save the referral or campaign value that brought someone to your website, then use it in your flow or send it with a form. RightMessage can read the current page's URL or remember a value from an earlier page in the same browser.
You'll need the snippet installed on the pages you're using and access to edit your flow or form. To send the value to your email platform, connect a supported integration and choose a destination field that accepts it. Capturing a query value doesn't identify the visitor.
Choose which value to save
Use {{ query.ref }} to read the current ref parameter, or its most recent remembered value if the current page doesn't have one. Use {{ query.current.ref }} if you only want the current page's value.
For example, someone could land on WorkForge (opens in a new tab) at https://workforge.rightmessage.com/?ref=workforge-guide, then visit /contact.html. On the contact page, the current-only expression has no referral value. The remembered expression can still return workforge-guide.
The remembered value is the most recent occurrence, not the first visit's value or the most recent nonblank value. A URL ending in ?ref= replaces an older referral with an empty string. 0 also counts as a present value.
The Flow data and Liquid reference explains the newest-to-oldest history lookup, the first-page fallback, and why current is a reserved name. The global data picker offers the current-page expression. Type the remembered expression directly, and keep the parameter name consistent across your links and expressions.
Save it for later steps in your flow
A variable makes the value available before someone submits a form. It also lets you choose how long to keep it, rather than relying on the browser's page history.
- On the flow canvas, choose + on a path before the final form or offer, then Set Data. On an empty canvas, use Add the first step instead.
- Set Action Type to Add / Update Variable.
- Enter
referral_sourcein Variable Name:. - Enter
{{ query.ref }}in Variable Value:. - Under Expires:, choose In..., then enter
7and choose Days. - Choose Done.
This saves the remembered referral for seven days. Each later assignment restarts that duration. Expires: defaults to Never if you don't change it. You can also choose a positive duration in Minutes, Hours, or Weeks.
A blank value removes the variable. If you use the current-only expression and want to keep an existing variable when the parameter is missing, put a condition before the assignment. Let it run only when the parameter is present.
Browser history isn't a permanent attribution record. Clearing browser data can remove the remembered referral, and another browser won't have the same history.
If you want the flow to update your email platform at this step, choose Set Custom Field instead and enter the expression in Value:. This is a separate action. A variable doesn't sync itself to your provider. Check that RightMessage can identify the visitor and that the destination record receives the update.
Send it with a form instead
Use a hidden field when you want to send the value at submission, rather than use it in earlier flow steps. The visitor won't need to type anything.
- Open the form's Fields tab.
- Choose Add field.
- Under Layout & advanced, choose Hidden field.
- Select the destination custom field.
- Enter
{{ query.ref }}as the value, or{{ query.current.ref }}for the current page only.
The screenshot shows a fixed value. Replace it with your expression to capture each visitor's referral. The hidden field sends that literal or rendered value with the form. Select the destination yourself. The query parameter's name doesn't create a provider field, and the hidden field doesn't identify the visitor.
Check it across page visits
Choose Preview on your site and test on your own pages with the snippet installed. In the same browser:
- Open your landing page with
?ref=guideadded to its URL. - Visit another page without a query string.
- Check that the current-only expression has no value and the remembered expression reads
guide. - Return to the landing page with
?ref=workshop. The remembered value should now beworkshop. - Visit the page with
?ref=and check that your blank-value handling does what you intended.
Repeat the missing-value check with fresh browser data. If you're sending the referral through a form, submit a test and inspect the destination contact record.
When the right value reaches your variable or contact field, review and publish the draft. Next, see how to use variables in later steps.