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