mickey / videojs-ga

Google Analytics plugin for video.js
MIT License
138 stars 109 forks source link

How to extend/replace the sendbeacon function? #36

Open michalrames opened 7 years ago

michalrames commented 7 years ago

Hi,

This is a JS-noob question but I'm hoping someone can point me in the right direction.

I'd like to intercept the sendbeacon() function (reason: custom auditing, adblocked GA, etc...).

Can you advise on the correct way of doing that please? I tried

 player.ga().sendbeacon = function(action, nonInteraction, value) {
        console.log('intercepted');
    };

but that doesn't work.

Thanks

Michal