Refresh Interval filter
jeffpaul opened this issue · 1 comments
Is your enhancement related to a problem? Please describe.
Received the following request via email:
We are looking to find a way to modify the setting ‘Refresh Interval’ on the ‘Ad Refresh Control’ plugin https://github.com/10up/Ad-Refresh-Control/. The specific line we want to modify is on the file https://github.com/10up/Ad-Refresh-Control/blob/develop/includes/settings.php line 249.
Ad-Refresh-Control/includes/settings.php
Line 249 in aef9926
We need to be able to set a value of 20 - 25 on that interval refresh setting. Do you think that is something 10Up may consider doing on that plugin?
Describe the solution you'd like
In discussing with @davidrgreen there is concern "that we put a minimum of 30 seconds there because advertisers tend to view refreshes less than 30 seconds as too aggressive and it can end up ultimately hurting the publisher's relationship with the advertiser and thus revenue. Google for instance only allows down to 30 seconds as well, https://support.google.com/admanager/answer/6022114. If this is absolutely necessary, I would be more open to adding a filter in the code so that a developer can override the setting with the filter using code in order to use a lower value. That way at least a very conscious decision would have to be made to choose the lower value, and publishers who install the plugin cannot so easily choose a value less than 30 which would put them in a potentially dangerous spot."
So let's look at a filter here with specific recommendation in the docblock and readme that we strongly recommend not going below 30 seconds.
Designs
Describe alternatives you've considered
Additional context
Adding the documentation
label for us to collate some of @davidrgreen's details into an FAQ item in the readmes:
The interval between refreshes is based on the Refresh Interval value from the settings page. In a nutshell, we track how long an ad has been viewable on screen in half second increments, and then once an ad meets that Refresh Interval value we refresh it. If you left an ad viewable on the screen then the time between each refresh would be no more than a half second more than the Refresh Interval you specify, outside of a handful of millisecond differences because of JavaScript internals or some expensive JavaScript tying up everything on your page and preventing it from running.
If you're interested in the detailed explanation, we store some key information around each ad slot and then listen to updates to events Google's own ad code runs itself to collect further information like what percentage of the ad is viewable on screen, when it refreshes, etc. Then every half second we check to see what all ads are viewable on the page, meaning their current viewability percentage is at least equal to the Viewability Threshold from the settings screen. To avoid being a performance burden we rely on the viewability information Google's code already collects, so running this every half second is not a big deal even on an old mobile phone. For each of those viewable ads we increment a counter by one half second. Then we check to see if any ad has been viewable at least as long as the Refresh Interval value. For all those ads, we refresh them and reset the counter tracking how long they have been viewable.