I am looking for
Contextual and Programatic Advertising
Firstly content and placements are categorized when the URL on the website is scanned by a web crawler.
Secondly when a user is on the page the URL information is passed to the ad server. It now matches with the data from the web crawler to provide the right match to relevant topics/ keywords/campaigns.