Tracking6 min read
Track where your conversions come from with UTM parameters in Webflow

Video
| UTM parameter | JS variable | Use |
|---|---|---|
| utm_source | utmSource | Original platform (Google, Facebook, LinkedIn...) |
| utm_medium | utmMedium | Channel type (CPC, email, social...) |
| utm_campaign | utmCampaign | Campaign name |
| utm_content | utmContent | Content variant (A/B test) |
In this episode, Sandro, co-founder of the Gemeos Webflow agency, shows you how to track where your conversions come from using UTM parameters in Webflow.
1. Add the custom code to capture the UTM parameter and store it in session
Add this custom code to the head of each of your landing pages
<script>
// Retrieve the value of the "utm_source" parameter from the URL and store it in session
var utmSource;
if (!sessionStorage.getItem("utmSource")) {
utmSource = new URL(window.location.href).searchParams.get("utm_source") || "google";
sessionStorage.setItem("utmSource", utmSource);
} else {
utmSource = sessionStorage.getItem("utmSource");
}
</script>2. Add fields to your form to pass along the UTM parameters
Make sure you set these fields to display: none. Your leads don't need to see them, and showing them could hurt your conversion rate.

3. Add an ID to each field you use to pass along values

4. Add the custom code to display the UTM parameter in your form fields
< script>
// Get the HTML element corresponding to the form field
var leadSource = document.getElementById("leadSource");
// Update the HTML element value to display firstPage
leadSource.value = utmSource;Make sure you replace "leadSource" with the ID value you set earlier
5. Publish your site and test the result



