We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3959aa4 commit d0e57d8Copy full SHA for d0e57d8
audienceproject-data-web.js
@@ -588,11 +588,17 @@ export const utils = {
588
sendDataToGooglePublisherTag: (data) => {
589
window.googletag = window.googletag || { cmd: [] };
590
591
- window.googletag.cmd.push(() => {
+ const setTargeting = () => {
592
Object.keys(data.keyValues).forEach((key) => {
593
window.googletag.pubads().setTargeting(key, data.keyValues[key]);
594
});
595
- });
+ };
596
+
597
+ if (window.googletag.cmd.unshift) { // put in front of queue when possible
598
+ window.googletag.cmd.unshift(setTargeting);
599
+ } else { // native array method is not available if queue was processed
600
+ window.googletag.cmd.push(setTargeting);
601
+ }
602
},
603
};
604
0 commit comments