How dangerous is e.preventDefault();, and can it be replaced by keydown/mousedown tracking?

前端 未结 7 1814
隐瞒了意图╮
隐瞒了意图╮ 2021-02-04 17:51

I\'m working on a tracking script for a fairly sophisticated CRM for tracking form actions in Google Analytics. I\'m trying to balance the desire to track form actions accuratel

7条回答
  •  伪装坚强ぢ
    2021-02-04 18:39

    Another approach:

    var pageTracker;
    _gaq.push(function() {
        pageTracker = _gat._getTrackerByName();
    });
    
    $('form').submit(function(e){
        pageTracker._trackEvent('Form', 'Submit', $(this).attr('action'));
    };
    

    I would guess this way _trackEvent would be synchronous but I haven't tested it.

提交回复
热议问题