Back to the Blog
Essay

How to Capture and Cookie UTM's then pass them to an Iframes Source url

How to capture UTMs and pass them to an Iframe(frame Source)

By Sean Gowing
Dec 1, 20252 min read

Note: To do this setup you need access to both the website itself and the Iframe window.

In this post we will explore how to capture UTMs, store them in a cookie and save them for 30 days. Once that is complete we will look for any iframe windows loaded on the page and add the utms to the Iframe Source url. Doing it this way will make the UTMs present in the iframe window which will allow the iframe itself to capture them simply. Trim this code as needed to accomplish your goals.

Iframe Source Code: Use this code inside the Iframe to capture the UTMs from the source URL and apply them to the form.

Want this for your team?

Send us a brief and we'll come back with a fixed-price plan in 48 hours.