Skip to main content

Pass UTMs to embedded JotForm

Create hidden fields to your form

Unique Name is key, it should match with our naming convention

Embed iframe in your site

Append class as utm-src as seen in the pic

Add the following script

<script>
setTimeout(
	function(){
		handlj('.utm-src').each( (i,t) => {
			handl_utm = HandL.getAll()
			var merged = handlj.extend( {}, handl_utm, HandL.getSearchParams(this.href) )
			if (t.src !== undefined){
				var src = t.src.split("?")[0];
				if ( !$.isEmptyObject(merged) )
					t.src = src+"?"+$.param(merged)
			}
		})
	}, 1000
)

</script>

If the above solution does not work... Try this...

<script>
setTimeout(() => {
	if (typeof(handlj) == 'function'){
		var iframeParams = [];
		iframeParams.push( handlj.param(handlj.extend({}, HandL.getUrlVars(), HandL.getAll())) )
		var src = ifr.src;
		ifr.src = src + "?" + iframeParams.join('&');
	}
}, "500");
</script>