In order to obtain the previous page URL on a form submission a javascript function needs to be added to the external webpage that hosts the Eloqua integrated form. The Javascript extracts the "previous page" URL address and populates a hidden form field. The hidden form field will need to be added to the page. The field is then passed on the form submit to Eloqua.
To achieve this the following steps need to be made:
1) The webpage hosting the Eloqua form must have the below JavaScript code added. The code obtains the previous "from" URL.
<script type='text/javascript' language='JavaScript'>
function refer()
{
if (document.referrer != "") {
var referringURL = document.referrer;
document.forms["aspnetForm"].elements["ReferencePage"].value = referringURL;
}
}
</script>
2) The same JavaScript must be called as part of the page initiate.
<script type='text/javascript' language='JavaScript'><!--//
window.onload = initPage;
function initPage(){
if (this.GetElqCustomerGUID)
{
document.forms["aspnetForm"].elements["elqCustomerGUID"].value = GetElqCustomerGUID();
}
refer(); // To be added to the current initPage function
}
//-->
</script>
3) A hidden form field that is populate with the "Previous Page" URL must be added to the webpage. The name of the field must be "ReferencePage" as this is the field name used in the JavaScript function. If it is changed here the JavaScript must be updated.
<input type="hidden" name="ReferencePage" value="" />
4) The new form field is to be included in the form submit sent to Eloqua. Therefore, a new Hiddenfield must be added to the Form within Eloqua. The name of the form field must be the same as the form field in Eloqua. In this example the name is ReferencePage
Once all the configuration is complete, the testing will result in the users previous page included in the form submission. This can be viewed under the "Form Submission Data" option in the menu.