Attaching Google Event Tracking to AutoComplete search results
I'm working with Google Analtics event tracking. I have 2 questions.
1. If I trigger google analytics events from within the Page HitBox content, will this work okay with how Lithium is set up? Do I need to do anything special to get it to to work?
2. I'd like to fire custom Google Analytics Events when a user clicks on the auto-suggest results. In the Metrics, this is defined as "Auto-suggest click-through". I think the Event is being prevented from firing by the Lithium script that redirects the user to the post they clicked.
Here's a screenshot of the links: http://screencast.com/t/dc5KSQVTDL
This is the closest I got:
//Tracks click-throughs via Google Analytics
$(document).on("click", "#lia-body .lia-content .custom-search-wrapper .lia-autocomplete-container ul li a" ,function(){
var category = $(".custom-search-wrapper .search-granularity option:selected").val().split('|')[0];
_gaq.push(['_trackEvent', 'SearchAskComponent', category, 'clickThrough']);
//});
Any tips on getting the custom event to fire would be much appreciated.