adding google event tracking to links in posts

I am trying to add outbound link tracking for links within my posts. But only for links that do not have an img as a child. My code is below but does not add my class to any links in my posts:

    //outbound post links
    //var outbound_post_name = jQuery(this).find('h2.title').text();
    var post_link = jQuery('.post .entry').find('a');
        if( jQuery(post_link).has('img') ){
            //do not add class or tracking if the link has an img
                _gaq.push(['_trackEvent', 'Outbound Link', 'Click', outbound_post_name + 'Post Link', '', false]);

I also need to get the post title for my label but am unsure of how to get it set as “outbound_post_name”.

If I remove the “if” statement all links get the class “outbound-link” What am I missing?


Solutions Collecting From Web of "adding google event tracking to links in posts"