Virtualmin Analytics Modules not inserting code - Ubuntu 16.04 PHP 7

9 posts / 0 new
Last post
#1 Fri, 03/24/2017 - 05:20
kiteplans

Virtualmin Analytics Modules not inserting code - Ubuntu 16.04 PHP 7

Hi,

I am building some new servers and when adding the Virtualmin Analytics Module I am unable to get it to add the code to the site.

When experimenting I am able to get the code to be added when using the "Preview Website" function:

For Example when viewing the source for

https:/hostname.com:8443/virtual-server/link.cgi/111.111.11.11/http://www.domain.org/

I can see

<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"> try { var pageTracker = _gat._getTracker("UA-23213123-3"); pageTracker._trackPageview(); } catch(err) { }</script></body>

But when I just run the domain directly the code is never inserted, I tried running straign via the IP addess as well, I also tried other sites, simple index.html pages etc.

I wonder if its because Apache can not execute the Perl CGI script via the domain user?? But I did then go ahead and add a simple Hello Perl Script under

/home/vdomains/domain.com/cgi-bin/echo.pl

With Content:

#!/usr/bin/perl
use strict;
use warnings;

print qq(Content-type: text/plain\n\n);

print "hi\n";

And that works? So I am not sure what is going on...

Any help would be much appreciated

Fri, 03/24/2017 - 10:02
unborn
unborn's picture

Hi kiteplans..

webmin / virtualmin uses by default apache access and error logs which will provide you in true nature with everything - dates, ips, etc...without any js or others....

I dont see any third party scripts to be out there to do anything to do with it.. perhaps I am wrong but you can use awstats for this.. ? besides I do block js in my browser by default and only allow handful sites to use it... so you know how those privacy things work...

Configuring/troubleshooting Debian servers is always great fun

Fri, 03/24/2017 - 10:22
kiteplans

There is nothing in the logs, I have looked many times but thanks for your suggestion

I’m a “Geek” serving as a Linux System admin, a website designer and maintainer and general know how for all things TECH. I am a fan of CentOS, Virtualmin, Joomla, and anything that uses Electricity. See more of my posts at http://www.dieskim.me

Fri, 03/24/2017 - 11:07
unborn
unborn's picture

eh if apache does not log whats happen on your server then - I guess is not set up correctly.. are you sure you dont see anything in apache logs?

Configuring/troubleshooting Debian servers is always great fun

Fri, 03/24/2017 - 19:33
kiteplans

Apache has logs...what I means is there is nothing about the Virtualmin Google Analytics not being run and code added, I have even changed apache logging to debug level and that did not even add anything about it. Other errors and access log fine, but nothing about this error.

I’m a “Geek” serving as a Linux System admin, a website designer and maintainer and general know how for all things TECH. I am a fan of CentOS, Virtualmin, Joomla, and anything that uses Electricity. See more of my posts at http://www.dieskim.me

Fri, 03/24/2017 - 21:56 (Reply to #5)
unborn
unborn's picture

hi,

did you try to enable aswtats for your website? I was trying search for Virtualmin Google Analytics module on my virutalmin but didn't found anything. from what I know you have to insert small js code to each page you want to track - but that can slow down the pages. awstats track everything as well, but not via js.

it looks like this

awstats

Or you talking about this one? https://www.virtualmin.com/node/5772 or https://github.com/virtualmin/virtualmin-google-analytics I never used them so I cannot tell.

Configuring/troubleshooting Debian servers is always great fun

Fri, 03/24/2017 - 22:15
kiteplans

I have used that virtualmin-google-analytics module for many years - it just wont working on my latest server

I’m a “Geek” serving as a Linux System admin, a website designer and maintainer and general know how for all things TECH. I am a fan of CentOS, Virtualmin, Joomla, and anything that uses Electricity. See more of my posts at http://www.dieskim.me

Sat, 03/25/2017 - 04:31
kiteplans

Update, I finally did get mod_deflate disabled server wide and the code is now working...

In the end I left mod_deflate enabled but uncommented everything in /etc/apache2/mods-available/deflate.conf - that way its not actually applying deflate server wide but can be enabled per site if needed

I’m a “Geek” serving as a Linux System admin, a website designer and maintainer and general know how for all things TECH. I am a fan of CentOS, Virtualmin, Joomla, and anything that uses Electricity. See more of my posts at http://www.dieskim.me

Wed, 07/05/2017 - 13:57
webwzrd

Kitepaln, thanks for posting the cause of the issue. I would imagine that applying to individual sites still wipes out the analytics code. Is there anyway to keep the auto insertion of the analytics code working while using mod_deflate?

Topic locked