문제

I got a issue with google analytics event track. The onclick event is only wokring in mozilla and internet explorer, i use a class on each buton "ga-track" and on the onclick event i send the ga.push track. I try switching between universal analytics and but it doesnt work

jQuery('.ga-track').on("click", function(){
    var theHREF = jQuery(this).attr('href');      
    _gaq.push(['_trackEvent', 'media', 'download', theHREF]);
});

Any clue?

도움이 되었습니까?

해결책

Could be that the event has enough time to send in Mozilla, but not in WebKit.

Try using hitCallback which will wait until the event is sent before the next page loads:

jQuery('.ga-track-isa').on('click', function(e){
    e.preventDefault();
    var theHREF = jQuery(this).attr('href');

    _gaq.push(['_set', 'hitCallback', function(){
        window.location.href = theHREF;
    }]);

    _gaq.push(['_trackEvent', 'media', 'download', theHREF]);
}); 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top