Search Engine Friendly Exit CounterDistributed Systems with Node.js, O'Reilly 2020, has been published!
We built this script about a month ago that counted the exit clicks with affiliates. The url for the script (which, if your reading this, your probably familiar with) is
### is the unique id for each affiliate.
The problem with this script is that it is not search engine friendly. The exit.php, as you can probably guess, spits out a meta refresh tag that redirects the user to the affiliate site. Google doesn't like the meta refresh tag. Therefore, by using that system, we don't help out our affiliates. Google will simply see the link to a page called exit.php and ignore everything.
Google follows plain boring anchor links (
Here is the code:
<a href="http://www.google.com/"> <img src="affiliates/google.gif" alt="Google" title="Google" onclick='window.location="exit.php?go=25"'> </a>
The anchor tag encompasses the image tag. The anchor tag links to the normal website. The image tag has the onclick attribute which links to the affiliate script.
Why this works: Google is parsing the vanilla anchor tag, and the user's browser, when the affiliate image is clicked, decides to follow the onclick instead of the anchor. Google is happy and see's their normal link to another site, the user is happy as they see the normal exit url link when hovering over the link, and the webmaster is happy because they can track the exit counts.