1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Tracking Email Opens/Clicks

Discussion in 'Making Money' started by stealthisblog, Jun 20, 2009.

  1. stealthisblog

    stealthisblog Regular Member

    Joined:
    May 26, 2008
    Messages:
    289
    Likes Received:
    238
    Location:
    New York City
    Hey. I was wondering if there were any scripts out there that tracked who opened an email or clicked the link inside of it? This would be great for checking out email deliverability and finding ways to get passed spam filters. I know some people have shown stats of opens and clicks before, I'm just not sure how.

    If no one knows of any I'll whip one up, its really easy. I just figured a nice polished script would be better than a half assed one I made in a few minutes ;)

    Thanks for any replies!
     
  2. stealthisblog

    stealthisblog Regular Member

    Joined:
    May 26, 2008
    Messages:
    289
    Likes Received:
    238
    Location:
    New York City
    Ok forget it, just made my own. Thanks anyway.
     
  3. donman

    donman BANNED BANNED

    Joined:
    Jul 1, 2008
    Messages:
    30
    Likes Received:
    16
    Would u mind telling us how you made it? I was looking also for a solution.
     
  4. Paper-Boy

    Paper-Boy Elite Member

    Joined:
    Jun 17, 2009
    Messages:
    5,118
    Likes Received:
    1,822
    interspire can do this.
     
  5. digdugg

    digdugg Junior Member

    Joined:
    Jun 1, 2009
    Messages:
    107
    Likes Received:
    19
    Location:
    The Milky Way Galaxy
    The way I track email open/clicks is by looking at the stats on my domain. Obviously if they came from anything with mail contained in the referrer then they responded to my email. You can further refine this to track creatives and split test (i.e. 2 different urls and then compare the page requests to determine the better creative). Send a constant amount of email with the creatives split between the two to see which one 'wins out'.

    After this I can check who clicks on my cpa offer from that landing page via 301 redirect requests which also has a section in awstats. This you can form rudimentary numbers and this is totally a DIY solution.

    I'm sure there is software out there which other people can chime in about that will do all this for you.
     
  6. freudianslip27

    freudianslip27 Junior Member

    Joined:
    Oct 6, 2007
    Messages:
    109
    Likes Received:
    14
    You can also have an image load into the email, and have that image in a specific spot on your domain (like in a folder specific to that email, so you know).

    Of course having html in an email can effect delivery. Does anyone know if it counts as an image load if someone opens the email but outlook blocks the image? Or would it come up as an error?

    Matt
     
  7. stealthisblog

    stealthisblog Regular Member

    Joined:
    May 26, 2008
    Messages:
    289
    Likes Received:
    238
    Location:
    New York City
    Sorry guys, forgot about the script. Just create a database named emailstats and run the SQL queries in the comments to build the needed tables.

    Code:
    <?php
    
    /*
    For database `emailstats`
    
    CREATE TABLE  `emailstats`.`logs` (
    `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
    `ip` TEXT NOT NULL ,
    `campaign` INT NOT NULL ,
    `opens` INT NOT NULL ,
    `clicks` INT NOT NULL
    ) ENGINE = MYISAM ;
    
    CREATE TABLE  `emailstats`.`campaigns` (
    `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
    `url` TEXT NOT NULL
    ) ENGINE = MYISAM ;
    */
    
    
    
    $dbhost = "localhost";
    $dbuser = "username";
    $dbpass = "password";
    $dbname = "emailstats";
    
    mysql_connect($dbhost, $dbuser, $dbpass);
    mysql_select_db($dbname);
    
    switch($_GET['act']){
    	case "open":
    		$ip = $_SERVER['REMOTE_ADDR'];
    		$campaign = (int)$_GET['campaign'];
    		if(mysql_num_rows(mysql_query("SELECT * FROM logs WHERE ip='$ip' AND campaign='$campaign'"))==0){
    			mysql_query("INSERT INTO logs (ip, campaign, opens, clicks) VALUES ('$ip', '$campaign', '1', '0')");
    		} else {
    			$opens = mysql_query("SELECT * FROM logs WHERE ip='$ip' AND campaign='$campaign'");
    			$opens = mysql_fetch_assoc($opens);
    			$new_opens = $opens['opens'] + 1;
    			$rowid = $opens['id'];
    			mysql_query("UPDATE logs SET opens='$new_opens' WHERE id='$rowid'") or die(mysql_error());
    		}
    		break;
    	
    	case "click":
    		$ip = $_SERVER['REMOTE_ADDR'];
    		$campaign = (int)$_GET['campaign'];
    		if(mysql_num_rows(mysql_query("SELECT * FROM logs WHERE ip='$ip' AND campaign='$campaign'"))==0){
    			mysql_query("INSERT INTO logs (ip, campaign, opens, clicks) VALUES ('$ip', '$campaign', '0', '1')");
    		} else {
    			$clicks = mysql_query("SELECT * FROM logs WHERE ip='$ip' AND campaign='$campaign'");
    			$clicks = mysql_fetch_assoc($clicks);
    			$new_clicks = $clicks['clicks'] + 1;
    			$rowid = $clicks['id'];
    			mysql_query("UPDATE logs SET clicks='$new_clicks' WHERE id='$rowid'");
    
    			$camp = mysql_query("SELECT * FROM campaigns WHERE id='$campaign'");
    			$camp = mysql_fetch_assoc($camp);
    			$camp = $camp['url'];
    		}	
    		header("Location: $camp");
    		break;
    
    	default:
    		echo "Internal Server Error. Logged.";
    		break;
    }
    
    ?>
     
    • Thanks Thanks x 4
  8. gragster

    gragster Regular Member

    Joined:
    May 24, 2008
    Messages:
    231
    Likes Received:
    38
    most common method is to load an image in the email.
     
  9. stealthisblog

    stealthisblog Regular Member

    Joined:
    May 26, 2008
    Messages:
    289
    Likes Received:
    238
    Location:
    New York City
    Oh sorry, I didn't specify what to do with my logger.

    Say you installed it on site.com/log.php

    You would first add your campaign URL to the database. Say you add google.com and its the 1st row.

    For the link in your email, you would do <a href="http://site.com/log.php?click=1">Google</a>. It would redirect to Google and log the click.

    At the end you would put <img src="http://site.com/log.php?open=1" style="visibility: hidden">. This would log whenever the user opens the email.

    Then you would just check the logs database table and see the opens and clicks!
     
  10. phpfiend

    phpfiend Junior Member

    Joined:
    Apr 12, 2009
    Messages:
    172
    Likes Received:
    102
    Occupation:
    Web Dev and IM
    Home Page:
    Thanks I will have to implement this into my emails...