Grabbing Data from URL using UTM Parameters | Community
Skip to main content
June 18, 2015
Solved

Grabbing Data from URL using UTM Parameters

  • June 18, 2015
  • 3 replies
  • 3065 views

I would like to be able to pass data to Marketo based on a lead clicking a url with utm parameters in it.

Example lead clicks www.xxx.com?utm_lead_source = website.  I would then like the lead source field in Marketo to be populated with value of "website".

Does anyone know how to do this?  I assume you can with some javascript coding.  If it is possible, could someone please provide me with some example code?  Thanks everyone.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by

This is built into both the Froms 1.0 and the Forms 2.0 forms.

Forms 1.0 : Add a hidden field for lead source on your form. Then go to Field Value and Click Edit Settings. Then set the Get Dynamic Value to Get Dynamic Value from URL Parameter. Fill in your default value. Set parameter name to utm_lead_source

Forms 2.0: Add a hidden field for lead source on your form. Then go to Autofill and click Edit. Then set the default value, set Get Value from to URL Parameter and Parameter Name to utm_lead_source

No Javascript required for this one :-)

If you are using SalesForce, just make sure the hidden field is syncing to both your leads and contacts if you want it to go to both.

3 replies

Josh_Hill13
New Participant
June 18, 2015

Yep, just look up hidden fields and utm/url parameters. There are a lot of threads on it.

Also see my site, and search for that: marketingrockstarguides.com.

Jenn_DiMaria2
New Participant
June 18, 2015

Sharon Freas​ is correct. This is what the hidden field would look like in Forms 2.0:

Accepted solution
June 18, 2015

This is built into both the Froms 1.0 and the Forms 2.0 forms.

Forms 1.0 : Add a hidden field for lead source on your form. Then go to Field Value and Click Edit Settings. Then set the Get Dynamic Value to Get Dynamic Value from URL Parameter. Fill in your default value. Set parameter name to utm_lead_source

Forms 2.0: Add a hidden field for lead source on your form. Then go to Autofill and click Edit. Then set the default value, set Get Value from to URL Parameter and Parameter Name to utm_lead_source

No Javascript required for this one :-)

If you are using SalesForce, just make sure the hidden field is syncing to both your leads and contacts if you want it to go to both.

January 15, 2016

I created the two new fields "utm_campaign" and "utm_keyword" as requested above.

I then went to the page with the parameters populated in the URL, but it's not working.  I looked at the page source and found the parameters, but the values aren't being grabbed from the URL.  Here is the page source:

<script type="text/javascript">

var mktoPreFillFields = {"Last_PPC_Campaign__c":null,"Last_PPC_Keyword__c":null};

even after I added the following to the page and reloaded:

?utm_campaign=TEST-CAMPAIGN&utm_keyword=TEST-KEYWORD

Any ideas of why the values aren't being grabbed?

I tried to add the javascript snippet to the page template in the head>, but that didn't work..

<script language="JavaScript" src="/js/public/jquery-latest.min.js" type="text/javascript"></script>

<script src="/js/public/jQueryString-2.0.2-Min.js" type="text/javascript" ></script>

<script>

// to set cookies. Uses noConflict just in case

var $jQ = jQuery.noConflict();

var utm_keyword = $jQ.getQueryString({ ID: "utm_keyword" });

var utm_source = $jQ.getQueryString({ ID: "utm_source" });

var utm_term = $jQ.getQueryString({ ID: "utm_term" });

var __kk = $jQ.getQueryString({ ID: "__kk" });

</script>

SanfordWhiteman
New Participant
January 16, 2016

Pls post a link to your LP with the form.