
The javascript file here has the code that you see to the left. Essentially, the script looks for query strings in the URL of your page. In this case, we are looking for a query string called "c", so it will appear as "&c=****" where **** is the lead source code we are looking to track.
The script then puts that value in the "Campaign_ID" field (likely a hidden field) within your web form. The web form in this example is called "WhitepaperForm_data". To configure this for your web form, just add the javascript into the page with your web form, and configure the form name, form field, and query string, and you will have the query string value automatically populate your form field.
This technique is a very useful one to know, as it can be extended to do all sorts of interesting things with your web forms, and the content on your pages, based on the values passed in in a query string.
3 comments:
If I have several parameters that track different lead sources (Google, Facebook, Banners) how do I add them to the JavaScript?
In the source I suggest changing
var strURL = document.location.href;
to
var strURL = decodeURIComponent(document.location.href);
This will allow special characters such as the @ in emails to be formatted properly.
In the source I suggest changing
var strURL = document.location.href;
to
var strURL = decodeURIComponent(document.location.href);
This will allow special characters such as the @ in emails to be formatted properly.
Post a Comment