Form snippet
The form snippet is one script tag for the client's website. It remembers the page a visitor first landed on and whether they came from search, then adds both to every form as hidden fields named landing_page and lead_source. The CRM stores them with the lead, and won deals sent back carry them.
What it doesn't do: The snippet sends nothing to RankUpside and sets no cookies. It only fills form fields; the CRM keeps the values and you send won deals back by CSV or webhook.
Updated
Install
Copy the tag from Client › Settings › Leads & revenue and add it to every page of the client's site, before </body> or in the site-wide header:
<script src="https://rankupside.com/t.js" defer></script>
It works on any site that accepts a script tag. Form builders that render normal <form> elements on the page get the fields automatically. Forms inside an iframe, as some embedded booking and form widgets are, don't: use that tool's own landing-page capture instead.
What it records
In the visitor's browser only (localStorage, key sr_attr, kept 90 days): the first landing page, as its address without the query string, and where the visit came from.
| Value | When |
|---|---|
paid | The address carries gclid, gbraid or wbraid, or utm_medium says cpc, ppc or paid. |
utm_source / utm_medium | Any other tagged link, such as gbp from a tagged Business Profile link. |
google maps | The visitor came from a maps.google address. |
organic | The visitor came from Google, Bing, DuckDuckGo, Yahoo search or Ecosia. |
referral: <host> | Another website linked to the page. |
direct | None of the above. |
Which visit wins
A direct visit never overwrites a stored one. Any other visit, from search, ads, a tagged link or a referral, replaces it. So a customer who found the client on Google and came back days later by typing the address keeps the search landing page.
How the fields get filled
When the page loads, and again when a form is submitted, every form gets hidden landing_page and lead_source inputs. If the form already has inputs with those names, they're filled only when empty.
<!-- Before --> <form action="/contact" method="post"> <input name="name"> <input name="phone"> <button>Get a quote</button> </form> <!-- After the snippet runs --> <form action="/contact" method="post"> <input name="name"> <input name="phone"> <button>Get a quote</button> <input type="hidden" name="landing_page" value="https://copperlinegutters.example/services/gutter-repair"> <input type="hidden" name="lead_source" value="organic"> </form>
For forms that post with JavaScript, read the same values from window.searchRevenue:
// For forms posted with JavaScript instead of a normal submit
const { landingPage, source } = window.searchRevenue;
await fetch("/api/quote", {
method: "POST",
body: JSON.stringify({ name, phone, landing_page: landingPage, lead_source: source }),
});Map the fields in the CRM
- Create two custom fields on the lead or contact, such as Landing page and Lead source.
- Map the form's hidden inputs to them in the CRM's form or integration settings. Menu names differ by CRM.
- Include both fields when won deals go back to RankUpside: in the CSV export or the webhook payload.
CRM recipes: GoHighLevel, HubSpot and website forms.
Business Profile leads
Tag the website link on the client's Google Business Profile with ?utm_source=gbp. Leads from the map pack are then recorded as such and kept out of search revenue, which keeps the map pack diagnosis honest. More in How revenue is allocated.
Something missing or out of date? Email hello@rankupside.com.
Questions.
Does the snippet slow down the site?
Does it collect personal data?
What if the form already has a landing_page field?
Do I need the snippet if the CRM already records the landing page?
Related
- DocsWebhooksThe revenue and leads webhooks: URLs, the bearer site key, JSON fields for deals, CallRail, WhatConverts and generic leads, batch limits and responses.
- DocsCSV formatUpload won deals from any CRM export. The required date, amount, landing page and status columns, accepted header names, and how re-uploads update deals.
- DocsHow revenue is allocatedThe exact rule: won deal to landing page, split across that page's searches by click share, hidden searches on their own line, and what's left out.
- IntegrationWebsite formsOne script tag adds landing_page and lead_source to every form on a client's site, so the CRM keeps them and won deals can be tied to searches.