• Resolved mapperkids1

    (@mapperkids1)


    Hi,

    Is that anyway to pass the referral URL to the form field? we want to know the user submit the web form from which page URL. I guess I can create a hidden form field call “referral URL”, but don’t know how and where to pass the value into it.

    Thanks,

Viewing 1 replies (of 1 total)
  • Plugin Author Nick Ciske

    (@nickciske)

    From the Read Me

    
    // Store HTTP referrer in a field (this is not 100% reliable as the browser sends this value to the server)
    
    add_filter( 'salesforce_w2l_field_value', 'salesforce_w2l_field_value_referrer_example', 10, 3 );
    
    function salesforce_w2l_field_value_referrer_example( $val, $field, $form ){
    
        $form_id = 1; // form id to act upon
        $field_name = 'referrer__c'; // API Name of the field you want to autofill
    
        if( $form == $form_id && $field_name == $field ){
            if( isset( $_SERVER['HTTP_REFERER'] ) ){
                return $_SERVER['HTTP_REFERER'];
            }
        }
    
        return $val;
    
    }
    
Viewing 1 replies (of 1 total)
  • The topic ‘Get the Referral URL’ is closed to new replies.