Skip to content

Tracking5 min read

Track and surface your prospects’ first navigation page in Webflow

Video

StepWebflow elementAction
1Head of each pageAdd the script to capture the first page
2FormAdd a hidden field to store the URL
3Hidden inputAdd a unique ID (e.g. firstpage)
4Head or BodyInject the value into the field

In this episode, Sandro, cofounder of the Gemeos Webflow agency, shows you how to track and capture the first page your prospects visit in Webflow

1. Add the custom code to capture the first page and store it in session

Add this custom code in the head of each of your landing pages

<script>
// Declare the firstPage variable for new users and store it in session
var firstPage;
if (!sessionStorage.getItem("firstPage")) {
  firstPage = window.location.pathname;
  sessionStorage.setItem("firstPage", firstPage);
} else {
  firstPage = sessionStorage.getItem("firstPage");
}
</script>

2. Add a field to your form to pass along the stored value

Make sure to set these fields to display: none. Your prospects don't need to see them, and it could hurt your conversion rate.

3. Add an ID to your form field

4. Add the custom code to display the first page URL in your form field

Make sure to replace "firstpage" with the ID you set earlier

<script>
// Get the HTML element corresponding to the form field
var firstPageField = document.getElementById("firstpage");
// Update the HTML element value to display firstPage
firstPageField.value = firstPage;
</script>

5. Publish your site and test the result

Published on Apr 10, 2025

Sandro DA SILVA

Growth Marketer, Webflow expert, and jack-of-all-trades. Sandro handles commercial operations, ensures projects run smoothly, and addresses marketing-related issues (SEO, Tracking, Copywriting, etc).

You're going to working with us, guaranteed

Ready to launch your business?

get a quote

Let’s f*****G GO !!