Alternative second ad placement for revshare partners - #696
Conversation
This adds a second possible ad placement for revenue share partners. Still only a single placement will be selected, but this change offers a second possible placement in the footer with a larger placement.
I spoke with the pallets team directly. The other main revshare partner is Celery. |
|
Should we follow up w/ Celery on the payout email thread perhaps? |
|
I'm good to merge this as well if we want -- I don't think Celery cares too much. |
|
I'll try to get the merge conflict fixed today, but I'd love a review from @humitos. |
|
I tried this locally but I wasn't able to make it work. I'm not sure how to make the new ad placement to appear. How do I reproduce this behavior locally? By the way, do you have an screenshot on how it looks on our theme and Alabaster themes? |
Since the devserver requests a paid ad and there's no large format paid ads, it's not showing. I'll see if I can setup a better example. Edit: I added a second placement in the |
If your local documentation has a matching placement (something like this), then it will be selected. There's a few things here:
|
|
You can force an ad by putting |
|
I put that attribute in the placement but it didn't work. How are you testing this to know that it works on Alabaster and our theme? |
I hadn't tested all the individual combinations separately. Is there a good way to do that? |
|
He, that's the information that I've been trying to get from you to test this PR 😄: how to test this locally on development documentation? We need a way on the JS code to force returning the new placement and the server responding with a real ad. |
|
I pushed 4cbfb8b with the updates required from my point of view after doing some testing locally. Let me know if those look correct to you. This is the diff I've used to test it locally: diff --git a/src/ethicalads.js b/src/ethicalads.js
index a7f0564..a8804db 100644
--- a/src/ethicalads.js
+++ b/src/ethicalads.js
@@ -84,7 +84,7 @@ export class EthicalAdsAddon extends AddonBase {
selector = "nav.wy-nav-side > div.wy-side-scroll";
element = document.querySelector(selector);
- if (this.elementAboveTheFold(element)) {
+ if (!this.elementAboveTheFold(element)) {
placement.setAttribute("data-ea-type", "readthedocs-sidebar");
placement.classList.add("ethical-rtd");
placement.classList.add("ethical-dark-theme");
@@ -136,7 +136,7 @@ export class EthicalAdsAddon extends AddonBase {
selector = "div.sphinxsidebar > div.sphinxsidebarwrapper";
element = document.querySelector(selector);
- if (this.elementAboveTheFold(element)) {
+ if (!this.elementAboveTheFold(element)) {
placement.classList.add("ethical-alabaster");
placement.setAttribute("data-ea-type", "readthedocs-sidebar");
knownPlacementFound = true;
@@ -332,7 +332,7 @@ export class EthicalAdsAddon extends AddonBase {
}
// For now, only show the larger ad format on revshare partners
- if (data.publisher !== "readthedocs" && secondSelector !== null) {
+ if (data.publisher === "readthedocs" && secondSelector !== null) {
const secondElementToAppend = document.querySelector(secondSelector);
if (secondElementToAppend !== null) {
if (secondSelector !== null) {Alabaster
Read the Docs
|
This looks right.
My question was more how do you test addons against real docs sites normally? |
Do you want me to resolve the conflicts and merge this PR?
I always test it on the Read the Docs development environment ( Also, I use https://readthedocs-addons.readthedocs.io/ that list a bunch of different themes/doctools to test so I don't have to keep that list in my memory. There is a switch that makes all the links to be local, pointing to Let me know if that helps. Otherwise, we can pair for a moment and try to set up this environment on your side. |




Adds a second possible ad placement for revenue share partners only. Still only a single placement will be selected, but this change offers a second possible placement in the footer with a larger placement. The server will decide which placement to choose based on inventory.
Branched from #695