Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exit link tracking

Status
Not open for further replies.

ineedhelplease

Technical User
Dec 18, 2002
18
US
My website has several links pointing to relevant external sites. Is there a way to log the links that are clicked on to exit my site or domain? Any help would be useful.

Thank you.
 
In IE only, and there is probably a better way, this works:
Code:
<body onunload="document.getElementById('log').src='log.php?'+document.activeElement.href);">
<iframe id="log" src="" style="display: none;"></iframe>
</body>
This way, when the page unloads, the iframe is set to log.php?linkhrefclicked.html. You would create a log.php (or anything else) that takes the page clicked from the querystring and stores it.
This could also have been done in a popup (and it would probably have been better) except anyone with a half-decent popup blocker would not save the link.

--Chessbot

"Violence is the last refuge of the incompetent." -- Asimov, Foundation
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top