There was an Error Setting the Key Value Pair Value. Here’s How To Fix It.

OFF-page setup:

The following script tag can be expanded to include more custom Key-value pairs, using the same format.

<script>

window.m2hb = window.m2hb || {};

window.m2hb.kvps = window.m2hb.kvps || {};

window.m2hb.kvps[“customKVP”] = “value”;

</script>

Note that: if you want to add more key-values in the future, you should not redefine window.m2hb.kvps object.

Instead, you should add more values with bracket- or dot-notation to add new values:

<script>

window.m2hb = window.m2hb || {};

window.m2hb.kvps = window.m2hb.kvps || {};

window.m2hb.kvps[“customKVP”] = “value”;

window.m2hb.kvps[“anotherValue”] = “secondValue”;

</script>

— also valid (dot-notation) —

<script>

window.m2hb = window.m2hb || {};

window.m2hb.kvps = window.m2hb.kvps || {};

window.m2hb.kvps.customKVP = “value”;

window.m2hb.kvps.anotherValue = “secondValue”;

</script>

While this setup will allow you to add key value pairs in multiple script tags, as long as they are above the MonetizeMore’s PubGuru header bidding script in the HTML, it is strongly recommended that you keep them together (for ease of editing). Also note that the last option (dot-notation), has some limitations, as you can’t start keys with a number. The square bracket style is recommended.

Key with multiple values

To create a key with multiple values, the value field in the code should be a javascript array, for example:

 

<script>

window.m2hb = window.m2hb || {};

window.m2hb.kvps = window.m2hb.kvps || {};

window.m2hb.kvps[“multiKey”] = [“value1”, “value2”, “value3”];

</script>

ON-page setup:

Sample tag with single key value pair:

<script async=’async’ src=’https://www.googletagservices.com/tag/js/gpt.js’></script>

<script>

var googletag = googletag || {};

googletag.cmd = googletag.cmd || [];

</script>

<script>

googletag.cmd.push(function() {

googletag.defineSlot(‘/2602542/LB_8D_728x90’, [728, 90], ‘div-gpt-ad-1544838080061-0’).addService(googletag.pubads());

googletag.pubads().enableSingleRequest();

googletag.pubads().setTargeting(‘influencer’, [‘glmpartner3’]);

googletag.enableServices();

});

</script>

Sample tag with multiple key value pairs:

<script async=’async’ src=’https://www.googletagservices.com/tag/js/gpt.js’></script>

<script>

var googletag = googletag || {};

googletag.cmd = googletag.cmd || [];

</script>

<script>

googletag.cmd.push(function() {

googletag.defineSlot(‘/2602542/LB_8D_728x90’, [728, 90], ‘div-gpt-ad-1544838162911-0’).addService(googletag.pubads());

googletag.pubads().enableSingleRequest();

googletag.pubads().setTargeting(‘influencer’, [‘glmpartner3’]).setTargeting(‘Channel’, [‘105’, ‘106’]);

googletag.enableServices();

});

</script>

Back to Notification Center