Pass UTM Params into page to then pass into embedded Formsite form

  • 13 November 2017
  • 2 replies
  • 1 view

I’m using an embedded Formsite form on our landing pages which I’m wanting to pass UTM parameters into. Formsite states I need to pass it into the page then pass it into the embedded form from there. Here’s their instructions on it. Any thoughts on the script I need for that?


2 replies

Userlevel 7
Badge +3

Hi @Joe_Parry,

I took a look at the instructions and it seems pretty straight forward.

1.) Add some newer jQuery

2.) Get & decode the URL parameters

3.) Place them with the proposed prePopulate method

It should be a quick 30min to an hour project with proper QA.

My agency has developed over 100 custom scrips and integrations for Unbounce so feel free to DM me, if you want us to solve this for you.

Best,
Hristian

Had the same problem, had a developer solve for me and he used this script to pass utm_source to formsite form field 7. Hope it helps!

<script type="text/javascript">

function getParameterByName(name, url) {
  if (!url) url = window.location.href;
  name = name.replace(/[\[\]]/g, "\\$&");
  var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
      results = regex.exec(url);
  if (!results) return null;
  if (!results[2]) return '';
  return decodeURIComponent(results[2].replace(/\+/g, " "));

}

if(getParameterByName(‘utm_source’)) {_
var utm_source = getParameterByName(‘utm_source’);_
console.log(utm_source);_
EmbedManager.embed({_
key: “https://fs28.formsite.com/res/showFormEmbed?EParam=m%2FOmK8apOTBun8tDG%2Bm0B0Hp%2BOxx3Si2&1955837014”,_
width: “100%”,_
mobileResponsive: true,_
prePopulate: { ‘7’:utm_source},_

  });
} else {
  EmbedManager.embed({
    key: "https://fs28.formsite.com/res/showFormEmbed?EParam=m%2FOmK8apOTBun8tDG%2Bm0B0Hp%2BOxx3Si2&1955837014",
    width: "100%",
    mobileResponsive: true
  });
}

Reply