Skip to content
Docs

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.

The lead_source values the snippet writes
ValueWhen
paidThe address carries gclid, gbraid or wbraid, or utm_medium says cpc, ppc or paid.
utm_source / utm_mediumAny other tagged link, such as gbp from a tagged Business Profile link.
google mapsThe visitor came from a maps.google address.
organicThe visitor came from Google, Bing, DuckDuckGo, Yahoo search or Ecosia.
referral: <host>Another website linked to the page.
directNone 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>
Sample data: a fictional business on a reserved .example domain.

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

  1. Create two custom fields on the lead or contact, such as Landing page and Lead source.
  2. Map the form's hidden inputs to them in the CRM's form or integration settings. Menu names differ by CRM.
  3. 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?
It's a small script loaded with defer, so it runs after the page is parsed. It makes no network requests of its own.
Does it collect personal data?
No. It stores only the landing page address and a source label in the visitor's browser. It reads no form contents and sends nothing to RankUpside.
What if the form already has a landing_page field?
The snippet fills it only when it's empty, so values your own setup writes are kept.
Do I need the snippet if the CRM already records the landing page?
No. Any deal that arrives with a landing page works. The snippet is for sites whose forms don't capture it.