Allow customizing Carbon Ads format
Carbon Ads now supports a new Cover format, which can be forced using an extra query parameter.
This commit is contained in:
parent
fcd734079b
commit
9c6c880b1d
|
|
@ -5,18 +5,23 @@ import AdComponent from "./ad-component";
|
||||||
export default class CarbonadsAd extends AdComponent {
|
export default class CarbonadsAd extends AdComponent {
|
||||||
serve_id = null;
|
serve_id = null;
|
||||||
placement = null;
|
placement = null;
|
||||||
|
format = null;
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this.set("serve_id", this.siteSettings.carbonads_serve_id);
|
this.set("serve_id", this.siteSettings.carbonads_serve_id);
|
||||||
this.set("placement", this.siteSettings.carbonads_placement);
|
this.set("placement", this.siteSettings.carbonads_placement);
|
||||||
|
this.set("format", this.siteSettings.carbonads_format);
|
||||||
super.init();
|
super.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@discourseComputed("serve_id", "placement")
|
@discourseComputed("serve_id", "placement", "format")
|
||||||
url(serveId, placement) {
|
url(serveId, placement, format) {
|
||||||
return htmlSafe(
|
let baseUrl = `//cdn.carbonads.com/carbon.js?serve=${serveId}&placement=${placement}`;
|
||||||
`//cdn.carbonads.com/carbon.js?serve=${serveId}&placement=${placement}`
|
if (format) {
|
||||||
);
|
baseUrl += `&format=${format}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return htmlSafe(baseUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@discourseComputed
|
@discourseComputed
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,7 @@ en:
|
||||||
|
|
||||||
carbonads_serve_id: "Your Carbon Ads Serve ID"
|
carbonads_serve_id: "Your Carbon Ads Serve ID"
|
||||||
carbonads_placement: "Your Carbon Ads Placement"
|
carbonads_placement: "Your Carbon Ads Placement"
|
||||||
|
carbonads_format: "Your Carbon Ads Format"
|
||||||
carbonads_through_trust_level: "Show your ads to users based on trust levels. Users with trust level higher than this value will not see ads."
|
carbonads_through_trust_level: "Show your ads to users based on trust levels. Users with trust level higher than this value will not see ads."
|
||||||
carbonads_exclude_groups: "Ads will not be shown to members of these groups"
|
carbonads_exclude_groups: "Ads will not be shown to members of these groups"
|
||||||
carbonads_topic_list_top_enabled: "Show an ad above the topic list"
|
carbonads_topic_list_top_enabled: "Show an ad above the topic list"
|
||||||
|
|
|
||||||
|
|
@ -438,6 +438,12 @@ carbonads_plugin:
|
||||||
carbonads_placement:
|
carbonads_placement:
|
||||||
client: true
|
client: true
|
||||||
default: ""
|
default: ""
|
||||||
|
carbonads_format:
|
||||||
|
client: true
|
||||||
|
default: "responsive"
|
||||||
|
choices:
|
||||||
|
- responsive
|
||||||
|
- cover
|
||||||
carbonads_through_trust_level:
|
carbonads_through_trust_level:
|
||||||
client: true
|
client: true
|
||||||
default: 2
|
default: 2
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue