add ad sizes settings for mobile DFP

This commit is contained in:
Neil Lalonde
2016-06-21 13:13:37 -04:00
parent f930aa14ec
commit 8ce3acfb3b
3 changed files with 80 additions and 6 deletions
@@ -62,14 +62,10 @@ function defineSlot(divId, placement, settings, isMobile) {
return ads[divId];
}
if (isMobile) {
// There are no settings for customizing the mobile ad sizes.
width = 320;
height = 50;
}
if (placement === "topic-list-top" && settings.dfp_topic_list_top_code && settings.dfp_topic_list_top_ad_sizes) {
if (isMobile) {
width = parseInt(splitWidthInt(settings.dfp_mobile_topic_list_top_ad_sizes));
height = parseInt(splitHeightInt(settings.dfp_mobile_topic_list_top_ad_sizes));
ad = window.googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_mobile_topic_list_top_code, [width,height], divId).addService(window.googletag.pubads());
custom_targeting((keyParse(Discourse.SiteSettings.dfp_target_topic_list_top_key_code)), (keyParse(settings.dfp_target_topic_list_top_value_code)), ad);
} else {
@@ -80,6 +76,8 @@ function defineSlot(divId, placement, settings, isMobile) {
}
} else if (placement === "topic-above-post-stream" && settings.dfp_topic_above_post_stream_code && settings.dfp_topic_above_post_stream_ad_sizes) {
if (isMobile) {
width = parseInt(splitWidthInt(settings.dfp_mobile_topic_above_post_stream_ad_sizes));
height = parseInt(splitHeightInt(settings.dfp_mobile_topic_above_post_stream_ad_sizes));
ad = window.googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_mobile_topic_above_post_stream_code, [width,height], divId).addService(window.googletag.pubads());
custom_targeting((keyParse(settings.dfp_target_topic_above_post_stream_key_code)), (keyParse(settings.dfp_target_topic_above_post_stream_value_code)), ad);
} else {
@@ -90,6 +88,8 @@ function defineSlot(divId, placement, settings, isMobile) {
}
} else if (placement === "topic-above-suggested" && settings.dfp_topic_above_suggested_code && settings.dfp_topic_above_suggested_ad_sizes) {
if (isMobile) {
width = parseInt(splitWidthInt(settings.dfp_mobile_topic_above_suggested_ad_sizes));
height = parseInt(splitHeightInt(settings.dfp_mobile_topic_above_suggested_ad_sizes));
ad = window.googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_mobile_topic_above_suggested_code, [width,height], divId).addService(window.googletag.pubads());
custom_targeting((keyParse(settings.dfp_target_topic_above_suggested_key_code)), (keyParse(settings.dfp_target_topic_above_suggested_value_code)), ad);
} else {
@@ -100,6 +100,8 @@ function defineSlot(divId, placement, settings, isMobile) {
}
} else if (placement === "post-bottom" && settings.dfp_post_bottom_code && settings.dfp_post_bottom_ad_sizes) {
if (isMobile) {
width = parseInt(splitWidthInt(settings.dfp_mobile_post_bottom_ad_sizes));
height = parseInt(splitHeightInt(settings.dfp_mobile_post_bottom_ad_sizes));
ad = window.googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_mobile_post_bottom_code, [width,height], divId).addService(window.googletag.pubads());
custom_targeting((keyParse(settings.dfp_target_post_bottom_key_code)), (keyParse(settings.dfp_target_post_bottom_value_code)), ad);
} else {