From 44993e15dce9a79ebda9e8a9e9f51bbd21dfa805 Mon Sep 17 00:00:00 2001 From: David Andersen Date: Mon, 25 Nov 2019 14:11:58 -0500 Subject: [PATCH 1/5] Hardcode sync endpoint protocol --- modules/tripleliftBidAdapter.js | 2 +- .../spec/modules/tripleliftBidAdapter_spec.js | 24 ++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/modules/tripleliftBidAdapter.js b/modules/tripleliftBidAdapter.js index d49e4cde480..1f045367669 100644 --- a/modules/tripleliftBidAdapter.js +++ b/modules/tripleliftBidAdapter.js @@ -63,7 +63,7 @@ export const tripleliftAdapterSpec = { }, getUserSyncs: function(syncOptions) { - let ibCall = '//ib.3lift.com/sync?'; + let ibCall = 'https://ib.3lift.com/sync?'; if (consentString !== null) { ibCall = utils.tryAppendQueryString(ibCall, 'gdpr', gdprApplies); ibCall = utils.tryAppendQueryString(ibCall, 'cmp_cs', consentString); diff --git a/test/spec/modules/tripleliftBidAdapter_spec.js b/test/spec/modules/tripleliftBidAdapter_spec.js index 12a2f66dde2..afa427ef7ae 100644 --- a/test/spec/modules/tripleliftBidAdapter_spec.js +++ b/test/spec/modules/tripleliftBidAdapter_spec.js @@ -5,6 +5,7 @@ import { deepClone } from 'src/utils'; import prebid from '../../../package.json'; const ENDPOINT = 'https://tlx.3lift.com/header/auction?'; +const GDPR_CONSENT_STR = 'BOONm0NOONm0NABABAENAa-AAAARh7______b9_3__7_9uz_Kv_K7Vf7nnG072lPVA9LTOQ6gEaY'; describe('triplelift adapter', function () { const adapter = newBidder(tripleliftAdapterSpec); @@ -107,7 +108,7 @@ describe('triplelift adapter', function () { referer: 'http://examplereferer.com' }, gdprConsent: { - consentString: 'BOONm0NOONm0NABABAENAa-AAAARh7______b9_3__7_9uz_Kv_K7Vf7nnG072lPVA9LTOQ6gEaY', + consentString: GDPR_CONSENT_STR, gdprApplies: true }, }; @@ -281,7 +282,7 @@ describe('triplelift adapter', function () { referer: 'http://examplereferer.com' }, gdprConsent: { - consentString: 'BOONm0NOONm0NABABAENAa-AAAARh7______b9_3__7_9uz_Kv_K7Vf7nnG072lPVA9LTOQ6gEaY', + consentString: GDPR_CONSENT_STR, gdprApplies: true } }; @@ -355,7 +356,7 @@ describe('triplelift adapter', function () { referer: 'http://examplereferer.com' }, gdprConsent: { - consentString: 'BOONm0NOONm0NABABAENAa-AAAARh7______b9_3__7_9uz_Kv_K7Vf7nnG072lPVA9LTOQ6gEaY', + consentString: GDPR_CONSENT_STR, gdprApplies: true } }; @@ -363,4 +364,21 @@ describe('triplelift adapter', function () { expect(result).to.have.length(2); }); }); + + describe('getUserSyncs', function() { + let expectedSyncUrl = 'https://ib.3lift.com/sync?gdpr=true&cmp_cs=' + GDPR_CONSENT_STR + '&'; + + it('returns undefined when syncing is not enabled', function() { + expect(tripleliftAdapterSpec.getUserSyncs({})).to.equal(undefined); + }); + + it('returns iframe user sync pixel when iframe syncing is enabled', function() { + let syncOptions = { + iframeEnabled: true + }; + let result = tripleliftAdapterSpec.getUserSyncs(syncOptions); + expect(result[0].type).to.equal('iframe'); + expect(result[0].url).to.equal(expectedSyncUrl); + }); + }); }); From b0adb54ad8beab0014b7e427d94a8f34a1b09af5 Mon Sep 17 00:00:00 2001 From: David Andersen Date: Mon, 25 Nov 2019 14:28:41 -0500 Subject: [PATCH 2/5] Switch to EB2 sync endpoint --- modules/tripleliftBidAdapter.js | 2 +- test/spec/modules/tripleliftBidAdapter_spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/tripleliftBidAdapter.js b/modules/tripleliftBidAdapter.js index 1f045367669..071f12046de 100644 --- a/modules/tripleliftBidAdapter.js +++ b/modules/tripleliftBidAdapter.js @@ -63,7 +63,7 @@ export const tripleliftAdapterSpec = { }, getUserSyncs: function(syncOptions) { - let ibCall = 'https://ib.3lift.com/sync?'; + let ibCall = 'https://eb2.3lift.com/sync?'; if (consentString !== null) { ibCall = utils.tryAppendQueryString(ibCall, 'gdpr', gdprApplies); ibCall = utils.tryAppendQueryString(ibCall, 'cmp_cs', consentString); diff --git a/test/spec/modules/tripleliftBidAdapter_spec.js b/test/spec/modules/tripleliftBidAdapter_spec.js index afa427ef7ae..0179b211517 100644 --- a/test/spec/modules/tripleliftBidAdapter_spec.js +++ b/test/spec/modules/tripleliftBidAdapter_spec.js @@ -366,7 +366,7 @@ describe('triplelift adapter', function () { }); describe('getUserSyncs', function() { - let expectedSyncUrl = 'https://ib.3lift.com/sync?gdpr=true&cmp_cs=' + GDPR_CONSENT_STR + '&'; + let expectedSyncUrl = 'https://eb2.3lift.com/sync?gdpr=true&cmp_cs=' + GDPR_CONSENT_STR + '&'; it('returns undefined when syncing is not enabled', function() { expect(tripleliftAdapterSpec.getUserSyncs({})).to.equal(undefined); From 0c6c2952dca494cc3bb9bee35e10d6df26e4d503 Mon Sep 17 00:00:00 2001 From: David Andersen Date: Mon, 25 Nov 2019 17:01:32 -0500 Subject: [PATCH 3/5] Add support for image based user syncing --- modules/tripleliftBidAdapter.js | 25 ++++++++++++++----- .../spec/modules/tripleliftBidAdapter_spec.js | 24 ++++++++++++++++-- 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/modules/tripleliftBidAdapter.js b/modules/tripleliftBidAdapter.js index 071f12046de..1ebaaa1c440 100644 --- a/modules/tripleliftBidAdapter.js +++ b/modules/tripleliftBidAdapter.js @@ -63,21 +63,34 @@ export const tripleliftAdapterSpec = { }, getUserSyncs: function(syncOptions) { + let syncType = _getSyncType(syncOptions); + if (!syncType) return; + let ibCall = 'https://eb2.3lift.com/sync?'; + + if (syncType === 'image') { + ibCall = utils.tryAppendQueryString(ibCall, 'px', 1); + ibCall = utils.tryAppendQueryString(ibCall, 'src', 'prebid'); + } + if (consentString !== null) { ibCall = utils.tryAppendQueryString(ibCall, 'gdpr', gdprApplies); ibCall = utils.tryAppendQueryString(ibCall, 'cmp_cs', consentString); } - if (syncOptions.iframeEnabled) { - return [{ - type: 'iframe', - url: ibCall - }]; - } + return [{ + type: syncType, + url: ibCall + }]; } } +function _getSyncType(syncOptions) { + if (!syncOptions) return; + if (syncOptions.iframeEnabled) return 'iframe'; + if (syncOptions.pixelEnabled) return 'image'; +} + function _buildPostBody(bidRequests) { let data = {}; let { schain } = bidRequests[0]; diff --git a/test/spec/modules/tripleliftBidAdapter_spec.js b/test/spec/modules/tripleliftBidAdapter_spec.js index 0179b211517..aa312c4621e 100644 --- a/test/spec/modules/tripleliftBidAdapter_spec.js +++ b/test/spec/modules/tripleliftBidAdapter_spec.js @@ -366,7 +366,8 @@ describe('triplelift adapter', function () { }); describe('getUserSyncs', function() { - let expectedSyncUrl = 'https://eb2.3lift.com/sync?gdpr=true&cmp_cs=' + GDPR_CONSENT_STR + '&'; + let expectedIframeSyncUrl = 'https://eb2.3lift.com/sync?gdpr=true&cmp_cs=' + GDPR_CONSENT_STR + '&'; + let expectedImageSyncUrl = 'https://eb2.3lift.com/sync?px=1&src=prebid&gdpr=true&cmp_cs=' + GDPR_CONSENT_STR + '&'; it('returns undefined when syncing is not enabled', function() { expect(tripleliftAdapterSpec.getUserSyncs({})).to.equal(undefined); @@ -378,7 +379,26 @@ describe('triplelift adapter', function () { }; let result = tripleliftAdapterSpec.getUserSyncs(syncOptions); expect(result[0].type).to.equal('iframe'); - expect(result[0].url).to.equal(expectedSyncUrl); + expect(result[0].url).to.equal(expectedIframeSyncUrl); + }); + + it('returns image user sync pixel when iframe syncing is disabled', function() { + let syncOptions = { + pixelEnabled: true + }; + let result = tripleliftAdapterSpec.getUserSyncs(syncOptions); + expect(result[0].type).to.equal('image') + expect(result[0].url).to.equal(expectedImageSyncUrl); + }); + + it('returns iframe user sync pixel when both options are enabled', function() { + let syncOptions = { + pixelEnabled: true, + iframeEnabled: true + }; + let result = tripleliftAdapterSpec.getUserSyncs(syncOptions); + expect(result[0].type).to.equal('iframe'); + expect(result[0].url).to.equal(expectedIframeSyncUrl); }); }); }); From 3f55f3239a9b83f139f9a20bd23c92db119d0c02 Mon Sep 17 00:00:00 2001 From: David Andersen Date: Tue, 26 Nov 2019 17:11:43 -0500 Subject: [PATCH 4/5] Rename endpoint variable --- modules/tripleliftBidAdapter.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/tripleliftBidAdapter.js b/modules/tripleliftBidAdapter.js index 1ebaaa1c440..1550a9e3463 100644 --- a/modules/tripleliftBidAdapter.js +++ b/modules/tripleliftBidAdapter.js @@ -66,21 +66,21 @@ export const tripleliftAdapterSpec = { let syncType = _getSyncType(syncOptions); if (!syncType) return; - let ibCall = 'https://eb2.3lift.com/sync?'; + let syncEndpoint = 'https://eb2.3lift.com/sync?'; if (syncType === 'image') { - ibCall = utils.tryAppendQueryString(ibCall, 'px', 1); - ibCall = utils.tryAppendQueryString(ibCall, 'src', 'prebid'); + syncEndpoint = utils.tryAppendQueryString(syncEndpoint, 'px', 1); + syncEndpoint = utils.tryAppendQueryString(syncEndpoint, 'src', 'prebid'); } if (consentString !== null) { - ibCall = utils.tryAppendQueryString(ibCall, 'gdpr', gdprApplies); - ibCall = utils.tryAppendQueryString(ibCall, 'cmp_cs', consentString); + syncEndpoint = utils.tryAppendQueryString(syncEndpoint, 'gdpr', gdprApplies); + syncEndpoint = utils.tryAppendQueryString(syncEndpoint, 'cmp_cs', consentString); } return [{ type: syncType, - url: ibCall + url: syncEndpoint }]; } } From 280404f4609883a08cda3cd5fe05915b0c0a38f3 Mon Sep 17 00:00:00 2001 From: David Andersen Date: Tue, 26 Nov 2019 17:14:15 -0500 Subject: [PATCH 5/5] Add assertion --- test/spec/modules/tripleliftBidAdapter_spec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/spec/modules/tripleliftBidAdapter_spec.js b/test/spec/modules/tripleliftBidAdapter_spec.js index aa312c4621e..aee4c4d2586 100644 --- a/test/spec/modules/tripleliftBidAdapter_spec.js +++ b/test/spec/modules/tripleliftBidAdapter_spec.js @@ -371,6 +371,7 @@ describe('triplelift adapter', function () { it('returns undefined when syncing is not enabled', function() { expect(tripleliftAdapterSpec.getUserSyncs({})).to.equal(undefined); + expect(tripleliftAdapterSpec.getUserSyncs()).to.equal(undefined); }); it('returns iframe user sync pixel when iframe syncing is enabled', function() {