From ad6dc1a23faf127250a7cbab6c4ad9e9b0c55019 Mon Sep 17 00:00:00 2001 From: Robert Hall Date: Mon, 6 Feb 2023 17:10:50 -0600 Subject: [PATCH 1/3] Google Ads (GTag): add support for doubleclick floodlight id --- integrations/google-adwords-new/lib/index.js | 4 ++++ integrations/google-adwords-new/test/index.test.js | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/integrations/google-adwords-new/lib/index.js b/integrations/google-adwords-new/lib/index.js index 19e77b11e..e0f6e8f36 100644 --- a/integrations/google-adwords-new/lib/index.js +++ b/integrations/google-adwords-new/lib/index.js @@ -55,7 +55,11 @@ GoogleAdWordsNew.prototype.initialize = function() { if (self.options.disableAdPersonalization) window.gtag('set', 'allow_ad_personalization_signals', false); + if (self.options.floodlightAccountId) { + window.gtag('config', self.options.floodlightAccountId, config); + } window.gtag('config', self.options.accountId, config); + self.ready(); }); }; diff --git a/integrations/google-adwords-new/test/index.test.js b/integrations/google-adwords-new/test/index.test.js index a18ef0c86..eccb7ecb1 100644 --- a/integrations/google-adwords-new/test/index.test.js +++ b/integrations/google-adwords-new/test/index.test.js @@ -150,6 +150,18 @@ describe('Google AdWords New', function() { analytics.initialize(); analytics.spy(window, 'gtag'); }); + + it('should support Doubleclick Floodlight account if provided', function(done) { + var floodlightAccountId = 'DC-1234567'; + googleadwordsnew.options.floodlightAccountId = floodlightAccountId; + analytics.once('ready', function() { + analytics.deepEqual(window.gtag.args[1], ['config', floodlightAccountId, {}]); + analytics.deepEqual(window.gtag.args[2], ['config', options.accountId, {}]); + done(); + }); + analytics.initialize(); + analytics.spy(window, 'gtag'); + }); }); describe('after loading', function() { From 06e13b1ded830673d5b112f3c00848ea6626aae8 Mon Sep 17 00:00:00 2001 From: Robert Hall Date: Tue, 7 Feb 2023 16:13:17 -0600 Subject: [PATCH 2/3] nit: add floodlightAccountId as an option to the initializer --- integrations/google-adwords-new/lib/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/integrations/google-adwords-new/lib/index.js b/integrations/google-adwords-new/lib/index.js index e0f6e8f36..39317b99f 100644 --- a/integrations/google-adwords-new/lib/index.js +++ b/integrations/google-adwords-new/lib/index.js @@ -22,6 +22,7 @@ var GoogleAdWordsNew = (module.exports = integration('Google AdWords New') .option('pageLoadConversions', []) .option('defaultPageConversion', '') .option('disableAdPersonalization', false) + .option('floodlightAccountId', '') // The ID in this line (i.e. the gtag.js ID) does not determine which account(s) will receive data from the tag; rather, it is used to uniquely identify your global site tag. Which account(s) receive data from the tag is determined by calling the config command (and by using the send_to parameter on an event). For instance, if you use Google Analytics, you may already have the gtag.js global site tag installed on your site. In that case, the gtag.js ID may be that of the Google Analytics property where you first obtained the snippet. .tag( '