This question refers to affiliate marketing, but really is a generic question about intercepting hyperlinks before they go off to another site, where you can log visitor activity to a database.
My affiliate marketing client had a really good question. Imagine a scenario where you have products pulled back from Amazon over its API, given a seed keyword. Now imagine a visitor clicks one of those products to view it on Amazon. The URL for that product might look like this (and this is just a demo):
http://www.amazon.com/dp/B0042RU3Y0/?tag=xxxxxxxxxxxxxxxx-20
But guess what's wrong with that? It's not passing that seed keyword. So, we have no idea which seed keywords were the most effective. Instead, she was wishing we could pass the following and then track that somehow:
http://www.amazon.com/dp/B0042RU3Y0/?tag=xxxxxxxxxxxxxxxx-20&seed=laptops
I didn't see any docs on Amazon where we could pass extra params and then track them in the reports by a filter.
So, the only thing I could think of is that we need to capture the click before it goes off to Amazon. In other words, before that event bubbles up and is executed, somehow in jQuery I can intercept it first, parse the href URL for that hyperlink, tack on this extra seed keyword information, send it over AJAX back to a PHP page and a database table, and then release that click event so that it is executed and the browser goes off to Amazon.
Does anyone know how this is done in jQuery? I know the AJAX part -- just not the click intercept part that grabs the click, then releases it.