If I wanted to offer a service that required adding code to a page, how could I do this without access to the code? The closest I can think of is Cloudflare apps. A good example is the analytics app. If you use cloudflare (ie point your DNS at them) you can enable the analytics app and it will inject the code onto all of your pages.
I'd like to do something similar. Could have our own cloudflare app, but then we're tied to someone else's service. Presumably we could also set up our own DNS server from scratch, but unless there is an out of the box solution that lets users manage their own DNS that sounds painful.
What kind of code?
If it's HTML/CSS/Javascript, you can do this with Optimizely. I've added forms and CSS. I haven't done anything with JS, but at least in theory it should be just like CSS (and JQuery is always available). There will be a slight lag possibly on a slow connection on first page load.
It's an A/B testing tool, but basically you build your test and then just have it run the "test" version 100% of the time.
Initially it would be javascript. Optimizely aren't very open about their pricing, but I believe their cost would be VERY significant with the numbers we're looking at (hundreds of millions of pages per month). Performance would be a huge issue though, so definitely don't want to write it in with javascript.