Closed darimay closed 3 years ago
@nealmalkaniwapo
We've run into an issue caused by this merge. I've provided more details in the original PR: https://github.com/washingtonpost/ArcAds/pull/83
@darimay 4.0.1 has been released to address this issue
Hi,
I'm with CMG and I've noticed the following bug with ArcAds that is impacting ads revenue for us.
Expected Behavior
The resize based
fetchBids
/refreshSlot
requests should trigger only when the page is resized beyond a breakpoint.Actual Behavior
The resize based
fetchBids
/refreshSlot
requests are triggered on firstresize
event on the page regardless of window width (Sometimes theresize
event is triggered by the browser on page load, without any actual change in the window's width, however, this is not an ArcAds bug, but it certainly exacerbates the ArcAds bug described).Steps to Reproduce the Behavior in Chrome
/gampad.+hp01/
for theHP01
slot or any other slot on the page.Additional Comments
When a user resizes the window's width for the first time after page load, the callback produced by runResizeEvents should only fire if the width change is past a breakpoint, as described in the docs for the function:
However, because the initial value of
lastBreakpoint
isundefined
, then thelastBreakpoint !== breakpoint
condition is satisfied as well as(width > breakpoint && (width < nextBreakpoint || !nextBreakpoint)
for onebreakpoint
in [0, 768, 1024] on this line.As a result
fetchBids
/refreshSlot
is triggered unnecessarily leading to unnecessary ad requests for each ad slot.Note that once
lastBreakpoint
is set after the initial call, this incorrect behavior goes away.But to make matters worse, some desktop browsers trigger a
resize
event on the window after page load and becauserunResizeEvents
is added to the window'sresize
EventListener, all ad slot requests are doubled, once on page load, and once on the subsequent unexpectedresize
event on the window that follows.I have created the following Pull Request to address the issue: https://github.com/washingtonpost/ArcAds/pull/83.
Please advise on how we should proceed.