Installing Google Analytics on Joomla

From WBITT's Cooker!

(Difference between revisions)
Jump to: navigation, search
(Created page with '<pre> [root@www layouts]# pwd /var/www/vhosts/wbitt.com/httpdocs/templates/ja_purity_ii/layouts [root@www layouts]# [root@www layouts]# vi default-joomla.php [root@www layout…')
Line 1: Line 1:
 +
JA_Purity_ii is different template than the normal Joomla template. Edit HTML in the templates web interface does not provide the place to put in the google script code.
 +
<pre>
<pre>
[root@www layouts]# pwd
[root@www layouts]# pwd

Revision as of 16:28, 5 March 2011

JA_Purity_ii is different template than the normal Joomla template. Edit HTML in the templates web interface does not provide the place to put in the google script code.

[root@www layouts]# pwd
/var/www/vhosts/wbitt.com/httpdocs/templates/ja_purity_ii/layouts
[root@www layouts]# 

[root@www layouts]# vi default-joomla.php 

[root@www layouts]# vi default.php 

Add the code: from the google analytics page of your website's profile page:

Before editing:

<head>
<?php $this->loadBlock('head') ?>
</head>

After editing:

<head>
<?php $this->loadBlock('head') ?>
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-838bzay-x']);
  _gaq.push(['_trackPageview']);

  (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>
</head>
Personal tools