public function headJs() { $domain = $this->wa->getRouting()->getDomain(null, true); $domain_config_path = $this->wa->getConfig()->getConfigPath('domains/' . $domain . '.php', true, 'site'); if (file_exists($domain_config_path)) { /** * @var $domain_config array */ $domain_config = (include $domain_config_path); $html = ''; if (!empty($domain_config['head_js'])) { $html .= $domain_config['head_js']; } if (!empty($domain_config['google_analytics'])) { $html .= <<<HTML <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', '{$domain_config['google_analytics']}']); _gaq.push(['_trackPageview']); {$this->wa->getResponse()->getGoogleAnalytics()} (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> HTML; } return $html; } return ''; }