To capture an entire URL query string and insert it into a SINGLE hidden field in a form:
- Make sure you have created the custom field that you would like to use as a HIDDEN form field to receive the query string data.
- Add an ID to the hidden field you plan to populate with data:
<input name="x_udf_leadsource79" id="x_udf_leadsource79" type="hidden" />
- Add script to populate the field with the query string:
<script type="text/javascript">
if(window.location.href.indexOf('?')!=-1){
document.getElementById('x_udf_leadsource79').value = window.location.href.slice(window.location.href.indexOf('?') + 1);
}
</script>
Note - The script must appear AFTER the target <input> in the code.
- Complete code will look similar to this:
Hidden fields in form:
<input name="x_udf_leadsource79" id="x_udf_leadsource79" type="hidden" />
Script at end of page that populates field with query string data:
<script type="text/javascript">
if(window.location.href.indexOf('?')!=-1){
document.getElementById('x_udf_leadsource79').value = window.location.href.slice(window.location.href.indexOf('?') + 1);
}
</script> -
Data in eTrigue record will look like this:
To learn how to capture specific individual parameter values from the URL query string and insert them into multiple corresponding hidden fields, click here.
To learn how to create a new Standard eTrigue-enabled web form, click here.
To learn how to edit your existing Standard eTrigue-enabled web forms, click here.
To learn how to add a Standard eTrigue-enabled web form to your tracked website(s), click here.
To learn how to add a Standard eTrigue-enabled web form to your DemandCenter Landing pages, click here.
To learn how to add a Standard eTrigue-enabled web form to a web-page hosted on your site, click here.