I am using http://bit.ly/5NNAIa, and I have it tracking an outbound link, but I want my page to be valid.
This is the error I am getting: There is no "OnCick" attribute
The HTML is:
<p>View some of our student produced videos
on <a href="http://www.youtube.com/user/johndoe" onClick="javascript: pageTracker._trackPageview('/outgoing/youtube.com/user/johndoe');" rel="external">YouTube!</a></p>
I added this do my js embed file, to track all outgoing links
$(document).ready(function() {
$('a[href^=http]:not("[href*=://' + document.domain + ']")').click(function() {
pageTracker._trackPageview('/out/'+$(this).attr("href"));
});
});
So now my js embed file looks like this below. I notice I call $(document).read(function() { at the beginning of both snippets, should they both go into one?
$(document).ready(function() {
// opens links into separate window
$('A[rel="external"]').click( function() {
window.open( $(this).attr('href') );
return false;
});
});
$(document).ready(function() {
$('a[href^=http]:not("[href*=://' + document.domain + ']")').click(function() {
pageTracker._trackPageview('/out/'+$(this).attr("href"));
});
});