With native ads, we have full control over the placement and style of the button that handles the click event. However, the plugin requires a scroll listener and a coordinates event to fire the click handler. It would be much more efficient and less weighty if there was a simple JS method that would directly call the fireAdEvent(EVENT_AD_LEAVEAPP, ADTYPE_BANNER); event. For example:
var clickHandler = document.getElementById('native_ad_button'); clickHandler.addEventListener('click', function() { FacebookAds.fireEvent(); });
If the coordinates are critical it could be updated to simply capture the x/y of the click event and pass that in as well.
With native ads, we have full control over the placement and style of the button that handles the click event. However, the plugin requires a scroll listener and a coordinates event to fire the click handler. It would be much more efficient and less weighty if there was a simple JS method that would directly call the
fireAdEvent(EVENT_AD_LEAVEAPP, ADTYPE_BANNER);
event. For example:var clickHandler = document.getElementById('native_ad_button'); clickHandler.addEventListener('click', function() { FacebookAds.fireEvent(); });
If the coordinates are critical it could be updated to simply capture the x/y of the click event and pass that in as well.