Is there anyway to add code to template files to display ads

I would like to target slide in ads based on the current category that a post is in. There does not seem to be that option built in so I was wondering if there are any function calls I can put in my template files to get ads to show in certain scenarios