Product and Easy Ads work, still building Native Ads

This commit is contained in:
Sarah Ni 2015-09-11 16:33:55 +10:00
parent 2d752d8b2f
commit b4f177d947
5 changed files with 187 additions and 42 deletions

View File

@ -3,8 +3,12 @@ var amazon_width = '';
var amazon_height = '';
var amazon_mobile_width = 320;
var amazon_mobile_height = 50;
var user_input = Discourse.SiteSettings.amazon_topic_list_top_code;
var user_input = '';
var currentUser = Discourse.User.current();
var product_type = 'Product/Easy Banner Link';
var custom_type = 'Native Shopping Ad - Recommended';
var recommended_type = 'Native Shopping Ad - Custom';
var search_type = 'Native Shopping Ad - Search';
function splitWidthInt(value) {
var str = value.substring(0, 3);
@ -12,21 +16,40 @@ function splitWidthInt(value) {
}
function splitHeightInt(value) {
var str = value.substring(4, 7);
var str = value.substring(0, 3);
return str.trim();
}
if (Discourse.SiteSettings.amazon_topic_list_top_code) {
if (!((currentUser) && (currentUser.get('trust_level') > Discourse.SiteSettings.amazon_through_trust_level))) {
user_input = Discourse.SiteSettings.amazon_topic_list_top_code;
amazon_width = parseInt(splitWidthInt(Discourse.SiteSettings.amazon_topic_list_top_ad_sizes));
amazon_height = parseInt(splitHeightInt(Discourse.SiteSettings.amazon_topic_list_top_ad_sizes));
if (Discourse.SiteSettings.amazon_topic_list_top_src_code) {
if (Discourse.SiteSettings.amazon_topic_list_top_ad_category === 'Product/Easy Banner Link' && !((currentUser) && (currentUser.get('trust_level') > Discourse.SiteSettings.amazon_through_trust_level))) {
user_input = Discourse.SiteSettings.amazon_topic_list_top_src_code;
amazon_width = parseInt(Discourse.SiteSettings.amazon_topic_list_top_ad_width_code);
amazon_height = parseInt(Discourse.SiteSettings.amazon_topic_list_top_ad_height_code);
}
//if (Discourse.Mobile.mobileView && Discourse.SiteSettings.adsense_mobile_topic_list_top_code) {
// data["topic-list-top"]["ad_mobile_code"] = Discourse.SiteSettings.adsense_mobile_topic_list_top_code;
//}
}
if (Discourse.SiteSettings.amazon_topic_list_top_ad_category === "Native Shopping Ad - Recommended") {
user_input = Discourse.SiteSettings.amazon_topic_list_top_src_code;
}
/* amazon_tracking_id_code: "Choose Tracking ID Code"
amazon_region_code: "Choose the Generic Amazon Marketplace Region"
amazon_topic_list_top_src_code: "Input your Src code"
amazon_topic_list_top_title_code: "Input your Ad Description"
amazon_topic_list_top_ad_width_code: "Choose your ad width"
amazon_topic_list_top_ad_height_code: "Choose your ad height"
amazon_topic_list_top_custom_product_id_code: "Input relevant ad codes"
amazon_topic_list_top_link_id_code: "Input your Link ID"
amazon_topic_list_top_ad_mode_code: "Choose either manual (custom), auto (recommended), search (search)"
amazon_topic_list_top_fallback_mode_value_code: "Input value that corresponds to type: search"
amazon_topic_list_top_row_ads_code: "Input number of ad display rows"
amazon_topic_list_top_default_category_code: "Input default category"
amazon_topic_list_top_search_phrase_code: "Input search phrase"
amazon_nth_post_code: "Choose the Nth position for your ad to show"
amazon_through_trust_level: "Input trust level" */
// Ember component - the class is the adblock and css
export default Ember.Component.extend({
amazon_width: amazon_width,
@ -34,6 +57,10 @@ export default Ember.Component.extend({
amazon_mobile_width: amazon_mobile_width,
amazon_mobile_height: amazon_mobile_height,
user_input: user_input,
product_type: product_type,
recommended_type: recommended_type,
search_type: search_type,
custom_type: custom_type,
classNames: ['amazon-product-links'],
@ -53,4 +80,19 @@ export default Ember.Component.extend({
return !((currentUser) && (currentUser.get('trust_level') > Discourse.SiteSettings.amazon_through_trust_level));
}.property('trust_level'),
typeProductCategory: function() {
return Discourse.SiteSettings.amazon_topic_list_top_ad_category === this.get('product_type');
}.property('product_type'),
typeRecommendedCategory: function() {
return Discourse.SiteSettings.amazon_topic_list_top_ad_category === this.get('recommended_type');
}.property('recommended_type'),
typeSearchCategory: function() {
return Discourse.SiteSettings.amazon_topic_list_top_ad_category === this.get('search_type');
}.property('search_type'),
typeCustomCategory: function() {
return Discourse.SiteSettings.amazon_topic_list_top_ad_category === this.get('custom_type');
}.property('custom_type'),
});

View File

@ -1,12 +1,66 @@
{{#if site.mobileView}}
{{#if checkTrustLevels}}
<iframe style={{adWrapperStyleMobile}} marginwidth="0" marginheight="0" scrolling="no" frameborder="0" src={{userInput}}>
</iframe>
{{/if}}
{{#if checkTrustLevels}}
{{#if typeProductCategory}}
{{#if site.mobileView}}
<iframe style={{adWrapperStyleMobile}} marginwidth="0" marginheight="0" scrolling="no" frameborder="0" src={{userInput}}>
</iframe>
{{else}}
<div class="container" align="center">
<iframe style={{adWrapperStyle}} marginwidth="0" marginheight="0" scrolling="no" frameborder="0" src={{userInput}}>
</iframe>
</div>
{{/if}}
{{else}}
{{#if typeRecommendedCategory}}
<script type="text/javascript">
amzn_assoc_placement = "adunit0";
amzn_assoc_enable_interest_ads = "true";
amzn_assoc_tracking_id = "s0fcc-20";
amzn_assoc_ad_mode = "auto";
amzn_assoc_ad_type = "smart";
amzn_assoc_marketplace = "amazon";
amzn_assoc_region = "US";
amzn_assoc_linkid = "0d4f6279a6c527dd41ea063851ee9154";
amzn_assoc_emphasize_categories = "51569011,3760911";
amzn_assoc_size = "autoxauto";
amzn_assoc_rows = "2";
amzn_assoc_fallback_mode = {"type":"search","value":"hello"};
amzn_assoc_default_category = "Electronics";
</script>
<script src={{userInput}}></script>
{{/if}}
{{else}}
{{#if checkTrustLevels}}
<iframe style={{adWrapperStyle}} marginwidth="0" marginheight="0" scrolling="no" frameborder="0" src={{userInput}}>
</iframe>
{{#if typeSearchCategory}}
<script type="text/javascript">
amzn_assoc_placement = "adunit0";
amzn_assoc_tracking_id = "s0fcc-20";
amzn_assoc_ad_mode = "search";
amzn_assoc_ad_type = "smart";
amzn_assoc_marketplace = "amazon";
amzn_assoc_region = "US";
amzn_assoc_linkid = "a72ad11d9a0bf521a92e8256409f29e1";
amzn_assoc_default_search_phrase = "Nokia Phones";
amzn_assoc_size = "autoxauto";
amzn_assoc_rows = "2";
amzn_assoc_search_bar_position = "bottom";
</script>
<script src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US"></script>
{{/if}}
{{#if typeCustomCategory}}
<script type="text/javascript">
amzn_assoc_placement = "adunit0";
amzn_assoc_tracking_id = "s0fcc-20";
amzn_assoc_ad_mode = "manual";
amzn_assoc_ad_type = "smart";
amzn_assoc_marketplace = "amazon";
amzn_assoc_region = "US";
amzn_assoc_linkid = "402f6cf98c6537aa462dfa90c96af127";
amzn_assoc_asins = "B012CD7N1Q,B001DPQL2W,B00FFXF8KE,B004W2GTMA,B001DI1G3S,B012CNXH5C,B00OY0YMJW,B00SUYCC9A";
amzn_assoc_size = "500x500";
amzn_assoc_search_bar = "true";
amzn_assoc_title = "My Life";
</script>
<script src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US"></script>
{{/if}}
{{/if}}
{{/if}}

View File

@ -4,6 +4,6 @@
{{#if siteSettings.dfp_topic_list_top_code}}
{{google-dfp-ad placement="topic-list-top"}}
{{/if}}
{{#if siteSettings.amazon_topic_list_top_code}}
{{#if siteSettings.amazon_topic_list_top_src_code}}
{{amazon-product-links placement="topic-list-top"}}
{{/if}}

View File

@ -5,33 +5,33 @@ en:
dfp_show_topic_list_top: "Disable topic_list_top ad"
dfp_topic_list_top_code: "Show leaderboard ad above topic lists."
dfp_mobile_topic_list_top_code: "Mobile - Show leaderboard ad above topic lists."
topic_list_top_ad_sizes: "Choose your ad size"
dfp_topic_list_top_ad_sizes: "Choose your ad size"
dfp_target_topic_list_top_key_code: "Input key values - Inventory Level"
dfp_target_topic_list_top_value_code: "Input key values - Inventory Level"
dfp_show_topic_above_post_stream: "Disable topic_above_post_stream ad"
dfp_topic_above_post_stream_code: "Show leaderboard ad above post stream"
dfp_mobile_topic_above_post_stream_code: "Mobile - Show leaderboard ad above post stream"
topic_above_post_stream_ad_sizes: "Choose your ad size"
dfp_topic_above_post_stream_ad_sizes: "Choose your ad size"
dfp_target_topic_above_post_stream_key_code: "Input key values - Inventory Level"
dfp_target_topic_above_post_stream_value_code: "Input key values - Inventory Level"
dfp_show_topic_above_suggested: "Disable topic_above_suggested ad"
dfp_topic_above_suggested_code: "Show leaderboard ad above suggested topics"
dfp_mobile_topic_above_suggested_code: "Mobile - Show leaderboard ad above suggested topics"
topic_above_suggested_ad_sizes: "Choose your ad size"
dfp_topic_above_suggested_ad_sizes: "Choose your ad size"
dfp_target_topic_above_suggested_key_code: "Input key values - Inventory Level"
dfp_target_topic_above_suggested_value_code: "Input key values - Inventory Level"
dfp_show_post_bottom: "Disable post_bottom ad"
dfp_post_bottom_code: "Show leaderboard ad post_bottom topics"
dfp_mobile_post_bottom_code: "Mobile - Show leaderboard ad post_bottom topics"
dfp_nth_post_code: "Choose the Nth position for your ad to show"
post_bottom_ad_sizes: "Choose your ad size"
dfp_post_bottom_ad_sizes: "Choose your ad size"
dfp_target_post_bottom_key_code: "Input key values - Inventory Level"
dfp_target_post_bottom_value_code: "Input key values - Inventory Level"
adsense_publisher_code: "Insert your Publisher ID here"
adsense_through_trust_level: "Show your ads to users based on trust."
adsense_show_topic_list_top: "Disable topic_list_top ad"
adsense_topic_list_top_code: "Show leaderboard ad above topic lists."
adsense_mobile_topic_list_top_code: "Mobile - Show leaderboard ad above topic lists."
adsense_mobile_topic_list_top_code: "Mobile - Show leaderboard ad above topic lists"
adsense_topic_list_top_ad_sizes: "Choose your ad sizes"
adsense_show_topic_above_post_stream: "Disable topic_above_post_stream ad"
adsense_topic_above_post_stream_code: "Show leaderboard ad above post stream"
@ -46,6 +46,19 @@ en:
adsense_show_post_bottom: "Disable post_bottom ad"
adsense_post_bottom_ad_sizes: "Choose your ad sizes"
adsense_nth_post_code: "Choose the Nth position for your ad to show"
amazon_topic_list_top_code: "Insert your src code here"
amazon_topic_list_top_ad_sizes: "Choose your ad sizes"
amazon_topic_list_top_ad_category: "Choose your Amazon Ad type"
amazon_tracking_id_code: "Choose Tracking ID Code"
amazon_region_code: "Choose the Generic Amazon Marketplace Region"
amazon_topic_list_top_src_code: "Input your Src code"
amazon_topic_list_top_title_code: "Input your Ad Description"
amazon_topic_list_top_ad_width_code: "Choose your ad width"
amazon_topic_list_top_ad_height_code: "Choose your ad height"
amazon_topic_list_top_custom_product_id_code: "Input relevant ad codes"
amazon_topic_list_top_link_id_code: "Input your Link ID"
amazon_topic_list_top_ad_mode: "Choose either manual (custom), auto (recommended), search (search)"
amazon_topic_list_top_fallback_mode_value_code: "Input value that corresponds to type: search"
amazon_topic_list_top_row_ads_code: "Input number of ad display rows"
amazon_topic_list_top_default_category_code: "Input default category"
amazon_topic_list_top_search_phrase_code: "Input search phrase"
amazon_nth_post_code: "Choose the Nth position for your ad to show"
amazon_through_trust_level: "Input trust level"

View File

@ -239,7 +239,58 @@ dfp_plugin:
client: true
amazon_plugin:
amazon_topic_list_top_code:
amazon_topic_list_top_ad_category:
client: true
default: 'Product/Easy Banner Link'
type: enum
choices:
- Product/Easy Banner Link
- Native Shopping Ad - Recommended
- Native Shopping Ad - Custom
- Native Shopping Ad - Search
amazon_tracking_id_code:
client: true
default: ''
amazon_region_code:
client: true
default: ''
amazon_topic_list_top_src_code:
client: true
default: ''
amazon_topic_list_top_title_code:
client: true
default: ''
amazon_topic_list_top_ad_width_code:
client: true
default: ''
amazon_topic_list_top_ad_height_code:
client: true
default: ''
amazon_topic_list_top_custom_product_id_code:
default: ''
type: value_list
client: true
amazon_topic_list_top_link_id_code:
client: true
default: ''
amazon_topic_list_top_ad_mode:
client: true
default: 'manual'
type: enum
choices:
- manual
- auto
- search
amazon_topic_list_top_fallback_mode_value_code:
client: true
default: ''
amazon_topic_list_top_row_ads_code:
client: true
default: ''
amazon_topic_list_top_default_category_code:
client: true
default: ''
amazon_topic_list_top_search_phrase_code:
client: true
default: ''
amazon_through_trust_level:
@ -248,18 +299,3 @@ amazon_plugin:
amazon_nth_post_code:
client: true
default: ''
amazon_topic_list_top_ad_sizes:
client: true
default: '728*90 - leaderboard'
type: enum
choices:
- 728*90 - leaderboard
- 234*60 - small banner
- 300*250 - medium rectangle
- 468*60 - banner
- 125*125 - button
- 120*90 - small rectangle
- 120*60 - mini rectangle
- 88*31 - button
- 160*600 - vertical leaderboard
- 120*240 - product link