MommaTC Posted May 8, 2006 Share Posted May 8, 2006 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 Link1Anybody have any thoughts on how to create a script that will do this?Thank you,Tracy Quote Link to comment https://forums.phpfreaks.com/topic/9278-link-tracking/ Share on other sites More sharing options...
Stuie_b Posted May 8, 2006 Share Posted May 8, 2006 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[code]<?phprequire('db.php'); //Used to connect the databaserequire('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 linkexit();}else{//Do somthing if the id supplied isn't found in the databaseheader('location: google.co.uk); //simply redirects to google do what you like here (if anything)}?>[/code]//mail_data.php[code]<?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";?>[/code]hope it helpsStuie Quote Link to comment https://forums.phpfreaks.com/topic/9278-link-tracking/#findComment-34254 Share on other sites More sharing options...
3s2ng Posted October 31, 2006 Share Posted October 31, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/9278-link-tracking/#findComment-117202 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.