1 <script type="text/javascript">
2 // Set this to the URL you used to fetch recommendations, whether you
3 // fetched them on the client or the server.
4 var request_url = '%(json_url)s';
6 // This function is used track click-throughs by fetching a web
8 function trackClickThrough(elem) {
10 img.src = '%(beacon_url)s' +
11 '?request_url=' + escape(request_url) +
12 '&click_through_url=' + escape(elem.href);
19 Imagine this is one of the recommendations that was returned.
20 Just add an onclick handler that calls trackClickThrough.
22 <a href="http://www.google.com"
23 onclick="return trackClickThrough(this);">Click me!</a>