We want to track which of our pages generates form completion by our visitors. Is there a way to capture and record the URL that a form was submitted from?
Yes, there is.
First, create a hidden field in your form with the following properties:
Type: hidden input
Label: Referring URL (or whatever you want to call it)
Name: page
Click on SAVE PROPERTIES to save the element data, and then click on the SAVE icon in the upper right-hand corner of the screen to save the form with the new element.
Then, within your form's properties, go to Advanced > More Options. Then click on the FORM PIECES tab at the top of the popup screen.
In the first section (BEFORE FORM), click on the CUSTOM button. In the field that opens up underneath that, enter this code:
$pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } $this->execPieceByName('ff_InitLib'); ff_setValue('page', $pageURL); // 'page' is the name of the hidden field
Then click on the SAVE icon in the lower right-hand corner of the screen to save the piece that you just added.
When back on the form properties page, click on the SAVE icon in the upper left-hand corner of the screen to save the form itself.
Note: the URL shown above does not match the real URL of this site because the form is shown in an IFrame. Without IFrames you will see the correct URL.