LogoLogo
About GitLabAcceptable Ads
  • Getting Started
  • Browser Ad-Filtering Solution
    • Features
    • Getting Started
      • Quickstart
      • Integrate the Solution
      • Set up user counting
    • Guides
      • User counting
      • Configure Solution settings
      • Run separate instances of the filtering engine
      • Update the Solution
      • Understand the snippets library
      • Create a filter list
      • Testing
    • Advanced
      • Services and classes
      • Sitekey
      • ADRs
      • Frame hierarchy
  • Snippets
    • Snippets Overview
    • Behavioral Snippets
      • abort-current-inline-script
      • abort-on-property-read
      • abort-on-property-write
      • abort-on-iframe-property-read
      • abort-on-iframe-property-write
      • array-override
      • cookie-remover
      • freeze-element
      • json-override
      • json-prune
      • override-property-read
      • prevent-listener
      • replace-fetch-response
      • replace-xhr-response
      • simulate-mouse-event
      • skip-video
      • strip-fetch-query-parameter
    • Conditional Hiding Snippets
      • hide-if-canvas-contains
      • hide-if-contains
      • hide-if-contains-image
      • hide-if-contains-similar-text
      • hide-if-contains-visible-text
      • hide-if-contains-and-matches-style
      • hide-if-has-and-matches-style
      • hide-if-labelled-by
      • hide-if-matches-computed-xpath
      • hide-if-matches-xpath
      • hide-if-matches-xpath3
      • hide-if-shadow-contains
    • Debugging Snippets
      • debug
      • log
      • profile
      • trace
    • Performance Snippets
      • race
    • Snippets Support by Platform
    • Node Highlighting
    • Accessing shadow DOM elements
  • Working with filters
  • DATA AND PRIVACY
    • Data collection at eyeo
Powered by GitBook
On this page
  • What are snippets?
  • How snippets work
  • Requirements for using snippets
  • Verify the Anti-CV filter subscription
  • Keeping the snippets library up to date
  • Update the snippets library

Was this helpful?

Edit on GitLab
Export as PDF
  1. Browser Ad-Filtering Solution
  2. Guides

Understand the snippets library

Last updated 1 year ago

Was this helpful?

What are snippets?

Snippets are pieces of JavaScript code, injected by the Ad-Filtering Solution, that execute within the context of a website and combat advanced ads that circumvent ordinary blocking.

How snippets work

A snippet is typically a JavaScript function. It may optionally take arguments.

Snippets are stored in a snippet library and selected for execution based on the content of a filter list. The filter list also specifies any arguments passed to snippets on a given website.

Multiple snippets with various arguments may be executed on a single website. For more on snippet functionality, view the Snippets Overview.

Requirements for using snippets

In order to execute snippets on websites, the following are required:

  • the snippet library of a sufficiently recent version must be built into the browser

  • the must be subscribed

Verify the Anti-CV filter subscription

The Anti-CV filter list is subscribed by default.

If it isn't in your configuration, you can subscribe to it the same way as you subscribe to any other filter list, through FilteringConfiguration or any of the platform-specific APIs.

Keeping the snippets library up to date

The snippet library may sometimes be updated separately from the remainder of the Solution by changing the tagged version.

Some changes to the snippets library may require alignment of the Solution. Consult the following compatibility matrix to see if a Solution version is compatible with a snippet library version:

Snippet library version
Required Solution version

0.5.1

105+

0.8.1

117+

1.2.0

123+

Update the snippets library

  1. Run gclient sync to pull the new version of the library to your local repository.

  2. Rebuild the browser (ninja -C out/...)

Remember to consult the compatibility matrix to avoid mismatches between the snippets library content and the Solution's expectations.

The version of the snippets library built into the Browser Ad-Filtering Solution is defined in the .

Set the new desired version in the .

Anti-CV filter list
DEPS file
DEPS file