Skip to content

Commit caf92b2

Browse files
matthewlaneNate Cozi
authored and
Nate Cozi
committed
Reset hb_* keys only for registered aduniits (#934)
1 parent 509272b commit caf92b2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/targeting.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ targeting.resetPresetTargeting = function() {
1010
if (isGptPubadsDefined()) {
1111
window.googletag.pubads().getSlots().forEach(slot => {
1212
pbTargetingKeys.forEach(function(key){
13-
slot.setTargeting(key,null);
13+
// reset only registered adunits
14+
$$PREBID_GLOBAL$$.adUnits.find(function(unit) {
15+
if (unit.code === slot.getAdUnitPath() ||
16+
unit.code === slot.getSlotElementId()) {
17+
slot.setTargeting(key, null);
18+
}
19+
});
1420
});
1521
});
1622
}

0 commit comments

Comments
 (0)