mirror of
https://github.com/discourse/discourse-adplugin.git
synced 2025-02-17 00:45:15 +00:00
Added custom targeting function error on line 50 when calling f.bar
This commit is contained in:
parent
8989d9c5ea
commit
cdb4c50eff
@ -47,12 +47,20 @@ var Foo = function(key, value, googletag) {
|
|||||||
|
|
||||||
// setTargeting is not defined. We want to return as a method - PROBLEM 1
|
// setTargeting is not defined. We want to return as a method - PROBLEM 1
|
||||||
Foo.prototype.bar = function() {
|
Foo.prototype.bar = function() {
|
||||||
return googletag.setTargeting((this.locationKey), (this.locationValue));
|
return this.googletag.setTargeting(this.locationKey, this.locationValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This should call googletag.setTargeting(key for that location, value for that location)
|
// This should call googletag.setTargeting(key for that location, value for that location)
|
||||||
var f = new Foo(keyParse(Discourse.SiteSettings.dfp_target_topic_above_post_stream_key_code), valueParse(Discourse.SiteSettings.dfp_target_topic_above_post_stream_value_code), googletag);
|
function custom_targeting(key_array, value_array) {
|
||||||
f.bar();
|
var i = 0;
|
||||||
|
while (i < key_array.length) {
|
||||||
|
var custom_values = [];
|
||||||
|
var wordValue = valueParse(value_array[i])
|
||||||
|
var f = new Foo(key_array[i], wordValue, googletag);
|
||||||
|
f.bar();
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// END of Coaches Note
|
// END of Coaches Note
|
||||||
|
|
||||||
@ -93,9 +101,8 @@ function loadGoogle(settings) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
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')
|
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')
|
||||||
.setTargeting(keyParse(settings.dfp_target_topic_list_top_key_code), valueParse(settings.dfp_target_topic_list_top_value_code))
|
custom_targeting((keyParse(Discourse.SiteSettings.dfp_target_topic_list_top_key_code)), (keyParse(Discourse.SiteSettings.dfp_target_topic_list_top_value_code)))
|
||||||
// This hardcoded code works: .setTargeting('category', ["clothes", "handbags", "makeup"])
|
googletag.addService(googletag.pubads());
|
||||||
.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) {
|
if (settings.dfp_topic_above_post_stream_code && !settings.dfp_show_topic_above_post_stream && settings.topic_above_post_stream_ad_sizes) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user