Skip to content

Commit ce7281a

Browse files
authored
[DEST-1289] Support keyword on Comscore (#277)
* Add support for comscore keyword * Update unit tests * Update package.json and history
1 parent 8f7f1a4 commit ce7281a

File tree

4 files changed

+28
-7
lines changed

4 files changed

+28
-7
lines changed

integrations/comscore/HISTORY.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
2.0.4 / 2018-01-24
1+
2.0.5 / 2019-11-25
22
==================
33

4-
* Ladan made a mistake, see 2.0.3 for changes.
4+
* Adds support for `comscorekw` parameter
5+
* Leverages new destination config setting `comscorekw` to assign value to `comscorekw` query parameter
6+
57

68
2.0.3 / 2018-01-24
79
==================

integrations/comscore/lib/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ var Comscore = (module.exports = integration('comScore')
1616
.global('COMSCORE')
1717
.option('c1', '2')
1818
.option('c2', '')
19+
.option('comscorekw', '')
1920
.tag('http', '<script src="http://b.scorecardresearch.com/beacon.js">')
2021
.tag('https', '<script src="https://sb.scorecardresearch.com/beacon.js">'));
2122

@@ -85,6 +86,9 @@ Comscore.prototype.mapComscoreParams = function(page) {
8586

8687
comScoreParams.c1 = this.options.c1;
8788
comScoreParams.c2 = this.options.c2;
89+
if (this.options.comscorekw.length) {
90+
comScoreParams.comscorekw = this.options.comscorekw;
91+
}
8892

8993
return comScoreParams;
9094
};

integrations/comscore/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@segment/analytics.js-integration-comscore",
33
"description": "The Comscore analytics.js integration.",
4-
"version": "2.0.4",
4+
"version": "2.0.5",
55
"keywords": [
66
"analytics.js",
77
"analytics.js-integration",

integrations/comscore/test/index.test.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ describe('comScore', function() {
1111
var comscore;
1212
var options = {
1313
c2: 'x',
14+
comscorekw: 'test',
1415
autoUpdateInterval: '',
1516
beaconParamMap: {
1617
exampleParam: 'c5',
@@ -40,6 +41,7 @@ describe('comScore', function() {
4041
.global('_comscore')
4142
.option('c1', '2')
4243
.option('c2', '')
44+
.option('comscorekw', '')
4345
);
4446
});
4547

@@ -77,19 +79,32 @@ describe('comScore', function() {
7779
});
7880

7981
it('should call only on 2nd page', function() {
80-
analytics.didNotCall(window.COMSCORE.beacon, { c1: '2', c2: 'x' });
82+
analytics.didNotCall(window.COMSCORE.beacon, {
83+
c1: '2',
84+
c2: 'x',
85+
comscorekw: 'test'
86+
});
8187
analytics.page();
82-
analytics.called(window.COMSCORE.beacon, { c1: '2', c2: 'x' });
88+
analytics.called(window.COMSCORE.beacon, {
89+
c1: '2',
90+
c2: 'x',
91+
comscorekw: 'test'
92+
});
8393
});
8494

8595
it('should map properties in beaconParamMap', function() {
86-
analytics.didNotCall(window.COMSCORE.beacon, { c1: '2', c2: 'x' });
96+
analytics.didNotCall(window.COMSCORE.beacon, {
97+
c1: '2',
98+
c2: 'x',
99+
comscorekw: 'test'
100+
});
87101
analytics.page({ exampleParam: 'foo', anotherParam: 'bar' });
88102
analytics.called(window.COMSCORE.beacon, {
89103
c1: '2',
90104
c2: 'x',
91105
c5: 'foo',
92-
c6: 'bar'
106+
c6: 'bar',
107+
comscorekw: 'test'
93108
});
94109
});
95110
});

0 commit comments

Comments
 (0)