Added input slots for custom targeting in dfp

This commit is contained in:
vi 2015-08-21 11:19:18 +10:00
parent 9e56fae22a
commit 86054c5164
3 changed files with 25 additions and 7 deletions

View File

@ -16,7 +16,7 @@ function splitHeightInt(value) {
var str = value.substring(4, 7);
return str.trim();
}
function loadGoogle(settings) {
if (_loaded) {
return Ember.RSVP.resolve();
@ -35,14 +35,16 @@ function loadGoogle(settings) {
}
// Define our ad units - extend for mobile view.
// Inventory or slot level custom targeting goes here for each of the defined ad units - needs input and injection.
// For each ad slot, if there is set target, then don't put semicolon in after addService, if so, then add it in to close off function.
// Need to add something to the actual site itself... on the page googletag.pubads().setTargeting(publisher, affiliate1);:
// if statement? the code should be able to run without the custom targeting settings
googletag.cmd.push(function() {
if (settings.dfp_topic_list_top_code && !settings.dfp_show_topic_list_top && settings.topic_list_top_ad_sizes) {
const_width = parseInt(splitWidthInt(settings.topic_list_top_ad_sizes));
const_height = parseInt(splitHeightInt(settings.topic_list_top_ad_sizes));
googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_topic_list_top_code, [parseInt(splitWidthInt(settings.topic_list_top_ad_sizes)), parseInt(splitHeightInt(settings.topic_list_top_ad_sizes))], 'div-gpt-ad-topic-list-top').setTargeting('gender', ['female']).addService(googletag.pubads());
googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_topic_list_top_code, [parseInt(splitWidthInt(settings.topic_list_top_ad_sizes)), parseInt(splitHeightInt(settings.topic_list_top_ad_sizes))], 'div-gpt-ad-topic-list-top')
// Inventory or slot level custom targeting goes here for each of the defined ad units - needs input and injection.
// The ad runs with .setTargeting('gender', ['female'])
.settings.dfp_topic_list_top_custom_targeting_code
.addService(googletag.pubads());
}
if (settings.dfp_topic_above_post_stream_code && !settings.dfp_show_topic_above_post_stream && settings.topic_above_post_stream_ad_sizes) {
const_width = parseInt(splitWidthInt(settings.topic_above_post_stream_ad_sizes));
@ -61,7 +63,6 @@ function loadGoogle(settings) {
}
// Page Level custom targeting goes here - needs an input section and also ad tags on the relevant pages
// googletag.pubads().setTargeting("gender","female");
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
@ -84,6 +85,7 @@ export default Ember.Component.extend({
return "div-gpt-ad-" + this.get('placement');
}.property('placement'),
//settings.dfp_topic_list_top_custom_targeting_code
_initGoogleDFP: function() {
var self = this;
loadGoogle(this.siteSettings).then(function() {

View File

@ -4,13 +4,17 @@ en:
dfp_show_topic_list_top: "Disable topic_list_top ad"
dfp_topic_list_top_code: "Show leaderboard ad above topic lists."
topic_list_top_ad_sizes: "Choose your ad size"
dfp_topic_list_top_custom_targeting_code: "Add your custom targeting code - see instructions"
dfp_show_topic_above_post_stream: "Disable topic_above_post_stream ad"
dfp_topic_above_post_stream_code: "Show leaderboard ad above post stream"
topic_above_post_stream_ad_sizes: "Choose your ad size"
dfp_topic_above_post_stream_custom_targeting_code: "Add your custom targeting code - see instructions"
dfp_show_topic_above_suggested: "Disable topic_above_suggested ad"
dfp_topic_above_suggested_code: "Show leaderboard ad above suggested topics"
topic_above_suggested_ad_sizes: "Choose your ad size"
dfp_topic_above_suggested_custom_targeting_code: "Add your custom targeting code - see instructions"
dfp_show_post_bottom: "Disable post_bottom ad"
dfp_post_bottom_code: "Show leaderboard ad post_bottom topics"
dfp_nth_post_code: "Choose the Nth position for your ad to show"
post_bottom_ad_sizes: "Choose your ad size"
dfp_post_bottom_custom_targeting_code: "Add your custom targeting code - see instructions"

View File

@ -23,6 +23,9 @@ ad_plugin:
dfp_show_topic_list_top:
client: true
default: false
dfp_topic_list_top_custom_targeting_code:
client: true
default: ''
dfp_topic_above_post_stream_code:
client: true
default: ''
@ -44,6 +47,9 @@ ad_plugin:
dfp_show_topic_above_post_stream:
client: true
default: false
dfp_topic_above_post_stream_custom_targeting_code:
client: true
default: ''
dfp_topic_above_suggested_code:
client: true
default: ''
@ -65,6 +71,9 @@ ad_plugin:
dfp_show_topic_above_suggested:
client: true
default: false
dfp_topic_above_suggested_custom_targeting_code:
client: true
default: ''
dfp_post_bottom_code:
client: true
default: ''
@ -88,4 +97,7 @@ ad_plugin:
- 250*250 - square
dfp_show_post_bottom:
client: true
default: false
default: false
dfp_post_bottom_custom_targeting_code:
client: true
default: ''