On several mediawiki installations I run I have added the Google Analytics
code to the <head> of each page. I couldn't find any way to do this other
than directly inserting it into the code for includes/OutputPage.php
The code in question is to load an external .js file from Google's
servers, and then call a method on it.
Question 1: Is there some alternative to modifying this file that I've
missed? I know that there's the option for user-specific javascript, but
I'm looking for something similar, where I can edit a page to change the
JavaScript used by everyone.
Question 2: Assuming not, what would the consensus be on providing some
way of doing this? On one of my installations I forgot to re-modify this
file after an update, and lost a week's worth of tracking data. I'd
really like to find a way to factor this out so that I don't do that
again. I also suspect that other people would like this facility -
either for adding the Google code, or for other reasons.
My knowledge of the internals isn't good enough to do this myself yet,
but if it's deemed useful I'm willing to have a go at it if people could
give me a few pointers.
Thanks,
Tony