ResourcesCapturing the converting page
Guide
for
Webflow
HubSpot
Slack

Capture the converting page from HubSpot forms and show it in Slack

A specific build for a Webflow site, HubSpot CRM, and a Slack lead alert. When a demo request lands in Slack, it should show the page the prospect was on right before they converted. Here's how to capture the referrer on Webflow, write it to HubSpot, and surface it in your alert, plus the publishing and caching traps that make it look broken when it isn't.

By Sam Holding·June 2026·12 min read

When someone books a demo, your Slack alert tells you who they are. It almost never tells you what they were looking at the moment before they clicked through. In a finite market, where you're selling to a defined set of named accounts over a long cycle, that one missing field is worth more than it looks.

This is a walkthrough of how to capture the converting page on a Webflow site, write it to a HubSpot contact record, and surface it in the Slack alert your team actually reads. It's a no-developer build. The implementation is short. The part that will eat your afternoon is a publishing-and-caching problem that makes a correctly built change look broken, so that gets its own section at the end.

The fastest way to use this guide

Copy the entire contents of this page and paste it into your AI assistant (Claude, ChatGPT, or whatever you use), then ask it to walk you through the setup step by step for your own account. It can generate the exact, current code for your HubSpot form, adapt the steps to your Webflow and Slack setup, and help you debug if something doesn't work. This guide is written to be handed off that way.

Why this is worth doing

The instinct is to assume HubSpot already captures this. It doesn't, not the way you want.

HubSpot ships several traffic-source fields out of the box, and all of them answer a different question than the one you're asking:

Original Source tells you the channel (Organic Search, Direct, Paid). It's a bucket, not a page.

First Page Seen is the entry page of the visitor's first-ever session, which could have been weeks ago, from a completely different intent.

Last Page Seen is usually the page after submission: the thank-you page. It becomes the most recent page viewed, so it actively misleads you.

The one value that reliably represents "the page they were on right before they converted" is the browser referrer (document.referrer) at the moment the form is submitted. Nothing stores it by default. You have to capture it deliberately.

Here's why that's disproportionately valuable when your market is finite:

Intent by product line

The converting page tells the rep what the prospect actually came in for, so they open with the right pitch instead of guessing.

Routing in seconds

With the triggering page in the alert, whoever picks up the lead can route or self-assign correctly without opening the CRM.

Attribution finance will believe

A clean, first-party data set tying specific pages to specific opportunities, with no black box and no third-party pixel you don't control.

First-party and durable

As third-party tracking degrades, a referrer you capture yourself at submission time is a robust, privacy-respectful signal you fully own.

One form, not many. The obvious alternative, a separate demo form per page or product line, means a separate form to build, workflow to wire, and thing to keep in sync. Capturing the referrer collapses all of that: you run one form everywhere, and the captured page tells you which one converted them. Fewer moving parts, one source of truth, and nothing to forget to update.

The broader point: small, owned data-capture improvements at the point of conversion compound. They cost almost nothing and they make every downstream system (CRM, Slack, reporting, rep behavior) smarter.

The stack, and why each piece is there

Four layers, and the bug at the end lives entirely in the seams between them, so it's worth knowing what each one does.

Webflow hosts the site and the /book-a-demo page. The HubSpot form is embedded via a Code Embed element. Webflow's concept of staging vs production domains, and the fact that publishing is per-domain, is where the central bug hides.

HubSpot provides the embeddable form, stores the submission as a contact, holds the custom property, and runs the workflow that posts to Slack. The form renders inside an iframe, which changes how you write the JavaScript.

Slack receives the alert. It only shows the fields the workflow is explicitly told to include. A value can sit perfectly on the contact record and still never appear in Slack.

A CDN (often invisible) may sit in front of your live domain, caching the HTML and serving it from edge locations, whether Cloudflare, Fastly, CloudFront, or whatever your host put there, and there may be more than one layered up. This is the layer that can make a correctly published change fail to appear for hours, and it's frequently outside the marketer's control or even awareness.

The build

A no-developer build in six steps. Verify each link before moving to the next.

1

Create the custom property in HubSpot

Under contact properties, create a new property:

LabelPage before demo
Internal namepage_before_demo
Field typeSingle-line text

Use text, not URL, on purpose. A text field lets you store a human-readable fallback like Direct / no referrer when there's no referrer. A strict URL field would reject that. Slack auto-links anything that looks like a URL anyway, so you lose nothing.

Gotcha: the property has a per-property visibility rule for whether it can appear in forms. Until you enable it, the property won't show up in the form editor's field list, which is confusing, because the property clearly exists.

2

Add it as a hidden field on the form

Edit the demo form in HubSpot and add Page before demo as a hidden field, not required. Publish the form. It now renders an input named page_before_demo that the visitor never sees and that starts empty.

3

Write the JavaScript that fills the field

Two things make this trickier than a one-liner:

01

The HubSpot v2 form renders inside an iframe. The field isn't in the main page's DOM, so a plain document.querySelector('input[name="page_before_demo"]') from the page finds nothing. You have to use HubSpot's own onFormReady callback, which hands you a reference to the form.

02

document.referrer is only populated when the visitor navigated to the page from another page. Click an internal link → the referrer is that previous page. Type the URL, use a bookmark, or arrive under certain privacy settings → it's empty. That's why the fallback string matters.

In the Code Embed element on your demo page, you'll initialize the HubSpot form and hook into its ready callback. Rather than reproduce a snippet that will drift as HubSpot updates its forms API, here's what the script needs to do, in plain terms:

  • Target the exact form. Identify it by your HubSpot account details and the specific form's ID, so you don't disturb any second, unrelated form on the same page.
  • Wait for the form to be ready. Use HubSpot's ready callback (currently onFormReady) rather than querying the page yourself. That callback is what solves the iframe problem.
  • Read the referrer with a fallback. Take document.referrer, and if it's empty, substitute a human-readable string like Direct / no referrer so the field is never blank.
  • Write it into the hidden field. Set the value of the page_before_demo input on the ready form. Fail safe: if the API has changed, do nothing rather than break the form's submission.

Let your AI write the actual code. Paste this page into your AI assistant, give it your HubSpot region, portal ID, and form ID, and ask it to produce the current embed snippet for the four behaviors above. That way the code always matches HubSpot's latest forms API instead of a snippet frozen in this article.

4

Publish in Webflow, carefully

Paste the embed, Save, and Publish. The Publish dialog lists a staging domain (something like yoursite-staging.webflow.io) and one or more production domains.

Publish to every production domain, not just staging, and not just the obvious one. This sounds trivial. It is the single biggest trap in the whole build, and it gets its own section below. Read it before you conclude the code is broken.

5

Verify the value lands on the contact, before Slack

Submit a real test through the live form, having reached the demo page by clicking an internal link from another page on your site (so the browser actually records a referrer). Use an obviously fake identity so the team recognizes it as a test and can delete it.

Open the resulting contact in HubSpot and confirm Page before demo holds the URL of the page you clicked from. Only once that's confirmed should you wire up Slack. If the value isn't landing, the Slack work is wasted.

6

Add the property to the Slack notification steps

Open the workflow that sends the alert. For each "Send Slack notification" step, open it, find the "Properties to include with the action" picker, add Page before demo, and save.

Add it to every step. Workflows that branch (by region, by student vs non-student, by segment) have a separate Slack step per branch. A given lead only flows down one branch, so if you add the property to five of six steps, leads in the sixth branch silently lack the page in their alert.

Then run one final end-to-end test and eyeball the actual Slack message. Don't assume every step was edited correctly; look at the alert.

When it looks broken but isn't: the debugging chain

This is the part worth keeping. The feature spans four systems, and a failure in any one of them looks identical from the outside: "the page isn't showing in Slack." The only method that works is to verify the chain one link at a time, from the inside out. Here are the traps in the order you're likely to hit them.

The iframe trap

A naive document.querySelector finds nothing because the form is in an iframe. Fix: use onFormReady. General rule: when a form is delivered by a third-party script, assume it may be in an iframe and use the vendor's ready callback rather than reaching into the page yourself.

Empty referrer because you tested "wrong"

The captured value is blank or shows the fallback even though the code is right. Cause: you reached the demo page by typing the URL, using a bookmark, or letting a tool open it directly. No referrer is sent. Fix: always test by clicking an internal link. Treat an empty referrer as expected, not alarming.

The property won't appear in the form editor

You created it but can't add it to the form. Cause: its "show in forms" visibility rule isn't enabled. Fix: enable it on the property.

Staging works, production doesn't: the big one

After publishing, the new code is on the Webflow staging URL (.webflow.io) but completely absent from the live URL. The live page source shows only the plain hbspt.forms.create call with none of your onFormReady code.

The tempting theory is "it's just the CDN cache being stale." Here's the diagnostic that actually cracks it: request the live URL with a junk query string appended, like /book-a-demo?test=1. A never-seen query string forces a CDN to treat it as a new object and fetch a fresh copy from the origin. Check the response headers to confirm: look at age (a low value means freshly fetched) and your CDN's cache-status header, which varies by provider (cf-cache-status on Cloudflare, x-cache on CloudFront and Fastly, sometimes x-vercel-cache).

If that guaranteed-fresh copy still lacks your code, the problem is not the cache. The change never reached the origin. A cache purge would not have fixed it. The real cause: published to staging, not to production.

Publishing to the "obvious" domain isn't enough: the subtle one

This is the deepest lesson. Even after deliberately publishing to the main, human-facing domain, the live site may not update. Inspecting the Publish dialog can reveal a setup like this:

  • Staging domain: published just now (has the code).
  • Primary vanity domain (yoursite.com): published just now, but showing an "SSL certificate missing" warning.
  • Two other production domains (Webflow-style hostnames like webflow.yoursite.com): unchecked, and last published nine hours ago.

The nine-hour figure is the clue. If the stale copy real visitors get has a cache age of ~8 to 9 hours, and that matches the last publish time of the unchecked hostnames almost exactly, your CDN is pulling its content from one of those hostnames (the true origin), not from the vanity domain you published to.

The "SSL certificate missing" warning is itself the tell: it appears precisely because the vanity domain's traffic routes through a CDN that handles SSL itself, so the site builder can't serve its own certificate for it. The live site isn't insecure, but it confirms the vanity domain isn't the origin.

Fix: tick all the production domains in the Publish dialog and publish to them. Don't guess which one your CDN treats as origin. Publish to every one.

The bare URL can still lag the fix

Even once the origin has the code, the plain live URL (no query string) can serve an old cached copy until that cache ages out or is purged. Options: wait, or have whoever controls the CDN purge that specific URL. The standing advice: know who owns your CDN account, because every future site change is subject to the same delay unless caching is tuned or you can request purges.

Value on the record but not in Slack

The contact shows the page perfectly; the alert doesn't. Cause: the property wasn't added to the workflow's Slack step(s). Fix: add it to every branch.

The lessons, condensed

01

The field that answers "which page converted them" is the browser referrer at submit time. You must capture it deliberately. The built-in source fields don't give you this.

02

Third-party forms often render in an iframe. Use the vendor's ready callback, not raw DOM queries.

03

Always provide a human-readable fallback for empty referrers.

04

Test conversions by clicking an internal link, never by typing the URL.

05

"It's not updating" is usually one of three things: not published to the right place, served stale from a CDN, or captured but not surfaced downstream. Diagnose the chain link by link.

06

A fresh, never-used query string is a free way to bypass a CDN cache and test whether the origin actually has your change. If a guaranteed-fresh fetch still lacks it, stop blaming the cache.

07

The domain you publish to isn't necessarily the origin your CDN reads from. Publish to all production domains, and learn your real serving path: browser → CDN → origin.

08

An "SSL certificate missing" warning in a site builder is often a sign the domain is fronted by a CDN that handles SSL itself, not that your live site is insecure.

09

A value on the CRM record doesn't automatically appear in your alerts. Notification steps only show the fields you explicitly add, on every branch.

10

In any committee-driven, multi-product, finite market, the converting page is a high-value routing and attribution signal that's cheap to capture and pays off across the whole funnel.

The quick win, if you don't want to write code

If a full referrer capture is more than you want to take on today, you can get part of the way with no code at all: add Original Source and First Page Seen to your Slack notification steps. It's a few clicks and it's genuinely useful context. It won't tell you the exact page they were on right before they converted, but it's a reasonable down payment until you build the real thing above.

Want to work with me?

I hope you found this helpful. If you want help building GTM systems like this, for people selling into higher education and other finite markets, drop me an email at sam@spurso.com.