Jump to content


Photo

Link Tracking


  • Please log in to reply
2 replies to this topic

#1 MommaTC

MommaTC
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 08 May 2006 - 02:55 AM

I have looked through several hundred scripts and can't seem to find what I am looking for, I am hoping someone here will have an idea for me as to how to go about coding this.

I am using a PHP based e-mail autoresponder with a MySQL database.

I need to be able to create a "link tracking" type script that will send me an email with the subscribers name, e-mail adress, and what link they clicked, when they click on a link in an email I have sent them.

For example, let's say the subscriber receives my e-mail and clicks on "Link1"

The system will shoot me an email stating:

Subscriber ABC at myemail@email.net just visited Link1

Anybody have any thoughts on how to create a script that will do this?

Thank you,
Tracy

#2 Stuie_b

Stuie_b
  • Members
  • PipPipPip
  • Advanced Member
  • 74 posts
  • LocationNewcastle, UK

Posted 08 May 2006 - 10:15 AM

personally i'd have setup like this,


You would have a php file that would be linked to a database, then each of the links inside the email would link to this php script with a unique id number (process.php?id=1),


so the php file (process.php for arguments sake)


//Process.php
<?php
require('db.php'); //Used to connect the database
require('mail_data.php'); //Used to make it easier to edit the email sent to you
$id = $_GET['id']; //Gets the supplied id number


$qry = mysql_query("SELECT * FROM links WHERE id='".mysql_real_escape_string($id)."'"); //Get any results that match the id address

$check = mysql_num_rows($qry);
if($check > 0){
$fetch = mysql_fetch_array($qry);
mail("myemail@email.net","Link Click",$mail_body,$mail_headers); //Sends you the email (set in mail_data.php)
//if you wanted you could also track links by updating the database on a click
//mysql_query("UPDATE links SET (click) VALUE('click+1') WHERE id='".mysql_real_escape_string($id)."'");
header("location: ".$fetch['url']); //This will redirect them to the sites actual link
exit();
}else{
//Do somthing if the id supplied isn't found in the database
header('location: google.co.uk); //simply redirects to google do what you like here (if anything)
}
?>



//mail_data.php
<?php
//I only do this because it's easier for you to change
//becuase i dont know how your  e-mail autoresponder  works with user data
//i cant add there name, you will have to do that your self.
$mail_body = "Somebody visited link ".$id. " you should replace this with the message your after";
$Mail_headers = "FROM: linkproc@system.com";

?>

hope it helps

Stuie

It's all in the manual :D

#3 3s2ng

3s2ng
  • Members
  • PipPipPip
  • Advanced Member
  • 45 posts

Posted 31 October 2006 - 10:23 AM

what if you want to track the date time the email was read/openned by the user? Is it possible?

Let say when the user open their email client and reads the email. Is it possible to track this?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users