8

We are trying to use the key value feature in google ad manager in a report,

// example
var targetingData = [];
targetingData['utm_campaign'] = new Date().getTime();
targetingData['utm_term'] = new Date().getTime();
        googletag.defineSlot('/account-id/Minf-3', [300, 100], 'div-gpt-ad-1576162076591-0')
            .addService(googletag.pubads()).setTargeting('utm_term', targetingData['utm_term'])
            .setTargeting('utm_campaign', targetingData['utm_campaign']);

        googletag.pubads().setTargeting('utm_term', targetingData['utm_term'])
            .setTargeting('utm_campaign', targetingData['utm_campaign']);

Then we are generating a report with key values, but the values are all shown as unknown. when we check it in the page that key value is set correctly we are calling to getTargeting method, and we always get the correct value:

googletag.pubads().getTargeting('utm_term');
googletag.pubads().getTargeting('utm_campaign');

Is there something we are missing here?

How do we generate a report that can show us the value of the "key values" along with the impressions and clicks?

  • We manage to see values only when we set them as predefined, so we having this issue only when we set the values dynamic value.
talsibony
  • 8,448
  • 6
  • 47
  • 46

2 Answers2

0

The targeting values should be strings, you're passing numbers. Try converting the timestamp into a string first, for example:

googletag.pubads().setTargeting('utm_term', new Date().getTime() + '')
BeWarned
  • 2,280
  • 1
  • 15
  • 22
0

You might need to make sure your key/values are set up as "custom dimensions" for your reports to be able to pull values. It has to be done through Ad Manage UI. According to this support page :

  1. Click Inventory and then Key-values.
  2. Click the name of a key to be used in Ad Manager reports
  3. Under "Report on values," select Include values in reporting
  4. Click Save

On the "Key-values" page, the value in the "Reportable" column will change to "On."

Then you should be able to get the values of the keys in the report. Hope this helps.

rabsom
  • 740
  • 5
  • 13