Virtualmin Analytics Modules not inserting code - Ubuntu 16.04 PHP 7


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


I can see

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


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

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…

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

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?

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.


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


Or you talking about this one? or I never used them so I cannot tell.

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

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

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?