Understand the snippets library

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:

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 version of the snippets library built into the Browser Ad-Filtering Solution is defined in the DEPS file.

Starting from the release based on chromium version 139 the Solution automatically checks if there is an update available at eyeo sever and downloads the new library if available.

For older versions keep in mind that 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 preloaded snippets library

  1. Set the new desired version in the DEPS file.

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

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

Last updated

Was this helpful?