Trying to do two things:
1) Look for links that have the class “download” attached.
2) If so, add some Google Event Tracking code to the link
As a means of testing, here’s what I have thus far:
<a href="#" class="download">Test</a>
$(document).ready(function(e) {
if ($(a).is('.download')){
$(a).append('onclick="_gaq.push(['_trackEvent', 'Podcasts', 'Download', 'Title']);"');
}
}
Can’t seem to get this to work, althought I think (hope) I have the right idea. Any suggestions?
Thanks in advance!
1 Answer