Determining "context" for Portal APIs

I’m about ready to start distributing my game on some new portals (see my post in the Game forum to check it out). I don’t want to fork the game for each portal, but I’d like to make use of the different portals’ APIs (e.g., use Kongregate’s scoreboard if the game is being played there, Nonoba’s for there, MochiAds for elsewhere).

How would you recommend detecting the “portal context” for my game without requiring compiling and maintaining a different version for each portal?

My current thinking is to put it in the loader and just maintain a different loader for each portal. Anyone else run into this problem and found a good solution?