How to Use Custom GAM Key-Values

Use custom Google Ad Manager key-values for on-page targeting

There are two ways to pass custom key-value pairs to GAM. 

  1. Using properSpecialOps.page_meta
  2. Directly on your Google Publisher Tag (GPT) 


Use the dfp_kv property (object) within properSpecialOps.page_meta to pass page-level key-value pairs directly to GAM.

properSpecialOps = window.properSpecialOps || {};
properSpecialOps.page_meta = {                  
  "dfp_kv": {
'sport': 'baseball',
'team': 'padres'

Note, there is a limit of 20 characters on keys and 40 characters on values.

GPT Reference

Before getting started, make sure you’re familiar with this page from the Google Developer Center. Start there if you need, and then come back to this resource for some Sovrn Ad Management specific examples. 

Please click here to see all custom variables that you can use with us.

Page-Level Targeting

This feature allows publishers to set GAM key-values across all of your ad slots on the page. Publishers might want to use this targeting feature in GAM to reduce the total amount of ad code on page to better optimize targeting.
Use the following command to initiate this feature:


Here is an example of this code: 

<script type="text/javascript">
    // Define propertag
    var propertag = {};
    propertag.cmd = [];
    // Page-level targeting with single value per key
    propertag.cmd.push(function() {
      googletag.pubads().setTargeting('interests', 'basketball');
    // Page-level targeting with multiple values for a single key.
    propertag.cmd.push(function() {
      googletag.pubads().setTargeting('interests', ['baseball', 'basketball']);
    // Page-level targeting with multiple keys
     propertag.cmd.push(function() {
      googletag.pubads().setTargeting('interests', 'basketball');
      googletag.pubads().setTargeting('position', 'atf');

Here is an example of SMS variables & Google Ad Manager Key-Values

<script type="text/javascript">
  var propertag = propertag || {};
  propertag.cmd = propertag.cmd || [];
  var properSpecialOps = properSpecialOps || {};
  properSpecialOps.tags = ['interests=basketball'];
  propertag.cmd.push(function() {
    googletag.pubads().setTargeting('interests', 'basketball');
  (function() {
    var pm = document.createElement('script');
    pm.async = true; pm.type = 'text/javascript';
    var is_ssl = 'https:' == document.location.protocol;
    pm.src = (is_ssl ? 'https:' : 'http:') + '//';
    var node = document.getElementsByTagName('script')[0];
    node.parentNode.insertBefore(pm, node);