'fbevents.js and unload listener - How to maintain Back/Forward cache capabilities?

When called, Facebook Pixel's integration registers an unload event, which is strongly discouraged as it breaks the back/forward caching mechanism.

This can be see here and also verified with a Google Lighthouse audit: https://connect.facebook.net/en_US/fbevents.js

g.addEventListener("unload",function(){return m.forceEndBatch()});

Is there any way to use Facebook's integration with a lighter footprint and no unload event?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source