023 - Create a module to embed Google Analytics into Joomla! v 1.5.

Google's Highly Open Participation Program tries to get young students into Open Source and Joomla! specifically. Everyone is welcome, there are not limits. You can be a coder, documenter, tester, translator to help out. Jump in and start helping!
neonkoala
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Fri Jul 27, 2007 2:30 am

Re: 023 - Create a module to embed Google Analytics into Joomla! v 1.5.

Post by neonkoala » Mon Jan 07, 2008 10:32 pm

AmyStephen wrote: I see what I did.  :-[

I downloaded your zip file - and then installed a zip file named mod_analytics.zip already on my desktop from Nick Dawson from v 1.0.x.
Just so you know it is a v1.5.0 module, I made it as I was aiming to make a non-legacy site.

:) Nick

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7056
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 023 - Create a module to embed Google Analytics into Joomla! v 1.5.

Post by AmyStephen » Mon Jan 07, 2008 10:35 pm

Nick -

kilps extension has nothing to do with yours. It was my mistake.

Thanks!
Amy :)

wes_517
Joomla! Intern
Joomla! Intern
Posts: 64
Joined: Mon Aug 20, 2007 7:43 pm

Re: 023 - Create a module to embed Google Analytics into Joomla! v 1.5.

Post by wes_517 » Fri Jan 11, 2008 6:47 pm

hit a bit of a snag in trying to do a reinstall to fix the '; part on my site.

when i uninstalled then reinstalled the module I saw these errors.

it looks like it did install, but I wanted to let you know.
You do not have the required permissions to view the files attached to this post.

joncz
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Thu Mar 27, 2008 12:06 am

Re: 023 - Create a module to embed Google Analytics into Joomla!

Post by joncz » Sat Apr 12, 2008 8:23 pm

I modified the original code to use the new ga.js analytics code. Backup your default.php file in the modules/mod_googleanalytics/tmpl directory and replace with the following code:

Code: Select all

<?php // no direct access
defined( '_JEXEC' ) or die( 'Restricted access' ); ?>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("<?php echo $uacct; ?>");
pageTracker._initData();
pageTracker._trackPageview(<?php echo $title; ?>);
</script>
This version renders the Use SSL parameter moot as the new analytics script detects whether each page was loaded with HTTPS and uses the appropriate call accordingly.

I also retained the $title usage, though in my experience, it's not exceptionally useful as it was implemented.
Jon Czerwinski
Vice-President
Cohn Consulting Corporation
http://www.cohnconsultingcorp.com/
http://www.linkedin.com/in/joncz/


Locked

Return to “Google's Highly Open Participation Contest”