Lightbox/piwik/Qt conflict?


Hi all,
I’m developping a light custom Qt web browser using QWebView (WebKit) and I would like to track the actions of the users. I am displaying a Drupal website using various modules. Until now, everything was working fine.
In some pages though, I use the Lightbox 2 drupal module to display a slideshow in a modal div.

What happens is when I don’t have the piwik tracking code on the page, everything works fine.
When I do include it on the page, the lightbox is broken and instead of displaying a div, it redirects to the image URL. This happens only on the Qt browser I am developping, all other browsers don’t have any problem either on Windows or Unix.

Any Idea where that could come from ?

(vipsoft) #2

Can you try with other Webkit browsers, eg Safari/Chrome? That’ll help narrow the cause.

(vipsoft) #3

Oh. and konqueror.

One problem with some lightbox implememtations that I’ve seen is a broken click handler. For it to work cross-platform (and also with Piwik), the lightbox’s click handler can’t stop propagation, event bubbling, or return a value.


the thing is it works on both Chrome and Firefox under ubuntu.
it also works on Chrome, Safari, Firefox and IE8 on Windows.

The problem only shows on my Qt browser


I looked at the code of the links to the images in lightbox.
the code looks like this :

<a href="" rel="lightbox">
     <img src="thumbnail.jpg"/>

So it seems that when piwik is on, clicking on the link opens the href of the A tag (wich would happen if there was no lightbox plugin). Could piwik be disabling a click listener somehow ? I also noticed that the lightbox DIVs are located after the piwik tracking code (appending to the body in javascript I assume), no idea if this has any effect on piwik.

You are right, the click listeners used by the lightbox module I’m using return false as a value. So this would be the problem according to you ?


Ok, I narrowed the problem a lot today.
I had 2 servers running piwik. One running 1.2 and working fine. The other updated to 1.3 was the one bugging.
Now I reverted back to 1.2 and everything works, but I can’t upgrade !!!

(vipsoft) #7

For 1.3, this fix helps some mysqli users.

Way back (circa Piwik 0.6.x), we learned that a click handler that returns a value (or sets the event.returnValue) can cause other click handlers to not execute. Another problem is that the order that click handlers are registered may not always be in the same order. These quirks in behaviour vary between browsers (and browser versions), but is why piwik.js’s click handler doesn’t return a value.

You can try two things:

  1. remove the “return false” from the lightbox, and/or
  2. add class=“piwik_ignore” to those anchor tags so Piwik doesn’t attach a click handler
    to those anchors.


Actually, I just figured out that the problem was not even the version of piwik. After downgrading to 1.2 on both servers, it appears there is exactly the same problem.
The main difference between the two servers running piwik is:

  • the one that works is hosted on the company network
  • while the bugging one is on an Amazon AWS cloud server.

We have a proxy requiring authentication, and the server running the tracked website is not accessible from outside. The tracking is recorded correctly on amazon though. so I don’t know what is wrong except the fact that the amazon piwik is outside our network.