LeadConduit by ActiveProspect

Using Campaign Fields to Track Web Traffic


For leads generated on your own website(s), it is generally good practice to also track the source of web traffic that generated the lead. This information should be included as a value with each individual lead. This will allow you to track the quality of the lead by traffic source.


Defining the fields

The first step is to create a new field in the campaign to be used for tracking the source of traffic. You can name this field whatever you want. As an example, let’s say you want to call this field “trafficsource.” The idea is to collect information like “trafficsource=google” or “trafficsource=yahoo” with each lead. You can get as granular as you want with the data collection. For example, for search campaigns you probably want to track the keyword that was used to generate the lead. You could create a campaign field called “keyword”. The idea is to collect information like “keyword=refinance” or “keyword=mortgage-broker”.

Collecting the field values

After you have defined the variables you want to collect with each lead, you need to determine how to append this information with the lead data. The general idea is to collect the information in the URL that was used to generate the traffic and append this information with the data that is input by the consumer on your webform. For example, let’s say your website is www.free-mortgage-quote.com and you are planning to buy the keyword “refinance” on Google. When setting up your Google campaign, you may use the following URL: http://www.free-mortgage-quote.com/?trafficsource=google&keyword=refinance

Appending URL values with the lead data

This is where things get more technical. So you’ll need the help of a web developer. The goal is to capture the values from the URL and post them with the other lead data that is submitted by the consumer.

One method of doing this is with PHP:

$trafficsource = $_GET['trafficsource'];
$keyword = $_GET['keyword'];
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<input type="hidden" name="trafficsource" value="<?= $trafficsource ?>" />
<input type="hidden" name="keyword" value="<?= $keyword ?>" />

Above is a simple PHP page that grabs the values for both trafficsource and keyword from the URL, if they are present, via the HTTP GET method and assigns each of them as a PHP variable, $trafficsource and $keyword respectively.

These PHP variables are then passed as hidden inputs in the HTML form by printing them in the value attribute for the input, e.g. value="<?= $trafficsource ?>".

If the trafficsource value in the URL is, for example, “yahoo” the HTML sent to the browser will be:

<input type="hidden" name="trafficsource" value="yahoo" />

If there is no trafficsource value in the URL the PHP variable ($trafficsource) will be empty and the input will be submitted with, as expected, no value. The HTML will look like this:

<input type="hidden" name="trafficsource" value="" />

last updated 8/25/2008 2:31 PM