...slogans are forgotten like fairy-tales were
Blog » Silverstripe: How to insert Google Analytics code (or any other custom code) at the end of a head section?
Of course you know how to obtain Google Analytics code, but I'll remind you anyway:
With the following snippet you can place any custom code into the head section very close to an end-tag. The code does it on one of the late stages of the execution, so there are small changes that other code will write something after you:
Yep, I just overloaded Controller::getViewer() in my Page_Controller and did my stuff just before calling the parent method.
# Page::init(): Requirements::customScript('alert("Put your code here!")');
I think it's wise to put it into your mysite/_config.php