This post was most recently updated on mayo 30th, 2022
If you want to send custom Key-Value Pairs to GAM, all you need to do is set up some javascript on your pages. This needs to be set before the MonetizeMore’s PubGuru header bidding script is loaded.
The following script tag can be expanded to include more custom key-value pairs, using the same format:
</script>
Note that: if the publisher wants to add more key-values in the future, they should not redefine window.pg.kvps object.
Instead, they should add more values with bracket- or dot-notation to add new values:
window.pg = window.pg || {};
window.pg.kvps = window.pg.kvps || {};
window.pg.kvps["customKVP"] = "value";
window.pg.kvps["anotherValue"] = "secondValue";
--- also valid (dot-notation) ---
window.pg = window.pg || {};
window.pg.kvps = window.pg.kvps || {};
window.pg.kvps.customKVP = "value";
window.pg.kvps.anotherValue = "secondValue";
To create a key with multiple values, the value field in the code should be a javascript array, for example:
window.pg = window.pg || {};
window.pg.kvps = window.pg.kvps || {};
window.pg.kvps["multiKey"] = ["value1", "value2", "value3"];
Sample header tag for pages where we’d like Google demand blocked:
window.pg = window.pg || {};
window.pg.kvps = window.pg.kvps || {};
window.pg.kvps["google"] = ["0", "no", "off"];
<script type = «text/javascript» src = «//m2d.m2.ai/pg.mydomain.js» async></script>
Need more help? Send us an email at support@monetizemore.com or log in to PubGuru App and use the Chat widget for immediate support.
Let our AdOps Experts do the hard work. Sign up today and unlock your revenue potential.