Skip to content

Commit dca45f8

Browse files
authored
STRATCONN-1287 - Add support for DoubleClick Floodlight config in in Google Ads (GTag) (#730)
* Google Ads (GTag): add support for doubleclick floodlight id * nit: add floodlightAccountId as an option to the initializer * bump package.json for google ads
1 parent 2677648 commit dca45f8

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

Diff for: integrations/google-adwords-new/HISTORY.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
1.3.0 / 2023-02-08
2+
==================
3+
* Introduces a new setting `floodlightAccountId` to enable passing the DoubleClick Floodlight config ID to GTag's `config` to allow better synergy between these two products.
4+
15
1.2.0 / 2020-02-18
26
==================
37

4-
* Introduces a new setting `disableAdPersonalization` to disable collection of remarketing data for users who do not wish to view personalized ads. When this settiing is `true`, Segment will set `allow_ad_personalization_signals` to false.
8+
* Introduces a new setting `disableAdPersonalization` to disable collection of remarketing data for users who do not wish to view personalized ads. When this setting is `true`, Segment will set `allow_ad_personalization_signals` to false.
59

610
1.1.1 / 2019-12-09
711
==================

Diff for: integrations/google-adwords-new/lib/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ var GoogleAdWordsNew = (module.exports = integration('Google AdWords New')
2222
.option('pageLoadConversions', [])
2323
.option('defaultPageConversion', '')
2424
.option('disableAdPersonalization', false)
25+
.option('floodlightAccountId', '')
2526
// 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.
2627
.tag(
2728
'<script src="https://www.googletagmanager.com/gtag/js?id={{ accountId }}">'
@@ -55,7 +56,11 @@ GoogleAdWordsNew.prototype.initialize = function() {
5556
if (self.options.disableAdPersonalization)
5657
window.gtag('set', 'allow_ad_personalization_signals', false);
5758

59+
if (self.options.floodlightAccountId) {
60+
window.gtag('config', self.options.floodlightAccountId, config);
61+
}
5862
window.gtag('config', self.options.accountId, config);
63+
5964
self.ready();
6065
});
6166
};

Diff for: integrations/google-adwords-new/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@segment/analytics.js-integration-google-adwords-new",
33
"description": "The google-adwords-new analytics.js integration.",
4-
"version": "1.2.1",
4+
"version": "1.3.0",
55
"keywords": [
66
"analytics.js",
77
"analytics.js-integration",

Diff for: integrations/google-adwords-new/test/index.test.js

+12
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,18 @@ describe('Google AdWords New', function() {
150150
analytics.initialize();
151151
analytics.spy(window, 'gtag');
152152
});
153+
154+
it('should support Doubleclick Floodlight account if provided', function(done) {
155+
var floodlightAccountId = 'DC-1234567';
156+
googleadwordsnew.options.floodlightAccountId = floodlightAccountId;
157+
analytics.once('ready', function() {
158+
analytics.deepEqual(window.gtag.args[1], ['config', floodlightAccountId, {}]);
159+
analytics.deepEqual(window.gtag.args[2], ['config', options.accountId, {}]);
160+
done();
161+
});
162+
analytics.initialize();
163+
analytics.spy(window, 'gtag');
164+
});
153165
});
154166

155167
describe('after loading', function() {

0 commit comments

Comments
 (0)