Permutive appends targeting in DFP via key values. In this article we look at how to test this integration and ensure ad targeting is set up succesfully.

How to Test the Integration

To test the integration, you need:

  • A Permutive project with DFP integation enabled
  • At least 1 live DFP reaction

Note: We recommend creating a segment of 'Everyone' and passing this into DFP to test this integration. This ensures that you are always in the segment, so you can check Permutive's targeting.

The easiest way to test the integration is to check the Google Console. On your website, append /?googfc to the url, for example www.examplewebsite.com/?googfc. This will load the Google Console.

On the 'Page Request' tab, search for permutive.

Sending Key Values to DFP

Permutive should be sending key values to DFP whenever you are in a segment which has a live DFP reaction.

On the page request, if you can see 'setting targeting attribute permutive...' then Permutive is sending key values into DFP.

If you can't, then double check that the integration and DFP reactions are set up and enabled in the Permutive dashboard. Also navigate around the site a bit, to ensure you are landing in an at least one Permutive segment which should be sent to DFP. If Permutive still isn't appending targeting then please let us know by contacting support@permutive.com.

Appending Targeting on Ad Requests

Permutive sets key value targeting on DFP ad requests. In order for this to work, targeting must be consistently set before ad requests are made.

On the page request, if the first 'setting targeting attribute permutive...' happens before 'calling fillslot' then we are correctly appending targeting on the ad requests.

If not, there are a few things you can do to prevent this from happening:

  1. Ensure that you are running the Permutive tag as early as possible in page load. This means in the <head>  of the page, and preferably not in GTM or some other tag manager. The ideal place for our script to run is just after googletag has been defined, but before googletag is used and configured.
  2. Add some custom javascript (below), to read Permutive segments from cookies / local storage, and append targeting values as soon as googletag  is available. This will guarantee that cached Permutive segments from previous page loads are set in time. This script should be placed after googletag  is defined but before a call is made to googletag.enableServices() .
  3. Even after the above two improvements have been made, it is possible that we are not updating Permutive segments from the current pageview before DFP targeting is set. This means “first pageview” targeting may not be happening. If this is found to be the case, you can deploy some more custom JavaScript, to effectively “wait” for Permutive to load before enabling DFP. You can choose the maximum wait time, e.g. “wait for up to 2 seconds for Permutive to update segments”.

Example JavaScript for [2]:

googletag.cmd.push(function() {
  var kvs = localStorage.getItem("_pdfps");
  googletag.pubads().setTargeting('permutive', kvs ? JSON.parse(kvs) : []);
});

Example JavaScript for [3]:

var didInit = false;
var doInit = function() {
  if (!didInit) {
    didInit = true;
    googletag.cmd.push(() => {
      googletag.enableServices();
    });
  }
}

$(window).on("permutive:dfp:ready", doInit);
setTimeout(doInit, 2000);


If you have any questions or these steps aren't effective then please let us know by emailing support@permutive.com

Did this answer your question?