• Resolved cdeturk

    (@cdeturk)


    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)
  • 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!

    Hi Nick,

    How do I pass more than one parameter?

    Plugin Author Nick Ciske

    (@nickciske)

    One field and 1 filter per parameter.

    OR

    A utm param/field mapping array and a loop ??

    Thread Starter cdeturk

    (@cdeturk)

    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

    (@nickciske)

    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.