We help IT Professionals succeed at work.

embedding tracking code in my joomla website

Hi Folks,

I'm trying to embed a Googles Analytics tracking code to my joomla site. I downloaded a plugin that should allow this to happen but it's not.

under basic options the plug in asks for a path to add to all pages.
"You can use the following syntax in your articles, modules, HTML:
{embedscript} path to your script {/embedscript}
IMPORTANT: Do not put a space between end of the path and {/embedscript} (This may be improved in further plugin versions).

{embedscript}/website name.com/.google-analytics.com/ga.js
var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-99999999-9']);
  _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);
  })(); {/embedscript}

I don't understand where I'm screwing up. I've included the Google tracking code.
Thanks
dlewis
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-99999999-9']);
  _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>

Open in new window

Comment
Watch Question

Panagiotis Sweb developer - designer
CERTIFIED EXPERT

Commented:
why dont you use a plugin like bigshot that does it automatically
IT Manager
Commented:
dlewis61,

Both suggestions above fail to mention that the easiest way to add this code is to add it directly into your template's index.php page.

You can find that page at this location of your Joomla site:

Joomla Site Root/templates/<current template name>/index.php

You will need to add the script within the header section of the page, but once you do, it's good for the entire site.

This is the easiest and MOST effective way to add your Google Analytic's code.
CERTIFIED EXPERT
Commented:
You have to disable your text editor before, add your code {embedscript} path to your script {/embedscript} , save, then enable your text editor.

dlewis61, I don't really agree because the average "user" of a joomla site is going to depend on the built-in editor and not know how to edit a php file or use ftp.
lenamtl, I wouldn't do it that way because it ruins the user's ability to use the wysiwyg editor.
Panagiotis Sweb developer - designer
CERTIFIED EXPERT

Commented:
My friend is very easy, download the plugin i told you or any other and just put the UA-99999999-9

that's all
Abhijeet RananawareWeb & Mobile Developer
Commented:
Use Following plugin to add google analytics to your site

Bigshot Google Analytics

http://extensions.joomla.org/extensions/site-management/site-analytics/6170

Regards,
Abhijit
Panagiotis Sweb developer - designer
CERTIFIED EXPERT

Commented:
i have told you about plugins at the first post :)

Explore More ContentExplore courses, solutions, and other research materials related to this topic.