Web :: General :: track client browser's clicks on A links, log them to server... |
|||
| By: Nono |
Date: 24/03/2007 09:53:21 |
Points: 20 | Status: Answered Quality : Excellent |
|
Ok I log everything on my site from every click to every page view, but one thing I can not log is clicks for anchors. Like so /index/blah/#contents I cant log the #contents bit because it occurs on the client side. Is there any way to do this other than using JS to make an onclick() handler to grab the url and submit silently in background via AJAX. I just want to see which areas of content are being viewed the most so can reposition etc. thanks! |
|||
| By: VGR | Date: 24/03/2007 09:56:02 | Type : Answer |
|
| Creating an OnClick() global event handler for each link to send it in background with xmlhttp is clearly overkill. You've an alternative, equally overkill : You can log it by using a standard redirect server script. so don't use a href="{$PHP_SELF}#something" (the {} element is implicit) but use a href="go.php?destination={urlencoded(}{$_SERVER['PHP_SELF']}#something{)} (the {} element has to be urlencoded) Perhaps the best idea is to "simply" via JS manipulate the src attribute of an hidden img ; this would in turn trigger a server request to a server/PHP script returning the correct image type and fake data, but mainly logging the action. This should work fine. |
|||
|
Do register to be able to answer |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








