Hi,
how would you do this?
In the main layout I include the google analytics javascript like this.
#javaScriptIncludeTag("google-analytics.js")#<!--- Google-Analytics Code --->
The analytics code is like this:
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12345']);
_gaq.push(['_setDomainName', '#CGI.server_name#']); // TODO: How to dynamically pass the current domain?
_gaq.push(['_trackPageview']);
_gaq.push(['_trackPageLoadTime']);
(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);
})();
How do I dynamically pass the current domain to the javascript?
In the moment it is shown like #CGI.server_name# in the browser, but it should be like
mydomain.comAny help is appreciated
Thorsten