diff --git a/assets/javascripts/discourse/components/google-dfp-ad.js.es6 b/assets/javascripts/discourse/components/google-dfp-ad.js.es6 index 886d67a..d82b820 100755 --- a/assets/javascripts/discourse/components/google-dfp-ad.js.es6 +++ b/assets/javascripts/discourse/components/google-dfp-ad.js.es6 @@ -1,7 +1,7 @@ import loadScript from 'discourse/lib/load-script'; -const const_width = 300; -const const_height = 250; +var const_width = ''; +var const_height = ''; var _loaded = false, _promise = null; @@ -37,15 +37,23 @@ function loadGoogle(settings) { // Define our ad units - extend for mobile view. 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_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()); } 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)); + const_height = parseInt(splitHeightInt(settings.topic_above_post_stream_ad_sizes)); 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()); } 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)); + const_height = parseInt(splitHeightInt(settings.topic_above_suggested_ad_sizes)); 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()); } 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)); + const_height = parseInt(splitHeightInt(settings.post_bottom_ad_sizes)); 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.pubads().enableSingleRequest(); diff --git a/config/settings.yml b/config/settings.yml index 0859ff3..f076fb3 100755 --- a/config/settings.yml +++ b/config/settings.yml @@ -2,30 +2,6 @@ ad_plugin: dfp_topic_list_top_code: client: true default: '' - dfp_show_topic_list_top: - client: true - default: false - dfp_topic_above_post_stream_code: - client: true - default: '' - dfp_show_topic_above_post_stream: - client: true - default: false - dfp_topic_above_suggested_code: - client: true - default: '' - dfp_show_topic_above_suggested: - client: true - default: false - dfp_post_bottom_code: - client: true - default: '' - dfp_show_post_bottom: - client: true - default: false - dfp_nth_post_code: - client: true - default: '' topic_list_top_ad_sizes: client: true default: '728*90 - leaderboard' @@ -41,6 +17,12 @@ ad_plugin: - 180*150 - small rectangle - 200*200 - small square - 250*250 - square + dfp_show_topic_list_top: + client: true + default: false + dfp_topic_above_post_stream_code: + client: true + default: '' topic_above_post_stream_ad_sizes: client: true default: '728*90 - leaderboard' @@ -56,6 +38,12 @@ ad_plugin: - 180*150 - small rectangle - 200*200 - small square - 250*250 - square + dfp_show_topic_above_post_stream: + client: true + default: false + dfp_topic_above_suggested_code: + client: true + default: '' topic_above_suggested_ad_sizes: client: true default: '728*90 - leaderboard' @@ -71,6 +59,15 @@ ad_plugin: - 180*150 - small rectangle - 200*200 - small square - 250*250 - square + dfp_show_topic_above_suggested: + client: true + default: false + dfp_post_bottom_code: + client: true + default: '' + dfp_nth_post_code: + client: true + default: '' post_bottom_ad_sizes: client: true default: '728*90 - leaderboard' @@ -85,4 +82,7 @@ ad_plugin: - 125*125 - button - 180*150 - small rectangle - 200*200 - small square - - 250*250 - square \ No newline at end of file + - 250*250 - square + dfp_show_post_bottom: + client: true + default: false \ No newline at end of file