Regular expression magic.
A lot of ad networks have a pattern to the name or the window the advert appears in.
Using regular expression you can find just the adwindow and ignore the actual content.
Now what is regular expression? A wizard language.
ask any programmer about RE after 4 beers and watch the hate wash over their face.