For those of you that are building out multiple landing pages I have a simple javascript that may help you with passing variables from campaign url strings into your landing pages.

For example, if you have landing pages that contain identical forms and only need unique “lead source” information you can use this javascript to pull a variable passed in a url string to change the lead source information.

Place the following code where you would normally put your hidden lead source fields.

<script>
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split(”&”);
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split(”=”);
if (pair[0] == variable) {
return pair[1];
}
}
}</script>
<script type=”text/javascript” language=”JavaScript”><!–
document.write(’<input ‘);
document.write(’ type=”hidden” ‘);
document.write(’ name=”lead_source” ‘);
document.write(’ value=”‘ + getQueryVariable(”ls”) + ‘”>’);
//–></script>

You can then access the page with the variable attached to the url:

www.yourwebpage.com/landingpage.html?ls=leadsource1

The variable populates the hidden form field with the lead source information.

<input name=”lead_source” value=”leadsource1″ type=”hidden”>

When the user clicks submit the information will populate in salesforce.com eliminating the need for multiple landing pages.

You can also use this in correlation with you analytics link ids to maintain consistency in your reporting. Just change the variable in this line of code:

document.write(’ value=”‘ + getQueryVariable(”change-this-value”) + ‘”>’);

You can be creative and use this script to pass multiple values if needed…think about personalizing the landing page from a personalized url string in an email. You could pre-populate a form or even personalize the landing page with their name or any number of attributes in the email database!

Best of luck to you!

[del.icio.us] [Digg] [Mixx] [Reddit] [StumbleUpon] [Technorati]

If you are interested in learning more about our authors, you can choose from the list to the right. Luke Newton has been involved in internet marketing for such companies as Resort Condominiums International, ExactTarget, Watchfire, Wild Birds Ulimited, Carrier, Marsh Supermarkets, and many others. Read more from this author


No related posts.

Categories: Optimization, Resources, Salesforce.com, Strategy and Tactics ~ Trackback

Tags: , , , , ,

This blog removes the default "nofollow" tag - so your backlink is accessible to Google. It's my way of saying "Thank You" for your participation.

One Response to “Passing values into landing pages from a url”

  1. 1
    Smith

    Is it possible to associate leads to a campaign based on the fields in the lead form?

Leave a Reply

Comment Policy: We moderate comments. Please be patient:

  • We will not accept spam of any kind.
  • We will not accept rude comments. If they do not get posted I will let you know why.
  • Offensive language in comments will be edited.

Other than that - we encourage a colorful and lively debate!