Filter Analytics
// newClass for gaFilter extends sfFilter class gaFilter extends sfFilter { public function execute($filterChain) { // anything before action $filterChain->execute(); // Find google code and check if current module is not disabled if(($gaCode = sfConfig::get("app_ga_code",false)) !== false && !in_array($this->getContext()->getModuleName(),sfConfig::get("app_ga_disabled_modules",array()))) { //RResponse with the tracker code. $response = $this->getContext()->getResponse(); $response->setContent(str_ireplace('</body>', $gaCode.'</body>',$response->getContent())); } } }
Here's a filtered analytics code. <a href="http://www.asgames.net">Funny Games</a>
Most popular snippets