New Google Analytics module

26 posts / 0 new
Last post
#1 Thu, 03/15/2007 - 22:59
Joe
Joe's picture

New Google Analytics module

Hi all, <p> Continuing our recent theme of "awesome things nobody has even thought of yet", I've just rolled out a new (somewhat experimental) module to make it easy for your users to make use of[a href="http://www.google.com/analytics/">Google Analytics</a>. As you know, Virtualmin automatically sets up Webalizer and AWstats, which are cool packages. But, there's a lot of data about website usage that neither of those packages has easy access to. Conveniently, Google does, and they let you see it for free in the form of really nice looking graphs. All around Google Analytics rocks pretty good, but I don't know many people using it, because it requires a few tricky bits. This module takes away a couple of the tricky bits (you still have to sign up and get an ID). <p> The way this module works is it automatically adds a mod_perl filter to your Apache process for any domains for which Analytics is enabled. The filter injects the magic JavaScript string with the users ID in just the right place on every page, no matter how it was generated (static HTML put in place via FTP/SSH or the WYSIWYG editor, PHP script, Perl script, Ruby script, SSI, whatever). Your user doesn't need to know where to edit template files or even how to edit HTML, and they don't have to ask for any customer support, either (probably...we'll have to see if the UI provides enough guidance for folks). <p> Anyway, this module rocks and I've already started using it, and Jamie is a bloody genius (I watched him write it during dinner at YCombinator Tuesday night while James Hong was talking about[a href="http://hotornot.com">HOT or NOT</a>). <p> Now, of course, you'd like to get on with it! So, to install it, first make sure you've got mod_perl. I believe this is kinda default for everybody except the Debian-ites and Ubuntuns. So, for you guys, we'll add an extra package to your install list (we might need to configure it too...I'll have to poke around a bit to see, and will post more to this thread in the news forum later). <p> To install on Red Hat based systems: <p> yum install wbm-virtualmin-google-analytics <p> On SUSE systems: <p> yast -i wbm-virtualmin-google-analytics <p> On Mandriva systems: <p> urpmi.update -a urpmi wbm-virtualmin-google-analytics <p> And on Debian and Ubuntu systems: <p> apt-get update apt-get install webmin-vritualmin-google-analytics libapache2-mod-perl2 <p> To install on systems using .wbm and .wbt packages, download the module from: <p> http://software.virtualmin.com/wbm/virtualmin-google-analytics-1.0.wbm.gz <p> Using your serial number as the username and your license key as the password. Then install it using the Webmin Modules module. <p> Finally, you'll have to enable it for any domains that you'd like to use this feature on. Once enabled, the domain owner can click the Google Analytics option from the Services menu and fill in their UID (which is an identifier that looks like "UA-2498289-1", which you get by signing up at the Google Analytics page). <p> As always, let us know about any bugs you find. And let us know if you or your users find the UI uninformative or difficult to use. It's a sort of vague concept, but we believe it's a lot easier than figuring out which files need to be edited within your CMS, blog, wiki, issue tracker, whatever, as well as every static page you serve up. (Also, feel free to tell all of your web developer and system administrator friends how awesome Virtualmin is for automating this.)

Fri, 03/16/2007 - 07:39
tabletguy

&quot;Once enabled, the domain owner can click the Google Analytics option from the Services menu&quot;

This implies (to me) looking under &quot;Virtualmin-&gt;Services&quot;.

I didn't find it there. After a lot of searching, I found it under Webmin-&gt;Servers-&gt;Google Analytics Reporting.

If I click on a domain name (to activate), it says Error 404, page not found for every domain, so it's not working for me...

Fri, 03/16/2007 - 08:06
ADobkin

Be careful - this module appears to be a bit buggy right now! See details below....

First, these are the steps I used to set it up:

1) Using the Virtualmin Framed Theme, expand the System Settings category and click on Plugin Modules. (If you're using another theme, this should appear as a button near the bottom of the main Virtualmin page.)

2) Control-click to enable the Google Analytics Tracking plugin, and click Save.

3) Select the domain you wish to add this feature to, and click on Edit Virtual Server.

4) Under the Enabled Features section, select &quot;Enable Google Analyics tracking?&quot; and click Save Virtual Server.

5) Now, under the Services category in the left frame menu, click on the new option for Google Analytics Account (for that same domain).

6) Click on Set To, enter your UID, and click Save.

Now, here's the bad part: ALL OF MY WEBSITES WERE COMPLETELY DOWN! Apache refused to start, with the following error:

failed to load Virtualmin::GoogleAnalytics package

... along with a long list of Perl errors prior to that, which I can post separately.

So, I quickly tried to disable this module to undo what it did so I could get Apache to start back up. First, I tried to disable the plugin entirely. That didn't work. Then, I re-enabled the plugin so I could disable it from the one server I added it to. That didn't work either. Finally, I found the lines that it added in apache.conf for that virtual server and commented them out:

#PerlRequire /etc/webmin/virtualmin-google-analytics/apachemod.pl
#PerlOutputFilterHandler Virtualmin::GoogleAnalytics
#PerlSetVar AnalyticsID UA-xxxxxxx-x

At that point, I was able to restart Apache successfully (without this feature).

Fri, 03/16/2007 - 09:11
sgrayban

I had the same problem that post #3 had and have completely removed this module. It is VERY unstable and should be considered ALPHA code and NOT BETA which would imply that it is pretty much stable and it isn't.

Needs much more testing before actual usage.

But really is this module needed? The GA code is so simple to put into the website pages I think this module is more of a toy then a helpful module.

Fri, 03/16/2007 - 23:05 (Reply to #4)
Joe
Joe's picture

Hey Scott,

<i>I had the same problem that post #3 had and have completely removed this module. It is VERY unstable and should be considered ALPHA code and NOT BETA which would imply that it is pretty much stable and it isn't.

Needs much more testing before actual usage.</i>

Yep, it freaks out with old mod_perl. Sorry for the inconvenience. There's a new version that won't freak out, and will safely refuse to work with mod_perl 1.99 and below. I'm packaging mod_perl2 for everyone now.

<i>But really is this module needed? The GA code is so simple to put into the website pages I think this module is more of a toy then a helpful module.</i>

For you and me, it's super easy. For someone who wants to run a blog or wiki or forum (and used Install Scripts to install it) while still getting good analytics, it's probably not easy at all...maybe even impossible. You have to know where to find the end body tag in the right templates directory within your application(s)--and you need to know how to edit HTML to insert it without breaking things.

These are assumptions that we can safely make about most of our current users--like you and Alan--but going forward we want everyone (<i>everyone</i>, <i><b>everyone</b></i>) to be able to make interesting, good looking, and useful web pages, and learn useful things about their readership. As you know, we're building tools for the hard core guys like you, and we've been doing that for years. But now, we're trying to make Virtualmin useful for the folks who have never built a website. Screwing up your Apache configuration is clearly not the right way to do that--so we went back to the drawing board quick-like--but allowing non-technical Virtualmin users to make use of cool tools like Google Analytics is definitely a win for most of those folks.

I actually find it pretty nifty too--because I no longer have to think about &quot;OK, did I get that tag added to all of my various applications in all of my various templates and subdirectories&quot;. We'll be running several applications when the new website goes live (instead of the single platform we have now), and getting all of them into analytics is important to me. When it's working right it adds the tag to every page served by Apache for the entire domain--no thought or searching for where to add it needed.

I believe our botched roll-out has given you a bad impression of the whole idea. Hopefully, when we get it fixed, you'll come around. ;-)

--

Check out the forum guidelines!

Fri, 11/16/2007 - 06:38 (Reply to #5)
PlayGod

As far as I can tell, I've got the prerequisites...
mod_perl 2.0.2-6.3.el5
Google analytics account, functional

I removed the urchin script from the footer of my wordpress template (was working fine and allowing Google data collection).

I have entered my Google Analytics account ID in &quot;Virtualmin Analyics&quot; (sic) for the domain, however Tracking Status reports &quot;Enabled but no account set&quot;

I can't see any urchin script code inserted when I view source... is it inserted in apache header, or is supposed to be inserted in the html?

Fri, 11/16/2007 - 07:12 (Reply to #6)
PlayGod

Update: it apparently was &quot;somewhat&quot; working, because it was adding an abbreviated urchin script to standard HTML files... but not php files.

Fri, 11/16/2007 - 09:45 (Reply to #7)
PlayGod

&quot;not php files&quot; = &quot;not Wordpress&quot;

I haven't tried the analytics deal with other php scripts/templates yet. I mostly use phpBB, Wordpress and Joomla.

Fri, 11/16/2007 - 09:50 (Reply to #8)
Joe
Joe's picture

Hmmm...Strange. There is an update to that module going into the repo today, so maybe there's a bug that I wasn't aware of.

It should work on HTML, PHP, CGI, whatever. That's the fancy thing about it. If it doesn't work in all of those contexts, then it fails at being fancy...and we refuse to fail at being fancy. ;-)

--

Check out the forum guidelines!

Fri, 03/16/2007 - 10:37
ADobkin

FYI, I have submitted the following bug reports:

&lt;A HRef=&quot;http://www.Virtualmin.com/bug-tracker/bug?bug%5fnumber=715&quot;&gt;Bug #715&lt;/A&gt;: New Google Analytics Plug-in Breaks Apache

&lt;A HRef=&quot;http://www.Virtualmin.com/bug-tracker/bug?bug%5fnumber=716&quot;&gt;Bug #716&lt;/A&gt;:Error Disabling Google Analytics

&lt;A HRef=&quot;http://www.Virtualmin.com/bug-tracker/bug?bug%5fnumber=717&quot;&gt;Bug #717&lt;/A&gt;:Google Analytics Reporting Module Error

&lt;A HRef=&quot;http://www.Virtualmin.com/bug-tracker/bug?bug%5fnumber=718&quot;&gt;Bug #718&lt;/A&gt;:RFE: Google Analytics Reporting Module vs. Virtualmin Plugin

Fri, 03/16/2007 - 22:50 (Reply to #10)
Joe
Joe's picture

New 1.1 has been released which refuses to break your Apache config if only the old mod_perl is available. I'm packaging mod_perl2 for everyone as we speak to correct remaining issues.

--

Check out the forum guidelines!

Tue, 11/20/2007 - 20:07
PlayGod

Looks like it's working properly on standard versions of Joomla 1.0, 1.5 and Wordpress.

The particular Wordpress install I was having trouble with, I ended up doing the manual Google urchin script method (put urchin code in the footer.php theme file).

I haven't figured out the problem yet, and I probably won't sweat it... it could be a template issue... The auto-inserted analytics code is displaying on the admin pages and every other HTML or PHP page.

<b>And that may be a problem... I don't really want my admin pages tracked by Google.</b> The nice thing about Google Analytics is that it tracks only your relevant content and legitimate visitors. Tailoring the logfile analysis tools to do the same thing is more difficult.

Also, a small criticism/correction: Analytics is misspelled Analyics (missing &quot;t&quot;) most places in Virtualmin.

notice that &quot;analytics&quot; is spelled with a &quot;t&quot; ;&Acirc;&not;)&lt;br&gt;&lt;br&gt;Post edited by: PlayGod, at: 2007/12/21 15:24

Tue, 11/20/2007 - 22:40 (Reply to #12)
Joe
Joe's picture

<div class='quote'>Also, a small criticism/correction: Analytics is misspelled Analyics (missing &quot;t&quot;) most places in Virtualmin. </div>

I believe this is fixed in the version of the module I rolled out a couple of days ago, but I'll double check.

--

Check out the forum guidelines!

Wed, 11/21/2007 - 04:50 (Reply to #13)
PlayGod

Misspelled on &quot;Edit Analyics Accounts&quot; &quot;Virtualmin Analyics&quot; and in the checkbox choices on &quot;Edit Virtual Server&quot;

my v 1.5-1 is still reporting &quot;Enabled but no account set&quot; on &quot;Virtualmin Analyics&quot; page, though I have definitely enabled working accounts on several domains.

FYI

Webmin version 1.380
Virtualmin version 3.48 (Pro)
Operating system CentOS Linux 5
Apache version 2.2.3
PHP version 5
MySQL version 5.0.22

Fri, 12/21/2007 - 06:11 (Reply to #14)
nhsitehost

There is an update to the javascript code located on the google site.
will this new code be implemented soon?

Sat, 12/22/2007 - 02:29 (Reply to #15)
nhsitehost

here is a sample of the new code

old code:
[code:1]
&lt;script src=&quot;http://www.google-analytics.com/urchin.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
_uacct = &quot;UA-XXXXX-1&quot;;
urchinTracker();
&lt;/script&gt;
[/code:1]

new code:
[code:1]
&lt;script type=&quot;text/javascript&quot;&gt;
var gaJsHost = ((&quot;https:&quot; == document.location.protocol) ? &quot;https://ssl.&quot; : &quot;http://www.&quot;&Acirc;&laquo;&Acirc;&raquo;);
document.write(unescape(&quot;%3Cscript src='&quot; + gaJsHost + &quot;google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E&quot;&Acirc;&laquo;&Acirc;&raquo;));
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
var pageTracker = _gat._getTracker(&quot;UA-XXXXX-1&quot;&Acirc;&laquo;&Acirc;&raquo;);
pageTracker._initData();
pageTracker._trackPageview();
&lt;/script&gt;
[/code:1]
<div class='quote'>from google:
Use this tracking code to gain access to a wide range of exciting new features as they become availabl
</div>

Sat, 12/22/2007 - 17:28 (Reply to #16)
PlayGod

<div class='quote'>as they become available</div>
So it's currently vaporware?

I'll take a look at my Analytics account next week to see if it's worth upgrading my urchins.

I would avoid this module anyway, it drops the urchin in every single html file rendered by the server, which is overkill and will give you more analytics results than you need.

It's really better to just put it in your page templates so it only shows up on the pages you want to track.

Sun, 03/02/2008 - 07:48 (Reply to #17)
i4tas

Anyone figure out a way to fix the fastcgi with php problem?

Mine works great with html sites... but my php sites don't connect.

Tue, 03/04/2008 - 16:16 (Reply to #18)
Fri, 12/21/2007 - 15:22
PlayGod

unless the prot://sub.domain.tld.path/name.ext of the js has changed, it should be automatic. The js call the module inserts is http://www.google-analytics.com/urchin.js

Fri, 02/29/2008 - 23:08
phynias

doesn't seem to work if you are using fastcgi with php

Mon, 03/03/2008 - 14:56 (Reply to #21)
Joe
Joe's picture

<div class='quote'>doesn't seem to work if you are using fastcgi with php</div>

That would be a bug. I dunno if it's one we can fix, but it's worth filing a ticket about it, just in case.

--

Check out the forum guidelines!

Wed, 03/12/2008 - 13:21
CharlesMason

Hi Joe,

You need to update the URL for the wbm, as you reference v1.0 versus the current v1.7. Also is there an easier way to have webmin remember virtualmin URL to check for updates on these modules?

Thanks,
Charles

Mon, 09/14/2009 - 21:58
dpowers

Some mobile handsets support the OMA download standard that sends a download descriptor file with a .dd extension to the mobile handset. The mobile handset then reads this file and makes a connection to collect the content specified in the file. Once the content is download to the handset the handset again looks at the file for any call back url to call and confirm that the content has been download fully.

My problem is that the GA plugin is appending its javascript to the .dd file sent to the handset. This file has a very strict standard and although some handsets ignore anything that comes after what the expect by the standard most will break.

So it would be nice if the GA plugin only appended the JS to recognized file extensions eg. .htm, .html, .php etc OR even better would be to add the functionality to have an exclusion list, maybe allow regexes, this could excluded all matching file extensions or even file that have copy that matches anything in the exclusion list etc?

Mon, 09/14/2009 - 22:04 (Reply to #24)
andreychek

Howdy,

Sounds like you may want to submit a feature request/bug report regarding that, so Jamie can take a look.

And then he can offer is what you're after is already possible -- or if it's not, he'll be able to work with you to figure out the best way to handle that.

Thanks!

-Eric

Sun, 10/26/2014 - 23:11
uri

Server version: Apache/2.4.6 (CentOS) Server built: Aug 7 2014 14:28:12 Installed Packages Name : mod_perl Arch : x86_64 Version : 2.0.8 Release : 10.20140624svn1602105.el7 Size : 6.2 M Repo : installed From repo : epel

I have a question about Virtualmin Google Analytic module breaking my fancybox with: setTimeout(‘document.location = “‘ + link.href + ‘”‘, 100);

Is there a way to edit the module so it inserts a different google standard tracking script that doesn't break fancybox?

Topic locked