Google Ad Manager (DFP) feeding key value into template to display custom values in creative

392 views Asked by At

I'm racking my brain with a Custom Creative (HTML5) in Google Ad Manager to display a key value within the creative.

Here is the ad slot being called:

    window.googletag = window.googletag || {cmd: []};
    var gptAdSlots = []; 
    googletag.cmd.push(function() {
    var adSizes = googletag.sizeMapping()
        .addSize([1024,0],[[1182, 320], [1182, 270]])
        .addSize([768,0],[[752, 280], [752, 220]])
        .addSize([320,0],[360, 260])
        .build();
        gptAdSlots[0]=googletag.defineSlot('/21889999357/uat.xxxx.com/PR/AB/Spot-1', [[752, 280], [1182, 320], [360, 260], [752, 220], [1182, 270]], 'div-gpt-ad-AB-1').
        defineSizeMapping(adSizes)
        .setTargeting("CartTotal", "561")
          .setTargeting("Language", "en")
          .setTargeting("Site_Edition", "us")
          .addService(googletag.pubads());
        googletag.pubads().collapseEmptyDivs();
    googletag.pubads().enableSingleRequest();
    googletag.enableServices();
});

In the custom HTML5 template I am trying to populate a javascript variable for CartTotal using using Google's Pattern Macro:

var cartTotal = '%%PATTERN:CartTotal%%';
console.log('CartTotal', cartTotal);

Unfortunately what is getting output is the following:

CartTotal %%PATTERN:CartTotal%%

Am I on a boondoggle? Is this something that is actually possible as documentation on the internets is sparse.

Thank you!

0

There are 0 answers