Title: Include UTM parameters
Last modified: April 23, 2019

---

# Include UTM parameters

 *  Resolved [cdeturk](https://wordpress.org/support/users/cdeturk/)
 * (@cdeturk)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/include-utm-parameters/)
 * I use UTM parameters for my ad campaigns. Is there a way to capture the UTM parameters
   as BWTL fields so they can be submitted to Salesforce?
 * Stated another way, a user arrives at my form from a URL that has UTM parameters.
   Is there a way to parse those parameters, put the values into hidden form fields,
   and send them off to Salesforce where I have the same fields that can house the
   UTM parameter values?
 * Thanks

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Noche70](https://wordpress.org/support/users/noche70/)
 * (@noche70)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/include-utm-parameters/#post-11470388)
 * add_filter( ‘salesforce_w2l_field_value’, ‘salesforce_w2l_field_value_querystring_example’,
   10, 3 );
 * function salesforce_w2l_field_value_querystring_example( $val, $field, $form ){
 *  $form_id = 4; // form id to act upon
    $field_name = ‘source_c__c’; // API Name
   of the field you want to autofill $qs_var = ‘utm_source’; // e.g. ?source=foo
 *  if( $form == $form_id && $field_name == $field ){
    if( isset( $_GET[ $qs_var])){
   return $_GET[ $qs_var ]; } }
 *  return $val;
 * }
 * It worked for me!
 *  [Noche70](https://wordpress.org/support/users/noche70/)
 * (@noche70)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/include-utm-parameters/#post-11470589)
 * Hi Nick,
 * How do I pass more than one parameter?
 *  Plugin Author [Nick Ciske](https://wordpress.org/support/users/nickciske/)
 * (@nickciske)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/include-utm-parameters/#post-11470905)
 * One field and 1 filter per parameter.
 * OR
 * A utm param/field mapping array and a loop 😉
 *  Thread Starter [cdeturk](https://wordpress.org/support/users/cdeturk/)
 * (@cdeturk)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/include-utm-parameters/#post-11471561)
 * Wow, this is great. Thank you.
    I’m not a developer so let me ask some questions
   that are dumb.
 * -Does this go in the header or body?
 * -Do I wrap a script tag around this?
 * -Same question as you had: if I have three fields; source, medium and campaign,
   do I repeat the last two lines starting with “$”
 * Thank you
 *  Plugin Author [Nick Ciske](https://wordpress.org/support/users/nickciske/)
 * (@nickciske)
 * [7 years ago](https://wordpress.org/support/topic/include-utm-parameters/#post-11562185)
 * It’s PHP so it goes in functions.php or a custom plugin.
 * Handling 3 fields would require 3 hooks, or a modified function.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Include UTM parameters’ is closed to new replies.

 * ![](https://ps.w.org/salesforce-wordpress-to-lead/assets/icon-256x256.png?rev
   =2316786)
 * [Brilliant Web-to-Lead for Salesforce](https://wordpress.org/plugins/salesforce-wordpress-to-lead/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/salesforce-wordpress-to-lead/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/salesforce-wordpress-to-lead/)
 * [Active Topics](https://wordpress.org/support/plugin/salesforce-wordpress-to-lead/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/salesforce-wordpress-to-lead/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/salesforce-wordpress-to-lead/reviews/)

## Tags

 * [utm](https://wordpress.org/support/topic-tag/utm/)

 * 5 replies
 * 3 participants
 * Last reply from: [Nick Ciske](https://wordpress.org/support/users/nickciske/)
 * Last activity: [7 years ago](https://wordpress.org/support/topic/include-utm-parameters/#post-11562185)
 * Status: resolved