Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have been using the pubads().refresh() method to load only certain ad slots at different view port widths. In order to do this I have had to save the googletag.defineSlot declaration to a global variable.
To accompany this I have also added an option to the global settings to disable ads on initial load so that they can be "refreshed" whenever required. (e.g. on an orientation change) Patch attached.
Comments
Comment #1
chriskinch CreditAttribution: chriskinch commentedJust adding a quick amend so that the disableInitialLoad() is not automatically on when patch is first applied.
Comment #2
bleen CreditAttribution: bleen commentedIf this is for async only, why not use #states to only show this checkbox if async is checked
I'm not a big fan of creating a global var here ... cant we use the googletag object to store these values?
Comment #3
chriskinch CreditAttribution: chriskinch commentedHey
Attached is an updated patch based on your comments.
I am now using states to enable/disable the checkbox rather then hide as it might be nice for people to see that the option is there.
I have also added the slots definitions to the googletag object.
Comment #4
bleen CreditAttribution: bleen commentedI like it, thanks!! .... added