As someone working in adtech, some of the megabytes of JS you get sent involves viewability tracking to catch stuff like this. Sometimes you'll even have two or more copies, one from the advertiser and some from the companies in between.
No major advertiser actually trusts what publishers claim - even the big ones like FB and YouTube though they are much less likely to be actively gaming you. That's why there's a lot of tracking JS in pages for viewability to catch stuff like this.