Skip to content

Commit

Permalink
refactor: Check for updateCorrelator (#9)
Browse files Browse the repository at this point in the history
Check for deprecated updateCorrelator method before calling
  • Loading branch information
andrewb authored and andrew-sotiriou committed Dec 18, 2023
1 parent 9fd005d commit 327fd47
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/createManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,14 @@ export class AdManager extends EventEmitter {
if (!this.pubadsReady) {
return false;
}
this.googletag.pubads().updateCorrelator();

// Note, `updateCorrelator` has been deprecated. This is a short-term patch
// to ensure the method will not be called when it is removed from GPT.
// A better fix to come...
if ("updateCorrelator" in this.googletag.pubads()) {
this.googletag.pubads().updateCorrelator();
} else {
console.warn("Ad: `updateCorrelator` has been removed from GPT");
}
return true;
}

Expand Down

0 comments on commit 327fd47

Please sign in to comment.