This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Install & configuration » Different Google Analytics Code per...

Different Google Analytics Code per Siteaccess

Different Google Analytics Code per Siteaccess

Sunday 20 January 2013 10:27:51 pm - 6 replies

Hi all,

It's possible to have a different Google Analytics code for each of my siteaccess's?

Thanks in advance,

João Duarte

Monday 21 January 2013 2:11:10 pm


Having a different GA code per siteaccess means that you have to create a design per siteaccess and a template per design, containing the GA code.

Monday 21 January 2013 6:12:30 pm

Or read the google analytics key in the template from an ini file, keep the same template for all siteaccesses and just change the ini.

Thursday 24 January 2013 6:02:24 pm


Many thanks for the answers... If I add one property to site.ini.append.php:


How can i read it in pagelayout.tpl? ... or in a template?

Also, how can I pass the value to the script?

Thanks again,

João Duarte

Thursday 24 January 2013 6:45:56 pm

Found the answer for my first question:

 {def $urchin = ezini('GoogleAnalytics','Urchin')}

Still don't know how to pass the variable from the template into the script...

Any suggestions?! ...



Thursday 24 January 2013 7:05:28 pm

Hi Joao, 

It can totally look like this: 

<!-- BEGIN GA tracker script -->
<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', '{/literal}{ezini('GoogleAnalytics','Urchin')}{literal}']);
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s)})();
<!-- END GA tracker script -->

I hope this helps,

Thursday 24 January 2013 7:30:27 pm

That's it!!

Thanks a lot for the help!!



You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from