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…')
m
 
(2 intermediate revisions not shown)
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>
 +
[root@www ~]# cd /var/www/vhosts/wbitt.com/httpdocs/templates/ja_purity_ii/layouts/blocks
 +
</pre>
 +
 +
Change :
 +
<pre>
 +
<!--[if IE 7.0]>
 +
<style>
 +
.clearfix { display: inline-block; } /* IE7xhtml*/
 +
</style>
 +
<![endif]-->
 +
 +
<script type="text/javascript">
 +
var siteurl='<?php echo $this->baseurl();?>';
 +
var tmplurl='<?php echo $this->templateurl();?>';
 +
</script>
 +
</pre>
 +
 +
To:
 +
<pre>
 +
<!--[if IE 7.0]>
 +
<style>
 +
.clearfix { display: inline-block; } /* IE7xhtml*/
 +
</style>
 +
<![endif]-->
 +
 +
<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>
 +
 +
<script type="text/javascript">
 +
var siteurl='<?php echo $this->baseurl();?>';
 +
var tmplurl='<?php echo $this->templateurl();?>';
 +
</script>
 +
 +
</pre>
 +
 +
 +
<b>OR</b>
 +
<pre>
<pre>
-
[root@www layouts]# pwd
+
[root@www ~]# cd /var/www/vhosts/wbitt.com/httpdocs/templates/ja_purity_ii/layouts/
-
/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-joomla.php  
Line 9: Line 59:
</pre>
</pre>
-
Add the code: from the google analytics page of your website's profile page:
+
Now, add the code: from the google analytics page of your website's profile page:
Before editing:
Before editing:

Current revision as of 18:16, 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 ~]# cd /var/www/vhosts/wbitt.com/httpdocs/templates/ja_purity_ii/layouts/blocks

Change :

<!--[if IE 7.0]>
<style>
.clearfix { display: inline-block; } /* IE7xhtml*/
</style>
<![endif]-->

<script type="text/javascript">
var siteurl='<?php echo $this->baseurl();?>';
var tmplurl='<?php echo $this->templateurl();?>';
</script>

To:

<!--[if IE 7.0]>
<style>
.clearfix { display: inline-block; } /* IE7xhtml*/
</style>
<![endif]-->

<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>

<script type="text/javascript">
var siteurl='<?php echo $this->baseurl();?>';
var tmplurl='<?php echo $this->templateurl();?>';
</script>


OR

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

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

[root@www layouts]# vi default.php 

Now, 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