From 4d20b1ef90bf4140c025db108cdecb0f112118da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Duch=C3=AAne?= Date: Wed, 10 Feb 2016 13:01:21 +0000 Subject: [PATCH] Use a proper correlator value --- ads/doubleclick.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ads/doubleclick.js b/ads/doubleclick.js index f78b1e2b502f..3527a9dfc0ca 100644 --- a/ads/doubleclick.js +++ b/ads/doubleclick.js @@ -40,12 +40,21 @@ export function doubleclick(global, data) { parseInt(data.overrideWidth || data.width, 10), parseInt(data.overrideHeight || data.height, 10) ]]; + const clientId = window.context.clientId; + const pageViewId = window.context.pageViewId; + let correlator = null; + if (clientId != null) { + correlator = pageViewId + (clientId.replace(/\D/g, '') % 1e6) * 1e6; + } else { + correlator = pageViewId; + } const pubads = googletag.pubads(); const slot = googletag.defineSlot(data.slot, dimensions, 'c') .addService(pubads); pubads.enableSingleRequest(); pubads.markAsAmp(); pubads.set('page_url', context.canonicalUrl); + pubads.setCorrelator(Number(correlator)); googletag.enableServices(); if (data.targeting) {