/** * Activate the GoogleLogger * * @param $code mixed: * String the Google Analytics code to be used in the JS snippet or * String 'SiteConfig' for using the SiteConfig to configure this value or * Null if you hardcode the JS snippet into your template. The JS snippet will not be included through Requirements * **/ public static function activate($code = null) { switch ($code) { case null: self::$google_analytics_code = null; break; case 'SiteConfig': SiteConfig::add_extension('GoogleConfig'); break; default: self::$google_analytics_code = $code; } Controller::add_extension('GoogleLogger'); if (substr(GoogleAnalyzer::get_sapphire_version(), 0, 3) == '2.3') { Director::add_callback(array("GoogleLogger", "onAfterInit23")); } }