I wrote a jquery dfp plugin that allows you to do exactly this.
It allows you to target the domain, url and query parameters of the url.
Take a look at the Default targeting section on the github page, it sounds like you might want to use the inURL targeting... to do that you just need to add a new custom targeting string of inURL within the inventory section of the DFP admin and then you can set the Customised criteria in the ad targeting section of the line item and everything should just work... any questions let me know.