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
Code:
Thats it finished.Now you can track your website clicks, Thanks ajaxf1
Incoming search terms:
- php click tracking tutorial (13)
- php click tracker (9)
- ajax click tracking (8)
- ajax click tracker (8)
- php click tracker tutorial (7)
- ajax hit counter (7)
- php click tracking script (6)
- php click tracking (6)
- click tracker php (5)
- ajax tracking clicks javascript (5)
- ajax click counter with php (5)
- simle click tracking php source code (4)
- php ajax tracking (4)
- online visitors counter php script tutorials and ajax (3)
- email\s HTML code go to a php click tracker (3)
- ajax php clock (3)
- track clicks php tutorial (3)
- how to show record in click event ajax php (3)
- How to track Buttons clicked tracking – php tutorial (3)
- dst = element href (3)
- simple click tracker (3)
- ajax click event php (3)
- simple tracker in javascript (3)
- click counter ajax and php examples (2)
- click tracking php tutorial (2)
- php ajax mysql click counter (2)
- fetch record with php ajax tutorial (2)
- php ajax click tracker (2)
- ajax php tracking (2)
- hit counter php ajax (2)
- click tracking in php (2)
- clicktrack ajax php (2)
- clicktracker (2)
- click tracking script php (2)
- ajax tutorial for image hit counter (2)
- php ajax hit counter (2)
- click tracking onclick event ajax (2)
- ajax visitor counter (2)
- ajax w3c tutorial (2)
- ajax who is online tracker (2)
You will also be interested in ,
- Tag cloud using php, mysql and ajax with filter
- Ajax Page With PHP
- Simple auto suggest script using ajax php css and tags from wordpress
- Ajax and Jquery
- Autosuggestion / Autocomplete script using PHP and Ajax
- Automatic Ajax Loading Images With Prototype
- ScriptAlias and Alias in httpd.conf at a glance
- Creating random number using php
- Using PHP_SELF best practices
- Redirect webpage using php

