I am using google analytical code for track pdf click event. I am using this code
<script type="text/javascript">
jQuery(function($) {
jQuery(‘a[href$=".pdf"]’).click(function(){
var pdf=jQuery(this).attr(‘href’);
ga(‘send’,’event’, ‘pdf’, ‘download’, pdf);
});
});
</script>
But I am facing Uncaught SyntaxError: Invalid or unexpected token on line
jQuery(‘a[href$=".pdf"]’).click(function(){
Can anyone help me for this.
The single quote(‘) you are using looks like the problem in the code. I tried the same code with this single quote('), it's working fine. Try below-written code, it works fine.
The error will keep coming up because, in all your code, these italic quotes are used. Maybe you need to change your keyboard settings.