Setup Website for Email Open Tracking

Select Manage -> Enable Open Tracking... from the program main menu. Please see email open tracking for an overview.

Please replace mywebsite.com with your own website name.

Pixel Tag URL

This URL is automatically inserted into each email. The inserted line is the following:

<img src="http://mywebsite.com/getimage.php?eid=unique_email_id">

Each email sent by BroadcastByEmail contains a unique id automatically generated for later tracking.

Statistics Query URL

This is the URL used to query opened emails. BroadcastByEmail calls the following to query opened emails.

http://mywebsite.com/getopen.php?eid=list_of_comma_separated_eids
Steps to setup your website and script

The following is an example for setting up your website for email open tracking. It assumes you have a relational database and PHP scripting support.

  1. Copy or create the pixel tag image to your website

    You can use the sample image found under: C:/Program Files/Voicent/broadcastbyemail/bin/onebyoneimage.jpg, or you can use any image editing tool to create your own image.

  2. Setup your database

    Your web site must be able to support a database. For example, most hosting companies have mysql databases. You need to create a table to contain the "eid". But you can also include access time and access host IP address. The following SQL statement creates a table named "opentracking":

    # SQL
    CREATE TABLE `opentracking` (
        `eid` varchar(64) NOT NULL default '',
        `ipaddr` varchar(16) NOT NULL default '',
        `atime` timestamp(14) NOT NULL
    ) TYPE
    =MyISAM;
  3. Copy or create the image access script to your website

    The following is a simple example PHP script for the "get image" operation. You can use it directly if your website supports PHP scripting.

    <?php

    header("Cache-Control: no-cache, must-revalidate");
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

    $eid = $_GET['eid'];
    $ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];

    $db_conn = mysql_connect('hostname', 'user', 'passwd') or die ("Database CONNECT Error (line 11)");

    $insert_st = "INSERT INTO opentracking values ('".$eid."', '".$ip."', now())";
    mysql_db_query('databasename', $insert_st) or die ("Database failed to insert");

    header("Location: onebyoneimage.jpg");
    return;

    ?>

    Please replace "hostname", "user", "passwd", and "databasename" with the actual name you have.

    What this script does is whenever it is called, it gets the unique email id (eid) from the HTTP request, then inserts that access to the database. After that, it returns an image named onebyoneimage.jpg.

  4. Copy or create the query open script to your website

    The following is a simple example PHP script for query operation.

    <?php

    header("Cache-Control: no-cache, must-revalidate");
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

    // list of eids separated by comma
    $eidstr=$_GET['eid'];
    $eids = explode(",", $eidstr);
    if (sizeof ($eids) == 0)
        return;

    $db_conn = mysql_connect('hostname', 'user', 'passwd') or die ("Database CONNECT Error (line 11)");

    $retstr = '';
    foreach ($eids as $eid) {
        $query_st= "SELECT COUNT(*) from opentracking where eid = '".$eid."'";
        $result = mysql_db_query('databasename', $query_st) or die ("Database failed to select");

        $count = '0';

        if (mysql_num_rows($result)) {
            $qry = mysql_fetch_array ($result);
            $count = $qry[0];
        }

        if ($retstr != '') {
            $retstr .= ',';
            $retstr .= $count;
        }


        echo $retstr;
        return;
    ?>

    Please replace hostname, user, passwd, and databasename with the actual name you have.

    What the script does is return the total access count for the eids provided. The eids are provided as a comma separated list. The return count is also returned as a comma separated list.