Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ads JS hotfix #7586

Merged
merged 1 commit into from
Oct 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions readthedocs/core/static-src/core/js/doc-embed/sponsorship.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ function init() {
var placement;

rtd = rtddata.get();

if (!rtd.show_promo()) {
return;
}

placement = create_ad_placement();

// Inject ads
Expand All @@ -157,13 +162,16 @@ function init() {
return;
}

// Set the keyword and campaign data
// Set the keyword, campaign data, and publisher
if (data.keywords) {
placement.attr("data-ea-keywords", data.keywords.join("|"));
}
if (data.campaign_types) {
placement.attr("data-ea-campaign-types", data.campaign_types.join("|"));
}
if (data.publisher) {
placement.attr("data-ea-publisher", data.publisher);
}

if (typeof ethicalads !== "undefined") {
// Trigger ad request
Expand All @@ -177,7 +185,7 @@ function init() {
error: function () {
console.error('Error loading Read the Docs user and project information');

if (!rtd.ad_free && rtd.api_host === 'https://readthedocs.org' && detect_adblock()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't needed because it's checked on line 139 above.

if (!rtd.ad_free && detect_adblock()) {
adblock_admonition();
adblock_nag(placement);
}
Expand Down
Loading