You can achieve that using a script tag if the stuff you are injecting isn't anything too crazy.
Alternatively if it's an entire page you could use an application proxy.
For a combination, I'm not entirely sure, but that might require either relying on theme changes or by making changes to a theme. This is fragile though because if a merchant changes to a new theme all your changes would be lost.