< Buzzing or vibrating the login form using jquery Posted On May 15, 2012 : 0 comments << >> Simple div slideshow using jquery Posted On May 9, 2012 : 0 comments << >> Copy mysql column in varchar to type date Posted On May 3, 2012 : 0 comments << >> Enter only numbers inside a input field of a form using javascript Posted On May 1, 2012 : 0 comments << >> Slide in and out animate div vertically using jquery Posted On April 25, 2012 : 1 comment << >> Tag cloud using php, mysql and ajax with filter Posted On April 24, 2012 : 0 comments << >> Change webpage font color or background color from the user side using javascript Posted On April 19, 2012 : 0 comments << >> A single link that cycles through several webpage background color using javascript Posted On April 17, 2012 : 0 comments << >> Simple webpage redirection using perl script Posted On April 10, 2012 : 0 comments << >> Get ipaddress using perl script Posted On April 4, 2012 : 0 comments << >>

Simple Ajax with PHP click tracker

This Tutorial Has Been Viewed 4,627 Times.
VN:F [1.9.17_1161]
Rating: 8.7/10 (15 votes cast)

This tutorial shows how to track your vistors click using simple php and Ajax To implement the click tracking tool we need to create 2 files:
Demo.html: This file contains the html with the links and the Ajax code.
clickTracker.php: This files will be called by Ajax and records the click event.
DEMO.HTML will look like this

< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8? />
<title>Ajax click tracking example</title>
<script language="javascript" type="text/javascript">
function getHTTPObject(){
if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
else if (window.XMLHttpRequest) return new XMLHttpRequest();
else {
alert("Your browser does not support AJAX.");
return null;
}
}
// Change the value of the outputText field
function setOutput(){
return true;
}
// Implement business logic
function doTrack(element){
httpObject = getHTTPObject();
if (httpObject != null) {
dst = element.href;
src = document.location.href;
httpObject.open("GET", "clickTracker.php?src="+src+"&dst="+dst, true);
httpObject.send(null);
httpObject.onreadystatechange = setOutput;
}
}
var httpObject = null;
var src = null;
var dst = null;
</script>
</head>
<body>
<a href="http://www.mistonline.in/wp" onclick="doTrack(this);" > Test Click </a>
</body>
</html>
Now our clickTracker.php file

We will write data dynamically using AJAX to a simple text file, If you are not sure how to read/write data using
a text file in php then
GO HERE
Code:

DOWNLOAD PHP CODE HERE

Thats it finished.Now you can track your website clicks, Thanks ajaxf1
VN:F [1.9.17_1161]
Rating: 8.7/10 (15 votes cast)

Simple Ajax with PHP click tracker, 8.7 out of 10 based on 15 ratings

Incoming search terms:





You will also be interested in ,

Tags: , ,

Leave a Reply

Proudly designed by Mistonline.in.
Affordable Seo PackagesSeo BlogEdu Backlinks