Google Product Forums

Multiple targeting keys with the new GPT library tags,


OV Remy Mar 26, 2012 7:00 AM
Posted in group: DoubleClick for Publishers

Categories: Trafficking :

DFP-Small Business

Question or Issue: 

There has been a lot of confusion about the targeting code with the new async code. Correct way seems to be googletag.pubads().setTargeting("key", "value");
So I have this working and it seems to even target ads correctly. My problem is that if I want to add another key, it will not target it correctly. Only the first one will be accepted. Google Console can confirm that when I open Ad Unit in the Delivery Diagnostics window.

googletag.pubads().setTargeting("A", "value"); WORKS

but

googletag.pubads().setTargeting("A", "value"); WORKS
googletag.pubads().setTargeting("B", "value"); DOES NOT WORK

So my question is, whats the syntax to add more than 1 key/value paris to ads?