Access to failed XHR object?


(Krypternite) #1

Does Piwik provide a status for when a request to the Piwik server has failed, like in case of being blocked by an AdBlocker. This can be helpful in asking the users to disable blockers.

Thanks


(Fabian Dellwing) #2

It might work to just listen to the global ajax status, but I’m not sure and have not tested it. We ourself simply check if the JS itself gets loaded.

<!-- AdBlock Detection Start -->
<script defer="defer" type="text/javascript" src="../include/js/adblock_detection/piwik.js" onerror="$('#msg_blocker').removeClass('hidden');"></script>
<script defer="defer" type="text/javascript" src="../include/js/adblock_detection/_advertisement.js" onerror="$('#msg_blocker').removeClass('hidden');"></script>
<script defer="defer" type="text/javascript" src="../include/js/adblock_detection/ads.js?" onerror="$('#msg_blocker').removeClass('hidden');"></script>
<!-- AdBlock Detection End -->