why this JS:
<script type="text/javascript">
$(function() {
$('a[href$=".pdf"]').prop('onClick', '_gaq.push(["_trackEvent", "Pdf", "Download", "Download_pdf"]);');
});
</script>
doesn't work? is there any quotes errors?
The script should find all the a tags with href ending in .pdf and adds to it the onClick attribute with the value that follows (Google Analytics Event), but in Chrome Developer Tool Console appears this error:
Uncaught SyntaxError: Unexpected token <(…)
is there any syntax error?