AdDealer is Marfeel's algorithm responsible for identifying the best places to make impressions in an article. It also manages the ad frequency in terms of how close the ads are displayed to each other and controls the aggressiveness of the number of ad impressions made.
It works by essentially breaking the article down into visual blocks and spots the most optimal locations to insert advertisements and how to space them apart. A typical block would be a paragraph of text or an image. The process is made up of taking the article's HTML code, parsing it to create blocks, merging adjacent blocks (for example, an inner title and a paragraph of text) into visual blocks, and then deciding the best places to insert ads that will maximize the CTR of the ads while promoting user engagement.
To provide an organic flow of page elements, AdDealer uses a distribution function to balance the text, media, to properly frame an article and publication.
AdDealer is able to do this for differing HTML code due to its built-in intelligence and its defined parameters. For example, it ensures fundamental components of an article like the date and author are never separated from the title, that an image and its caption are always presented together, or that a section title is never split from its first paragraph.
It's able to perform this complex function for so many diverse client web pages due to its sophisticated use of heuristics, which in the simplest of terms, is the implementation of an efficient set of rules to make decisions. For a data set, heuristics must fulfill the needs of that data set. AdDealer's heuristics must fulfill the needs of a very large data set that's made up of our 400+ clients. That's why any change we perform in AdDealer is always a significant improvement that adds value.
In this article, we explain how AdDealer works and the different modifiers and mediators in place to ensure impressions are made in the optimal places in an article.
Creation of Visual Blocks
The first function AdDealer performs is to create visual blocks once we have obtained the publisher's HTML code.
To do this we use a TreeWalker through the DOM that parses the HTML and validates or invalidates the content with a filter to detect the tags, links, text, and so on.
Once we have this TreeWalker we move through the notes of the tree and generate visual blocks.
AdDealer takes the featured image or top media for the article from the best image available in the body and removes it from there and any caption that might come with it.
Taking the best image from the body not only adds an impactful and rich image that enhances a publisher's content, it also offers a perfect scenario for Marfeel to increase and leverage high quality ad inventory.
It should be noted, however, that there is also a flag that can be configured to prevent the caption from being removed from the top media.
A media remover parameter also exists that when enabled, inhibits the image from being eliminated from the body of the article regardless of its location.
Visual Block Mergers
An example of a visual block could be an image with its caption. Although they might be adjacent blocks, they are merged to create one visual block so that ads are not inserted in-between.
This process of merging the visual blocks that have been parsed is governed by the 7 non-configurable mergers that AdDealer checks with.
1 - Calculating images as a percentage of words (InlineImagesMerger)
AdDealer calculates the images in an article as a percentage of words when merging visual blocks and inserting ads.
A larger image will be calculated as an appropriate percentage of words, whereas an icon would be merged and treated according to its small size. For example, if an image is smaller than 130 pixels, it's not counted as an image at all.
2 - Images merged with captions (MediaWithTextMerger)
AdDealer has a merger that ensures images are merged with any captions they might come with.
If AdDealer doesn't detect any caption text, it will try to insert ads by text blocks and not images. Research shows that ads right before or after images perform weaker than those inserted closer to text blocks.
For articles that are image heavy, AdDealer will try to place ads in the best positions to optimize CTR.
3 - Forbidden positions (ForbiddenNodesMerger)
AdDealer ensures that no ads are placed between blockquotes, links, or lists.
4 - Top of article elements (BlocksBeforeTitleMerger)
AdDealer removes any extraneous elements above the article.
5 - Links and single elements (OneLetterBlocksMerger)
One letter blocks refer to elements such as links embedded in one word that might be treated as a visual block. In this case, AdDealer merges this block with the next one.
6 - Top of content elements (FirstShortVisualBlocksMerger)
AdDealer treats any elements at the top of the article such as the category, author name, dates, sections, or other small text individually, meaning it does not remove or attach it to another block.
7 - Small blocks below the article (TagsMerger)
Any small blocks identified below the article title such as tags are treated as an individual block and therefore are not merged with another block or removed.
Once the AdDealer has visually processed an article and has created a visual block representation it's time to insert elements in between: