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

Collapse empty ad spaces (element hiding) #155

Merged
merged 8 commits into from
Oct 6, 2022

Conversation

dharb
Copy link
Contributor

@dharb dharb commented Oct 2, 2022

This PR adds the element-hiding.js content script, which is injected into pages to hide empty ad spaces. This is similar functionality to what most ad blockers call 'cosmetic filtering' with one key caveat: we are only hiding spaces where ads didn't load due to blocked tracker requests. To accomplish this we use a heuristic to check each ad container selector for visible content, and only hide if no visible content (eg non-tracking ads) is found.

Initially this feature will only be enabled in the macOS app, with other client support to come as follow ups. This feature is v1, we will likely follow up with a more sophisticated approach in the near future.

This script functions based on Privacy Configuration rules so that coverage may be expanded remotely without requiring updates to this repo or clients.

To see this functionality in action, navigate to a site that has a large blank space at the top of the page where a tracking banner ad didn't load, and see that the empty space is hidden shortly after page load. A few example sites to check are bloomberg.com, cyclingtips.com, and fandom.com.

Asana link: https://app.asana.com/0/0/1203092629639220/f
Corresponding privacy config PR: duckduckgo/privacy-configuration#508

@jonathanKingston
Copy link
Contributor

As mentioned in MM this is working well in Firefox and Chrome nicely too (with #157 for FF).

@dharb dharb force-pushed the dharb/element-hiding-testing branch from ca8b3e1 to 48322e5 Compare October 6, 2022 17:38
Copy link
Contributor

@jonathanKingston jonathanKingston left a comment

Choose a reason for hiding this comment

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

This is great! Thanks for your hard work :)

@jonathanKingston jonathanKingston merged commit 4c3dd55 into main Oct 6, 2022
@jonathanKingston jonathanKingston deleted the dharb/element-hiding-testing branch October 6, 2022 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants