You are currently viewing Setting Up the Correct DFP Key-Value Pairs

Setting Up the Correct DFP Key-Value Pairs

  • Post author:
  • Post category:DFP

DFP key-value pair allows the publisher or advertiser to target and serve Ads to specific content pages that matches the custom criteria it’s set. Incorrect way of setting up the values may lead to Ad rendering issues. This guide aims to solve another ad rendering issue that a publisher faces when DFP key-value pairs aren’t setup correctly.


For the website, for instance — the client has created custom targeting keys having free-formed values that is taken from the categories name and URI. The client also created an order and added line items with the custom key-value pair they have defined, in an effort to serve specific creatives on specific category across the site. Now, the client noticed that some of the line items status were already “Delivering” while others are still on “Ready” status. The client believes that there’s something wrong with the setup but don’t know what.


By looking at the client’s problem I could say that the problem could be just how the line item is setup — particularly, how the custom .setTargeting() function is handled.

To confirm the issue, I went over the client’s setup and check if all criteria in the line item matches to what is being passed in the custom .setTargeting() function on page source.


The key-values pair on the above image is set to “oekologi“.


After viewing the page source, I found out that custom key-values didn’t match to what is actually printed on the page source. The URI “oekologi” matches but the value that is passed into the .setTargeting() function is actually “∅kologi“. I also checked the other category pages and compare the key-values added in DFP to the one’s actually printed on its individual page source.

Below are some of the mis-matched key-values:

  1. foedevaresikkerhed-og-hygiejne vs fødevaresikkerhed og hygiejne
  2. konfekture-sukker-og-snacks vs konfekture sukker og snacks
  3. oekologi vs Økologi
  4. broed-og-kager vs brød og kager
  5. foodservice-catering-og-restauranter vs foodservice catering og restauranter

To avoid overlooking this kind of issue, it is better to check the page source and use the actual key-value that is defined in the custom .setTargeting() of DFP.

Actions Taken:

  1. Added the actual values that is printed on page source in the DFP’s free-formed key-value pairs.
  2. Updated the key-values of the said line item with the newly created one that is “∅kologi”.

Updated Key-Values


After saving the changes in the DFP line item settings, I went over the line items and checked its status. As you can see in the image below the line items are now delivering.

Line Items Delivery

And the line item’s creative ad unit is now served.


Again, to make sure that ads will deliver on pages targeted with key-value pair, ensure that the key and its value defined in DFP line item settings are the ones printed in the page source and passed through the .setTargeting() function.