Weird HTML comment on pages that include piwik.js


(agnawt) #1

Since I upgraded from 0.43 -> 0.45 I get a weird comment displayed at the bottom of pages:

This completely ruins the formatting of the page as a result. Here is what the HTML looks like:

<!-- Piwik -->
<!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
...

I have no idea where this is coming from (whether its the optimized javascript or being output by one of the php files).
Any help would be much appreciated - this is affecting two major sites.
I will probably have to disable Piwik in the meantime.


(agnawt) #2

Ok. Now I am really confused. This comment line appears on several machines with Firefox 3.5 (latest updates) but not in IE8 or Chrome 3. Something in the JS is being interpreted differently?


(vipsoft) #3

If you’re using a plugin to insert the tracking code on your pages, then you’ll need to contact the plugin author.

It’s not generated by piwik.js or http://dev.piwik.org/trac/browser/trunk/co…vascriptTag.tpl


(agnawt) #4

[quote=vipsoft @ Nov 1 2009, 12:56 PM]If you’re using a plugin to insert the tracking code on your pages, then you’ll need to contact the plugin author.

It’s not generated by piwik.js or dev.piwik.org/trac/browser/trunk/co…vascriptTag.tpl[/quote]

Understood. I am not using anything outside of the piwik project to include it. The JS snippet is the same code as what the management interface produces.


(vipsoft) #5

An adblocker or some other firefox extension, perhaps?


(agnawt) #6

I disabled all extensions and plug-ins on one machine, and another is a fresh Firefox 3.5 installation. I have been using Piwik since the first public version, and this is the first time (after many version upgrades) that I have encountered such a problem. What has changed that could cause this to occur?

I also tested the URL of one of the sites with browsershots.org - so far in 25 different browsers (13 of which are clearly running compatible Javascript), none display the HTML comment although I cannot be sure (without creating a special test page) they are running the Piwik Javascript code either.

Interestingly enough, actually disabling javascript in Firefox does not cause this comment line to disappear. I can only assume then that it is being generated server-side. Why it would only appear in certain browsers (or at least those connected via our office web gateway) makes this even more annoying. This is a straight gateway btw (no filtering or other nonsense), although there is also a DNS server that I setup which resolves flawlessly.


(agnawt) #7

Something is definitely weird here - now i see the comment on this page and all other pages in the Piwik website.
I have 20+ tabs open in this browser, but this is the only place that I see this damn “thing”. Here is the source where it appears.
It is visible with javascript enabled or disabled.

open source Google Analytics


(Matthieu Aubry) #8

how did you copy paste it in your website HTML? please use notepad or something similar. Copy pasting javascript with some HTML editors result in the Javascript being escaped and html entitied (< replaced with < etc.). http://piwik.org/faq/troubleshooting/#faq_58


(agnawt) #9

Fair enough. I used Dreamweaver CS4. I compared the source in Notepad++ and it is A-Ok. I am wondering if it could be a browser cache/cookies issue - maybe something is sticking from Piwik 0.43 that clashes with 0.45. Going to wipe the cache on one machine and see if anything changes.

The odd thing is it does not appear on all pages that use Piwik, just some. I am getting the comment on this page as I type this response - it still appears on all the pages on the Piwik site too.

Clearing the cache and cookies did not make any difference. This is very strange. Wonder if something is being done to the HTTP stream by our ISP…