Working mobile ads that follow desktop custom targeting
This commit is contained in:
parent
8fc9f91a53
commit
fa3d25e4fd
|
@ -80,13 +80,10 @@ function loadGoogle(settings) {
|
|||
const_width = parseInt(splitWidthInt(settings.topic_list_top_ad_sizes));
|
||||
const_height = parseInt(splitHeightInt(settings.topic_list_top_ad_sizes));
|
||||
if (Discourse.Mobile.mobileView) {
|
||||
googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_topic_list_top_code, [320,50], 'div-gpt-ad-topic-list-top').addService(googletag.pubads());
|
||||
var topic_list_top_mobile = googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_mobile_topic_list_top_code, [320,50], 'div-gpt-ad-topic-list-top').addService(googletag.pubads());
|
||||
custom_targeting((keyParse(Discourse.SiteSettings.dfp_target_topic_list_top_key_code)), (keyParse(Discourse.SiteSettings.dfp_target_topic_list_top_value_code)), topic_list_top_mobile)
|
||||
}
|
||||
else {
|
||||
// googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_topic_list_top_code, [parseInt(splitWidthInt(Discourse.SiteSettings.topic_list_top_ad_sizes)), parseInt(splitHeightInt(Discourse.SiteSettings.topic_list_top_ad_sizes))], 'div-gpt-ad-topic-list-top')
|
||||
// .setTargeting('gender', 'male')
|
||||
// .setTargeting('category', 'clothes')
|
||||
// .addService(googletag.pubads());
|
||||
var topic_list_top = googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_topic_list_top_code, [parseInt(splitWidthInt(Discourse.SiteSettings.topic_list_top_ad_sizes)), parseInt(splitHeightInt(Discourse.SiteSettings.topic_list_top_ad_sizes))], 'div-gpt-ad-topic-list-top').addService(googletag.pubads());
|
||||
custom_targeting((keyParse(Discourse.SiteSettings.dfp_target_topic_list_top_key_code)), (keyParse(Discourse.SiteSettings.dfp_target_topic_list_top_value_code)), topic_list_top)
|
||||
}
|
||||
|
@ -95,7 +92,8 @@ function loadGoogle(settings) {
|
|||
const_width = parseInt(splitWidthInt(settings.topic_above_post_stream_ad_sizes));
|
||||
const_height = parseInt(splitHeightInt(settings.topic_above_post_stream_ad_sizes));
|
||||
if (Discourse.Mobile.mobileView) {
|
||||
googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_topic_above_post_stream_code, [320,50], 'div-gpt-ad-topic-above-post-stream').addService(googletag.pubads());
|
||||
var topic_above_post_stream_mobile = googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_mobile_topic_above_post_stream_code, [320,50], 'div-gpt-ad-topic-above-post-stream').addService(googletag.pubads());
|
||||
custom_targeting((keyParse(Discourse.SiteSettings.dfp_target_topic_above_post_stream_key_code)), (keyParse(Discourse.SiteSettings.dfp_target_topic_above_post_stream_value_code)), topic_above_post_stream_mobile)
|
||||
}
|
||||
else {
|
||||
var topic_above_post_stream = googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_topic_above_post_stream_code, [parseInt(splitWidthInt(Discourse.SiteSettings.topic_above_post_stream_top_ad_sizes)), parseInt(splitHeightInt(Discourse.SiteSettings.topic_above_post_stream_ad_sizes))], 'div-gpt-ad-topic-above-post-stream').addService(googletag.pubads());
|
||||
|
@ -106,7 +104,8 @@ function loadGoogle(settings) {
|
|||
const_width = parseInt(splitWidthInt(settings.topic_above_suggested_ad_sizes));
|
||||
const_height = parseInt(splitHeightInt(settings.topic_above_suggested_ad_sizes));
|
||||
if (Discourse.Mobile.mobileView) {
|
||||
googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_topic_above_suggested_code, [320,50], 'div-gpt-ad-topic-above-suggested').addService(googletag.pubads());
|
||||
var topic_above_suggested_mobile = googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_mobile_topic_above_suggested_code, [320,50], 'div-gpt-ad-topic-above-suggested').addService(googletag.pubads());
|
||||
custom_targeting((keyParse(Discourse.SiteSettings.dfp_target_topic_above_suggested_key_code)), (keyParse(Discourse.SiteSettings.dfp_target_topic_above_suggested_value_code)), topic_above_suggested_mobile)
|
||||
}
|
||||
else {
|
||||
var topic_above_suggested = googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_topic_above_suggested_code, [parseInt(splitWidthInt(Discourse.SiteSettings.topic_above_suggested_ad_sizes)), parseInt(splitHeightInt(Discourse.SiteSettings.topic_above_suggested_ad_sizes))], 'div-gpt-ad-topic-above-suggested').addService(googletag.pubads());
|
||||
|
@ -117,7 +116,8 @@ function loadGoogle(settings) {
|
|||
const_width = parseInt(splitWidthInt(settings.post_bottom_ad_sizes));
|
||||
const_height = parseInt(splitHeightInt(settings.post_bottom_ad_sizes));
|
||||
if (Discourse.Mobile.mobileView) {
|
||||
googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_post_bottom_code, [320,50], 'div-gpt-ad-post-bottom').addService(googletag.pubads());
|
||||
var post_bottom_mobile = googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_mobile_post_bottom_code, [320,50], 'div-gpt-ad-post-bottom').addService(googletag.pubads());
|
||||
custom_targeting((keyParse(Discourse.SiteSettings.dfp_target_post_bottom_key_code)), (keyParse(Discourse.SiteSettings.dfp_target_post_bottom_value_code)), post_bottom_mobile)
|
||||
}
|
||||
else {
|
||||
var post_bottom = googletag.defineSlot('/' + settings.dfp_publisher_id + '/' + settings.dfp_post_bottom_code, [parseInt(splitWidthInt(Discourse.SiteSettings.post_bottom_ad_sizes)), parseInt(splitHeightInt(Discourse.SiteSettings.post_bottom_ad_sizes))], 'div-gpt-ad-post-bottom').addService(googletag.pubads());
|
||||
|
|
Loading…
Reference in New Issue