Fixed merge conflicts with addition of google publisher id

This commit is contained in:
vi 2015-08-24 10:33:29 +10:00
commit 83389e2a83
3 changed files with 33 additions and 10 deletions

View File

@ -15,7 +15,7 @@ function splitHeightInt(value) {
var str = value.substring(4, 7);
return str.trim();
}
function loadGoogle(settings) {
if (_loaded) {
return Ember.RSVP.resolve();
@ -34,6 +34,7 @@ function loadGoogle(settings) {
}
// Define our ad units - extend for mobile view.
// 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));
@ -42,8 +43,11 @@ function loadGoogle(settings) {
googletag.defineSlot(settings.dfp_topic_list_top_code, [320,50], 'div-gpt-ad-topic-list-top').addService(googletag.pubads());
}
else {
googletag.defineSlot(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').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));
@ -52,8 +56,7 @@ function loadGoogle(settings) {
googletag.defineSlot(settings.dfp_topic_above_post_stream_code, [320,50], 'div-gpt-ad-topic-above-post-stream').addService(googletag.pubads());
}
else {
googletag.defineSlot(settings.dfp_topic_above_post_stream_code, [parseInt(splitWidthInt(settings.topic_above_post_stream_ad_sizes)), parseInt(splitHeightInt(settings.topic_above_post_stream_ad_sizes))], 'div-gpt-ad-topic-above-post-stream').addService(googletag.pubads());
}
googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_topic_above_post_stream_code, [parseInt(splitWidthInt(settings.topic_above_post_stream_ad_sizes)), parseInt(splitHeightInt(settings.topic_above_post_stream_ad_sizes))], 'div-gpt-ad-topic-above-post-stream').addService(googletag.pubads());
}
if (settings.dfp_topic_above_suggested_code && !settings.dfp_show_topic_above_suggested && settings.topic_above_suggested_ad_sizes) {
const_width = parseInt(splitWidthInt(settings.topic_above_suggested_ad_sizes));
@ -62,8 +65,7 @@ function loadGoogle(settings) {
googletag.defineSlot(settings.dfp_topic_above_suggested_code, [320,50], 'div-gpt-ad-topic-above-suggested').addService(googletag.pubads());
}
else {
googletag.defineSlot(settings.dfp_topic_above_suggested_code, [parseInt(splitWidthInt(settings.topic_above_suggested_ad_sizes)), parseInt(splitHeightInt(settings.topic_above_suggested_ad_sizes))], 'div-gpt-ad-topic-above-suggested').addService(googletag.pubads());
}
googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_topic_above_suggested_code, [parseInt(splitWidthInt(settings.topic_above_suggested_ad_sizes)), parseInt(splitHeightInt(settings.topic_above_suggested_ad_sizes))], 'div-gpt-ad-topic-above-suggested').addService(googletag.pubads());
}
if (settings.dfp_post_bottom_code && !settings.dfp_show_post_bottom && settings.post_bottom_ad_sizes) {
const_width = parseInt(splitWidthInt(settings.post_bottom_ad_sizes));
@ -72,9 +74,10 @@ function loadGoogle(settings) {
googletag.defineSlot(settings.dfp_post_bottom_code, [320,50], 'div-gpt-ad-post-bottom').addService(googletag.pubads());
}
else {
googletag.defineSlot(settings.dfp_post_bottom_code, [parseInt(splitWidthInt(settings.post_bottom_ad_sizes)), parseInt(splitHeightInt(settings.post_bottom_ad_sizes))], 'div-gpt-ad-post-bottom').addService(googletag.pubads());
}
googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_post_bottom_code, [parseInt(splitWidthInt(settings.post_bottom_ad_sizes)), parseInt(splitHeightInt(settings.post_bottom_ad_sizes))], 'div-gpt-ad-post-bottom').addService(googletag.pubads());
}
// Page Level custom targeting goes here - needs an input section and also ad tags on the relevant pages
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});

View File

@ -1,15 +1,20 @@
en:
site_settings:
dfp_publisher_id: "Put in your publisher id here"
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

@ -1,4 +1,7 @@
ad_plugin:
dfp_publisher_id:
client: true
default: ''
dfp_topic_list_top_code:
client: true
default: ''
@ -20,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: ''
@ -41,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: ''
@ -62,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: ''
@ -85,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: ''