Would this not be better in the global_complete hook location with something like:
PHP Code:
if ($vbulletin->options['ga_enable']) {
$vbulletin->config['google_analytics']['replacementvariable'] = '</body>';
$output = str_replace($vbulletin->config['google_analytics']['replacementvariable'],
$code.$vbulletin->config['google_analytics']['replacementvariable'], $output);
}
This way you are anchoring onto the closing body tag as google instructs and the global_complete location is a better place to do this, not just for vbulletin itself but other addons which may use alternative templates for headers. footers etc.
The google code could perhaps be an additional temple for eval in which case it would want a cache plugin. A textarea option to add scipts to exclude the code from maybe quite a desireable feature to add. Was just a few thoughts, nice hack still.