View Single Post
Old 03-16-2011, 12:25 AM  
Sexgenoten
Registered User
 
Industry Role:
Join Date: Dec 2010
Posts: 85
Well, i figured i too needed to track my outgoing traffic, so here is a fast and simpel javascript/jquery solution that works for me:

Code:
function outboudTraffic( obj ){
	
        // obj comes from a ahref
        // get the src of the ahref object
	var link = $( "#" + obj.id ).attr( "href");

	// post the link value as an clicked_link post variable ( $_POST['clicked_link'] )
	$.post("api.php",	{ 
		
		clicked_link		: link
	
	
		},  function(data){
	
		//i use this to alert debugging information
		//i turn it off when going live
		alert( data);			
	});
	
}
On the api.php:

// make sure that the $_POST is coming from your domain and that you are not being
// spammed.
if ( isset( $_POST['clicked_link'] ) && !empty( $_POST['clicked_link'] ) ){

// insert it into a database
//

}
Sexgenoten is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook