From 0b2693481ca54e1e7ecf19aeac0c4e85f639062a Mon Sep 17 00:00:00 2001 From: Miguel Peixe Date: Mon, 19 Aug 2024 09:01:15 -0300 Subject: [PATCH 1/2] fix: add 1x1 size to all viewports for ad units that supports it (#891) --- includes/providers/gam/class-gam-model.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/includes/providers/gam/class-gam-model.php b/includes/providers/gam/class-gam-model.php index a0cd7771..0ab06569 100644 --- a/includes/providers/gam/class-gam-model.php +++ b/includes/providers/gam/class-gam-model.php @@ -826,6 +826,11 @@ public static function get_responsive_size_map( $sizes, $width_diff_ratio = 0.3, $size_map = []; foreach ( $viewports as $viewport_width ) { foreach ( $sizes as $size ) { + // If size is 1x1, we want it in all viewports. + if ( 1 === $size[0] && 1 === $size[1] ) { + $size_map[ $viewport_width ][] = $size; + continue; + } $is_in_viewport = $size[0] <= $viewport_width; $is_above_threshold = false !== $width_threshold && $width_threshold <= $size[0]; if ( 0 === $size[0] ) { @@ -875,13 +880,6 @@ public static function get_ad_unit_size_map( $ad_unit, $sizes = [] ) { $size_map = self::get_responsive_size_map( $sizes, $width_diff_ratio, $width_threshold ); - // Add 1x1 size to all viewports. - foreach ( $size_map as $viewport => $sizes ) { - if ( ! in_array( [ 1, 1 ], $sizes, true ) ) { - array_unshift( $size_map[ $viewport ], [ 1, 1 ] ); - } - } - /** * Filters the ad unit size map rules. * From 25c128f2d97d1983e843538e01a6491ce837f54f Mon Sep 17 00:00:00 2001 From: matticbot Date: Mon, 19 Aug 2024 12:03:38 +0000 Subject: [PATCH 2/2] chore(release): 3.0.2 [skip ci] ## [3.0.2](https://github.com/Automattic/newspack-ads/compare/v3.0.1...v3.0.2) (2024-08-19) ### Bug Fixes * add 1x1 size to all viewports for ad units that supports it ([#891](https://github.com/Automattic/newspack-ads/issues/891)) ([0b26934](https://github.com/Automattic/newspack-ads/commit/0b2693481ca54e1e7ecf19aeac0c4e85f639062a)) --- CHANGELOG.md | 7 +++++++ newspack-ads.php | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b4f1246f..f49f7b16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [3.0.2](https://github.com/Automattic/newspack-ads/compare/v3.0.1...v3.0.2) (2024-08-19) + + +### Bug Fixes + +* add 1x1 size to all viewports for ad units that supports it ([#891](https://github.com/Automattic/newspack-ads/issues/891)) ([0b26934](https://github.com/Automattic/newspack-ads/commit/0b2693481ca54e1e7ecf19aeac0c4e85f639062a)) + ## [3.0.1](https://github.com/Automattic/newspack-ads/compare/v3.0.0...v3.0.1) (2024-08-15) diff --git a/newspack-ads.php b/newspack-ads.php index 9b97a238..a95fd19f 100755 --- a/newspack-ads.php +++ b/newspack-ads.php @@ -5,7 +5,7 @@ * Description: Ad services integration. * Author: Automattic * License: GPL2 - * Version: 3.0.1 + * Version: 3.0.2 * * @package Newspack */ diff --git a/package-lock.json b/package-lock.json index bc83a0c3..d448e12a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "newspack-ads", - "version": "3.0.1", + "version": "3.0.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "newspack-ads", - "version": "3.0.1", + "version": "3.0.2", "license": "GPL-3.0-or-later", "dependencies": { "newspack-components": "^3.0.0", diff --git a/package.json b/package.json index 1bb16392..6a24fe8b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "newspack-ads", - "version": "3.0.1", + "version": "3.0.2", "author": "Automattic", "private": true, "scripts": {