Since this needs to appear just above the /body tag, you will probably need to make a new partial (as in .rhtml file) and then render it from each of these layouts: application, blank, simple, and noside. Of these application is the most important.
That partial should just include all the google analytics code, inside a big if. If you have the key, then show the code.
Here's how you'd get the card in that context:
Notes from Aaron and Lew taking about this 6/26//08:
The main thing you need to know for it is how to get the card from the cache, and the api is a little goofy there:
would be something like c=CachedCard.get_real('*ga_key'); key=c.content
wagn caches 'missing' cards now, so whether you have a key or not after the first lookup it won't cause a db hit.
--Ethan McCutchen.....Thu Jul 17 10:55:54 -0700 2008