Custom targeting with DoubleClick (DFP)
This blog post was originally published a little while ago. Please consider that it may no longer be relevant or even accurate.
We had to insert some custom targeting tags for our advertisments this week and a lot of the documentation I found popping up was old or unrelated. It took a little bit of time digging down the rabbit hole, but I was able to work out the current (March 2014) method of adding additional targeting data. It all starts with the
googletag.cmd.push() method you use to initiate your ad units. Inside the closure, you're able to use the
setTargeting() method to assign custom tags.
Of course, if you want to use dynamic tags it's still pretty easy. Here's a Laravel example.
Hopefully this is helpful to some people. I figure the more blogs that publish the new way of doing things the further down the old blog posts will move down the Google rankings.