There are many way to achieve this, and one that is most obvious to developers is modifying the master pages or page layouts. This would work perfectly fine, but a ‘cleaner’ (and Microsoft recommended) way would be to use Delegate Controls.

To inject mark-up into the Delegate Control, three things are required:
- A Feature.
- A User Control.
- Element manifest to ‘link’ the User Control and Delegate Control.
For example:

When the feature is activated, the content of UserControl.ascx would be injected into the Delegate Control. This means a jQuery reference, or JavaScript for Google Analytics can be added without modifying and redeploying the masterpage/page layout. An added bonus is that the mark-up can be injected/removed by activating/deactivating the feature.
Posted by Alan Shum
