Found a bug regarding the virtualmin google analytics module.
The module inserts the analytics tracking code into whatever it thinks is HTML even if it is not. For example, I distribute a software that I have developed for free. In the source code there are many HTML template strings inline, inside the source file. While transfering the files thru HTTP, the analytics code is inserted. Since the file has a checksum protection (it is a binary source file), the virtualmin additions make the file fail against the checksum and thus corrupt the download.
The module sees the templates flying around inside the apache response and adds the tracking code. Disabling the analytics module, made it all work again. I know the module is supposed to include the analytics tracking code into every html response but the case is that I am not sending HTML back, I am sending binary file to be used on the client machine and inside this binary file there are many HTML snippets. It’s as if the module would insert code inside a a file inside a zipfile being transfered. Argh!
Can we have some filtering abilities for the analytics module, for example, only insert data if the request is for a HTML or CGI file or content-type: text/html or something…
Thanks in advance
Nice find there! Here’s what I’d recommend – take what you just said above, and put that into a new ticket in the “Bugs and Issues” link below.
At that point, Jamie can take a look, and will work with you to get that all sorted out.
Thanks for the pointer Eric, I’ve added it to the bug and issues tracker. It’s FS#5204.
Where is the file that I could edit the google tracking code being inserted by virtualmin-google-analytics module? If I know where to look I would comment out the culprit:
setTimeout(‘document.location = “‘ + link.href + ‘”‘, 100);
Update: I couldn’t find in my GA account a way to edit it on the google server side through my GA account either. I just learned through browser DOM the js containing the above code is hosted either by GA as https requests through ssl.google-analytics.com/ga.js or by http requests through www.google-analytics.com/analytics.js
Is there any way to pass parameters to either of the two js files hosted on google servers? Since I cannot comment out any code on my side I’m wondering if there is anything I could do on their side. Like for example, pass a class parameter they send back as part of the
(‘document.locaion = "’ + link.href + ?classproperty=$this-class ‘"’, 100); through whatever their API designates as the class property, arbitrarily $this-class might be the string assigned by their API by a parameter from my outgoing https request like this one,
If google has an API like the above example it would give a way to maintain fancybox on the return URL if Googles analytics API defines a class property for the return URL. Could you post a link to it here if you find it?