Hey elvinf,
The plugin will automatically pull the page name (broken out by /
), categories and tags for a given page/post/post type, and automatically set them at the page-level for targeting.
For example: The key:value pair for targeting a tag “Chocolate” would be category=chocolate
or for example.com/about-us/ would be ‘page=about-us`.
Here are some example screenshots:
Creating category key: http://www.chriswgerber.com/assets/uploads/2015/08/creating-targeting-key.png
Setting category value: http://www.chriswgerber.com/assets/uploads/2015/08/category-is-chocolate.png
Thread Starter
elvinf
(@elvinf)
Hi Chris,
Great. I noticed that after I submitted my question. In addition to these values you are already passing in, I like to pass in my own slot level or page level targeting.
For example, I would like to pass the value of position is 1 to the top leaderboard ad position.
Is it possible to do that with your plugin?
I would also like to pass in other custom targeting but that is getting into deeper customization that are probably not intended for this plugin.
Thanks
Elvin, I’ll look into that!
Right now, it’s set up to pass values at the page level, so you can feed any targeting you want by adding to the object before it’s sent to javascript. However, that doesn’t include targeting for individual positions. It is part of my plan to add the ability to set targeting values to individual positions, as well. Overall, I want it to be blazingly simple to setup for people who don’t need much, and still provide options for people looking for more.
If you want to add additional page-level targetin, there’s a filter called pre_dfp_ads_to_js
that contains the data needed to setup the ad positions. To filter in new targeting, you would add a key to the “page_targeting” along with an array of values.
Example:
add_filter( 'pre_dfp_ads_to_js', function( $dfp_ads ) {
$dfp_ads->page_targeting['custom_key'] = array('of', 'values');
return $dfp_ads;
} );
Thread Starter
elvinf
(@elvinf)
If you can get targeting for individual positions that would be amazing. Granted i can do this without a plugin but having this plugin out there makes things SO much easier for me. Just need a little more advance options and i’ll be good to go.
I will keep my eye out for any updates. Great plugin
Thanks! Glad you find it useful.
Development for the plugin is done on Github (https://github.com/ThatGerber/dfp-ads) if you’re curious about following or would like to submit this as a feature request.