Tracking Email Marketing Results

successful email marketing

Find out if users are reading and responding to your email newsletters. This simple method will determine a direct correlation between newsletter clicks and sales.

Here is a very simple way to track the clicks the result directly from your email marketing newsletter.

Inside your newsletter you are likely going to include links directly to the products you are promoting in your online store. In order to track the links coming directly from the newsletter, we will create a special tracking page on your website to intercept, track, and then direct the link to the product.

The links inside your newsletter will look like:

http://examplestore.com/track.php?id=1

At the end of this link you will notice the id=1, the number 1 in this case will stand for a product page.

Now we will use this URL to track the click and then redirect to the product page.
In the code block below we look for the “id” variable and then set it inside the script as “id”.


$id = 0;
if (isset($_GET['id'])){
$id = $_GET['id'];
}

Next we write the hit to a simple text file, this will become our log file. In this example we use a file names “marketinglog.txt.” Upload a blank file with the file name “marketinglog.txt”, and set the permission to be writable on your web server.

We will write the id number, the IP address, and the date to the log file.


//file stuff
$ip = $_SERVER['REMOTE_ADDR'];
$the_date = date("Ymd" ,time());
$myFile = "marketinglog.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
fwrite($fh, $id . "," . $ip . "," . $the_date . "\n");
fclose($fh);

The next section is where you place your real links. In the example below you can see the ID to URL relationship we are using.

1 = http://examplestore.com/widget-blue.htm
2= http://examplestore.com/widget-red.htm
3= http://examplestore.com/superwidget-deluxe.htm

Note: you can use any identifier you wish here. Maybe instead of an “id”, you can use a part number or some other internal numbering system which will make it easier to interpret the data later on.

[If the id is 1]
Case 1:
[then redirect to the real product page for blue widgets]
header(‘Location:http://examplestore.com/widget-blue.htm’);
[since we have a match in the id field, we will "break" which will stop processing]
break;

The last line with “default”, means if no id is matched, then redirect to the main page of the website.


switch ($id) {
case 1:
header('Location:http://examplestore.com/widget-blue.htm');
break;
case 2:
header('Location:http://examplestore.com/widget-red.htm');
break;
case 3:
header('Location:http://examplestore.com/superwidget-deluxe.htm');
break;
default:
header('Location: http://examplestore.com');
}
?>

The Full Tracking File


$id = 0;

if (isset($_GET['id'])){
$id = $_GET['id'];
}

//file stuff
$ip = $_SERVER['REMOTE_ADDR'];
$the_date = date("Ymd" ,time());
$myFile = "marketinglog.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
fwrite($fh, $id . "," . $ip . "," . $the_date . "\n");
fclose($fh);

switch ($id) {
case 1:
header('Location:http://examplestore.com/widget-blue.htm');
break;
case 2:
header('Location:http://examplestore.com/widget-red.htm');
break;
case 3:
header('Location:http://examplestore.com/superwidget-deluxe.htm');
break;

default:
header('Location: http://examplestore.com');
}
?>

Download the php script to view your log file online. (change the extension from txt to php)

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>