Support » Plugin: Brilliant Web-to-Lead for Salesforce » Capturing page URL using a hidden field

  • Resolved Adam Blythe



    I would like to know how I could capture the URL of the page my WordPress-to-lead form is on using a hidden field?

    I am aware that you can use %URL% in Lead Source field but it only has a maximum of 40 characters! Not good when your URLs are longer than that! Plus, we have the same form across multiple pages.

    We want to track where people are coming from e.g a LinkedIn campaign.


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


    Thank you Nick! I will give this a try ASAP.

    I guess the php goes in my functions.php?

    Thanks again

    Plugin Author Nick Ciske



    Or you can make a plugin using Pluginception.

    Brilliant thanks!

    Hi Nick,

    I have actually just this implemented your code…it works great thanks!

    There was just one problem that I had to fix though, the API name didn’t work for me.

    I had to use a combination of numbers and letters associated with the custom field that you get when you generate a web-to-lead form under SalesForce – Setup – App Setup – Customise – Leads – Web-to-Lead e.g. ’00ND0000005e0pN’

    Hope this makes sense!

    Thanks again.

    Plugin Author Nick Ciske


    Glad you got it working!


    I used Pluginception to create this plugin based on the code from When I try to activate it, I get this error:

    Fatal error: Cannot redeclare salesforce_w2l_field_embedurl() in /home/wp_5rdrm6/ on line 26

    Any suggestions as to what might be wrong? I’m a bit out of my depth here but would like to store the URL of the form in a custom field in Salesforce.


    Plugin Author Nick Ciske


    You need to rename the function with a prefix to match your site. The examples are just examples, they are not designed to be used verbatim. 😉

    I’ll try to clarify that in the documentation.

    So just replace salesforce_ with controlbionics_ in the function declaration and the filter callback (the second argument), but not the filter name (the first argument).

    Plugin Author Nick Ciske


    Also check to make sure you don’t have this defined elsewhere like functions.php – the error means your trying to declare this exact function name twice.

    Thanks so much – that validated. One other question: when I add the custom field to my form, what should I enter in the Value field? %URL%?

    Plugin Author Nick Ciske


    Leave it blank.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Capturing page URL using a hidden field’ is closed to new replies.