From 2124073de92b5f0f862dd9e6455ef4204c7a5ebf Mon Sep 17 00:00:00 2001 From: Ladydanger Date: Wed, 19 Aug 2015 10:45:03 +1000 Subject: [PATCH] Initial planning of custom targeting locations --- .../discourse/components/google-dfp-ad.js.es6 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/assets/javascripts/discourse/components/google-dfp-ad.js.es6 b/assets/javascripts/discourse/components/google-dfp-ad.js.es6 index d82b820..4ef697d 100755 --- a/assets/javascripts/discourse/components/google-dfp-ad.js.es6 +++ b/assets/javascripts/discourse/components/google-dfp-ad.js.es6 @@ -39,7 +39,11 @@ function loadGoogle(settings) { 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()); + 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'). + + // Inventory level custom targeting goes here for each of the defined ad units. + setTargeting('location', ['melbourne']). + 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)); @@ -56,6 +60,10 @@ function loadGoogle(settings) { 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()); } + + // Page Level custom targeting goes here. + googletag.pubads().setTargeting('gender', ['male']); + googletag.pubads().enableSingleRequest(); googletag.enableServices(); });