Author Topic: Link Tracking Script for links from web pages, e-books ...  (Read 6265 times)

Vertex42

  • Posts: 8
    • View Profile
    • http://www.vertex42.com
One of the first things I wanted to do with ListMail, after seeing how the link tracking worked, was to use it to track links on web pages. With Dean's help, this turned out to be a very simple thing to set up. With the custom script I can now:

1. Keep track of the number of File Downloads.

2. Use affiliate links "anywhere", including e-books, AdWords, web pages, etc. I now manage all of my affiliate links with ListMail.

3. Record simple survey stats / polls, including automatic links to "thank-you" pages.

Here is the "ReadMe.txt" file for setting up the script:

Code: [Select]

-------------------------------------------------
         README for the go.php Script
------------------------------------------------

INSTALLING the script

(1) Create a directory on your website called "Links"

(2) Open the go.php script using a text editor and make
    sure that the $configfile and $adminfile variables
    point to the correct location on your website.
    (i.e. The "ListMail" directory will be the directory
    you created when installing ListMailPro)

(2) Upload the go.php script to the Links directory

(3) Create tracking URLs using ListMailPro

    The urlid parameter in the go.php script will
    correspond to the Ref.Code column in ListMailPro

(4) Place links on your website, e-books, etc.

Example:
      http://yourdomain.com/Links/go.php?urlid=therefcode


I'll post the actual script next ...

Vertex42

  • Posts: 8
    • View Profile
    • http://www.vertex42.com
The go.php Script
« Reply #1 on: May 02, 2004, 11:49:38 pm »
Here is the go.php script:

Code: [Select]

<?php// ListMailPro Link Tracking Script -- without user tracking// This entire script is based upon whether the $urlid parameter is set// "urlid" is used to make the links look less like redirections.// This file should be placed in a generic directory, like "Links".// In Html, Forums, E-Books, etc. use: http://yourdomain.com/Links/go.php?urlid=therefcode/* ======  STUFF TO EDIT MANUALLY  =============  */$configfile = "../ListMail/config.php";$adminfile = "../ListMail/admin.php";/* ==============  THE MEAT =============== */if ( isset($urlid) ) {  // continue} else {  echo "<html><head></head><body>No link was specified.</body></html>";  exit;}include($configfile); // grabs info to connect to databaseinclude($adminfile); // grabs info to connect to database$link = mysql_connect($sqlhost,$sqluser,$sqlpass);mysql_selectdb($sqldb);$rcode = $urlid;  // get link data from MySQL table$krow = mysql_query("select id as kid,refcode,title,http,hits from $ktable where refcode = '$rcode' limit 0,1");if(mysql_num_rows($krow)==0){ $krow = mysql_query("select id as kid,refcode,title,http,hits from $ktable where refcode = '$urlid' limit 0,1"); }if(mysql_num_rows($krow)==0) echo "Link not found.";while(list($kid,$refcode,$title,$http,$hits) = @mysql_fetch_row($krow)) {  $newhit = $hits + 1;  $cmd = "update $ktable set hits = '$newhit' where id = '$kid'";  mysql_query($cmd);  // insert id,uid,linkid  if (!strstr($http, "://")) { $http = "http://" . $http; }  // process msg code in link  $http = urlencode(processmsg('',$uid,$http,'0'));  // fix ://  $http = str_replace('%3A',':',$http);  $http = str_replace('%2F','/',$http);  $http = str_replace('%3F','?',$http);  $http = str_replace('%3D','=',$http);  $http = str_replace('%26','&',$http);// show the redirect pageecho "<html><head><title>Linking to $title... Please stand by...</title><noscript><meta http-equiv=\"refresh\" content=\"3; URL=$http\"></noscript><script language=\"JavaScript\"><!--var sTargetURL = \"$http\";function doRedirect(){    setTimeout( \"window.location.href = sTargetURL\", 2*1000 );}//--></script><script language=\"JavaScript1.1\"><!--function doRedirect(){    window.location.replace( sTargetURL );}doRedirect();//--></script></head><body onload=\"doRedirect()\">If you are seeing this, either the link does not exist, or you need to <a href=\"$http\">click here</a>.<script>window.status='$logtxt';</script></body></html>";} // End of While Statement?>



Dean actually wrote most of this script. I just made some minor adjustments. I hope this helps out.

- Jon

terryj

  • Posts: 5
    • View Profile
Link Tracking Script for links from web pages, e-books ...
« Reply #2 on: May 03, 2004, 07:25:11 am »
This is great work guys. Keep it up, I love it.


Thanks

Terry
Don't Visit Here ==> Easy Web Resources ... Unless You Are Really Serious About Your Web Site!

jonisolis

  • Posts: 27
    • View Profile
help need in installing this link tracking script
« Reply #3 on: April 14, 2005, 11:50:10 am »
Dear Dean,

Help, I would like to set up this link tracking script but I must be doing something wrong as I cannot get it to work right with a website link.

What would you charge me to set this script up to working right?
Thanks! --Joni Solis

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Link Tracking Script for links from web pages, e-books ...
« Reply #4 on: April 14, 2005, 12:05:42 pm »
I will take care of it for $35.  Order a Server Analysis (or submit a request of type Other and send me $35 via PayPal to paypal@listmailpro.com) with some notes, including a link to this post.

Regards
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Link Tracking Script for links from web pages, e-books ...
« Reply #5 on: April 19, 2005, 06:38:22 pm »
Working on this for Joni I found that, due to ListMail v1.8 changes, the script line that utilizes the processmsg function needs to be as follows:

Code: [Select]
// process msg code in link
  list($http)=processmsg($uid,$http,'','','0');
  $http = urlencode($http);

Regards
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting