Ticket #73 (new New feature)

Opened 4 years ago

Last modified 5 months ago

Plugin for Click Heatmap

Reported by: matt Owned by: blade106
Priority: normal Milestone: Third Party Piwik Plugins
Component: New Plugin Keywords:
Cc: Sensitive: no

Description (last modified by vipsoft) (diff)

phpMyVisites supports ClickHeat ( http://www.labsmedia.com/clickheat/) and Piwik could do the same.

The DEV version is available on  http://www.labsmedia.com/clickheat/piwik/piwik-clickheat.tar.gz This is DEV only and may not work with latest trunk.

If you're interested to contribute please contact hello at piwik.org and yvan DOT taviaud at m4am.net

Attachments

piwik-clickheat.tar.gz Download (140.8 KB) - added by matt 3 years ago.
Heatmap plugin for Piwik
en.php Download (8.3 KB) - added by ChristianSchneider 20 months ago.
de.php Download (8.9 KB) - added by ChristianSchneider 20 months ago.
de.2.php Download (9.3 KB) - added by JanPeters 19 months ago.
Fixed german language for ChristianSchneiders version with htmlenteties
Controller.php Download (8.4 KB) - added by JanPeters 19 months ago.
Fixed "Missing Constants" Bug by using Piwik_Translate to get the translation from ChristianSchneiders en/de language files
Piwik › Web Analytics Reports_1281992192785.png Download (17.1 KB) - added by greg 18 months ago.
clickheat-original.js Download (9.7 KB) - added by luk 17 months ago.
Corrected version of the clickheat.js (you have to minify this again!)

Change History

  Changed 4 years ago by matt

  • description modified (diff)

  Changed 4 years ago by matt

  • owner set to blade106

  Changed 3 years ago by matt

  • description modified (diff)

  Changed 3 years ago by matt

  • description modified (diff)

  Changed 3 years ago by vipsoft

www.mapsurface.com has an interesting widget that combines click location information & some basic visitor information.

  Changed 3 years ago by matt

  • priority changed from major to critical

Changed 3 years ago by matt

Heatmap plugin for Piwik

  Changed 3 years ago by matt

  • milestone changed from Features requests - after Piwik 1.0 to Third Party Piwik Plugins

  Changed 3 years ago by matt

  • description modified (diff)

  Changed 3 years ago by jr-ewing

notice to the Clickheart Integration. In the genereated JavaScript Code is a Link to Labsmedia.

  Changed 2 years ago by domtop

  Changed 2 years ago by larsen

I extracted the file into my piwik dir and opened  http://piwik.example.com/ClickHeat.php

My apache log shows: "PHP Fatal error: Class 'Piwik_Plugin' not found in /var/www/vhosts/piwik.example.com/httpdocs/ClickHeat.php on line 12"

Piwik version is 0.4.5

  Changed 2 years ago by vipsoft

  • priority changed from critical to normal
  • sensitive unset

  Changed 2 years ago by kaystrobach

is there any ongoing development of this tool? -> i like the idea behind it and especially for short term tests click heatmaps are important -> perhaps the overlay mode (like google does) is an opinion, because there is no need to create a grafic.

regards Kay

  Changed 2 years ago by jimbo

I second kaystrobach's suggestion! Such a plugin would be very welcome, indeed!

  Changed 2 years ago by tino

Hi,

great idea to develop such a plugin. I know that the provided tar.gz still is a development version. However I'd like to give early feedback from my first try with piwik-clickheat:

I extracted the current version (either from  http://www.labsmedia.com/clickheat/piwik-clickheat.tar.gz or  http://dev.piwik.org/trac/attachment/ticket/73/piwik-clickheat.tar.gz) to plugins/ClickHeat and activated it in Piwik. When opening ClickHeat - Heatmap from the menu I get an error page containing 5 warnings:

Warning: Piwik_ClickHeat_Controller::include(/PATH_TO_WWW_DIR/piwik/config/clickheat.php) [<a href='function.Piwik-ClickHeat-Controller-include'>function.Piwik-ClickHeat-Controller-include</a>]: failed to open stream: No such file or directory in PATH_TO_WWW_DIR/piwik/plugins/ClickHeat/Controller.php on line 48

[...]

Warning: Piwik_ClickHeat_Controller::include(plugins/ClickHeat/libs/languages/en.php) [<a href='function.Piwik-ClickHeat-Controller-include'>function.Piwik-ClickHeat-Controller-include</a>]: failed to open stream: No such file or directory in /PATH_TO_WWW_DIR/piwik/plugins/ClickHeat/Controller.php on line 49

[...]

After showing some similiar warnings it finally ends with

Fatal error: Call to a member function read() on a non-object in PATH_TO_WWW_DIR/piwik/plugins/ClickHeat/Controller.php on line 63

Maybe this feedback helps you to locate the problem (if any). Or is there a svn repository or the like where I could get snapshots from nightly builds?

Thanks a lot in advance (I'd really like to give piwik-heatmap a try on my testing system), Tino

  Changed 2 years ago by blade106

Sorry, I've been really busy these months... I'm looking at the package right now, I'll give you updates soon.

  Changed 2 years ago by blade106

I've just released a fixed release here:  http://www.labsmedia.com/clickheat/piwik/piwik-clickheat.zip

Can anyone give it a try?

Matt, can you change the url in the description to match this new one? Thanks. Can we add this plugin in the main package?

  Changed 2 years ago by blade106

Installation instructions: just unzip the file in your piwik/plugins/ directory, as there's already a subdirectory «ClickHeat» in the archive. Then go to your Parameters' page in piwik, and enable the plugin.

Please report any error you may see, even if it's «working», thanks.

  Changed 2 years ago by tino

Hi,

I tested your fix. The reported errors in lines 48 and 49 disappeared. However it now shows other errors. Hope the following excerpts help!

Warning: Piwik_ClickHeat_Controller::include(/WWWDIR/piwik/config/clickheat.php) [<a href='function.Piwik-ClickHeat-Controller-include'>function.Piwik-ClickHeat-Controller-include</a>]: failed to open stream: No such file or directory in /WWWDIR/piwik/plugins/ClickHeat/Controller.php on line 57 [Backtrace ...]

Warning: Piwik_ClickHeat_Controller::include() [<a href='function.include'>function.include</a>]: Failed opening '/WWWDIR/piwik/config/clickheat.php' for inclusion (include_path='/WWWDIR/piwik/core:/WWWDIR/piwik/libs:/WWWDIR/piwik/plugins') in /WWWDIR/piwik/plugins/ClickHeat/Controller.php on line 57 [Backtrace ...]

Notice: Undefined variable: clickheatConf in /WWWDIR/piwik/plugins/ClickHeat/Controller.php on line 58 [Backtrace ...]

Notice: Undefined index: logPath in /WWWDIR/piwik/plugins/ClickHeat/Controller.php on line 76 [Backtrace ...]

And finally: Fatal error: Call to a member function read() on a non-object in /WWWDIR/piwik/plugins/ClickHeat/Controller.php on line 77

  Changed 2 years ago by manne

After following blade106s instruction, this error occurs in Clickheat view

path = "/tmp/cache/clickheat/cache/" is not a directory or is "/"

preview of the website is available, but the height is only set to 20px

  Changed 2 years ago by blade106

I think you've both got the same error: can you remove the line: PluginsInstalled[] = ClickHeat

under [PluginsInstalled] in the piwik/config/config.ini.php

Then just list the plugins in the Parameters' tab.

The issue here is that ClickHeat is already installed, and the new install() function isn't called as it should be.

Matt: is there a function to run an upgrade, say I've made a change in a release, someone installs it but was on another release before, I want to update some things in his configuration file or anything else like this? Something equivalent to private function installPlugin( Piwik_Plugin $plugin ) in Piwik_PluginsManager.

  Changed 2 years ago by tino

Hi blade106, I followed your instructions and indeed it now doesn't show any errors any longer when opening Heatmap. However I still don't see a Heatmap.

The group dropdown field is empty. The icons layout.png, reload.png and arrow-up.png from plugins/ClickHeat/libs/images aren't displayed at all (no access?). Clicking the links named "Layout refresh" or "Eigene Links speichern" or "Javascript" blanks the ClickHeat page.

Any idea?

  Changed 2 years ago by blade106

Do you have any Javascript errors? Which release of piwik do you use (I tested it against 0.5.4 only)? What browser?

May be you changed some paths in your configuration, and I mostly copied-pasted many things such as plugin directory and things like that (so bad there's no function to get the plugins' path easily or I didn't look enough).

The groups' list will remain empty until you click on a page with the javascript code installed on. So first issue is that you can't access the Javascript panel.

Does the following page work:  http://yourwebsite.com/path/to/piwik/index.php?module=ClickHeat&action=javascript

you should see a badly shaped form.

  Changed 2 years ago by tino

Hi, I managed to resolve the problem (I use piwik 0.5.4. Firefox 3.6).

The png's didn't show up correctly due to wrong access rights: After unzipping the zip file I had to change the access rights for directories and files: find ClickHeat/ -type d -exec chmod 755 {} + find ClickHeat/ -type f -exec chmod 644 {} +

Now the frontend shows up correctly!

@manne: I also found the solution for your problem. In piwik/config/clickheat.php you need to change line 3 to

'cachePath' => PIWIK_INCLUDE_PATH.'/tmp/cache/clickheat/cache/',

I will provide more feedback as soon as I tested ClickHeat. Cheers!

  Changed 2 years ago by blade106

Dawn it! I did fix the error of manne in my test, but I totaly forgot in the main file. So that's still an error, thanks tino for pointing it out.

For the rights on the file, I've reverted back to  http://www.labsmedia.com/clickheat/piwik/piwik-clickheat.tar.gz (I can't find any good information in the zip manual).

  Changed 2 years ago by Dominick

I just downloaded the latest version of labsmedia, but i still get this error:

The class Piwik_piwik-clickheat couldn't be found in the file '/----/stats/plugins/piwik-clickheat/piwik-clickheat.php'

  Changed 2 years ago by blade106

Hello Dominick,

You have to download this file:  http://www.labsmedia.com/clickheat/piwik/piwik-clickheat.tar.gz

Then extract it, and move the ClickHeat/ directory into your plugins/ directory, so that you'll have: /path/to/piwik/plugins/ClickHeat/

Else it won't work. As the archive is made, you should extract it directly in the plugins/ directory of piwik

  Changed 2 years ago by kaystrobach

hi,

do i understood correctly, that we need to add some extra js to the htmlsite to enable heatmap tracking?

I thought you add the code via the piwik api into the piwik.php output? => that would be perfect ;)

Thanks for your great work. Best regards Kay

 http://dev.piwik.org/trac/browser/trunk/core/Tracker.php  http://dev.piwik.org/trac/browser/trunk/core/Tracker/Visit.php

  Changed 2 years ago by blade106

Hello Kay,

Yes, you have to add some extra code to your webpage. That's because it's a totally different process, and further more you may not generate the same thing in piwik and ClickHeat depending on your needs (and I didn't use piwik enough to tell you if both can operate exactly the same way).

So for now it's a dedicated script. However, as we need to make a ClickHeat with MySQL support, I may take this point into account.

  Changed 2 years ago by vipsoft

  • description modified (diff)

  Changed 2 years ago by vipsoft

blade106: I updated the URL in the description. There's no support, currently, for plugins to manage their own config file since Piwik_Option meets most use cases. But there is support for plugin-specific update scripts. (see GeoIP)

  Changed 2 years ago by blade106

vipsoft: I'm sorry, I've changed the path of the file (because of ZIP permissions...). So it's:  http://www.labsmedia.com/clickheat/piwik/piwik-clickheat.tar.gz

I didn't see Piwik_Option. I'll look at it later, as it's working with basic information (although I had to change some of the main ClickHeat files, so I think I'll rewrite all the config module one day taking Piwik into account).

Thanks.

  Changed 2 years ago by vipsoft

  • description modified (diff)

follow-up: ↓ 35   Changed 2 years ago by jimbo

Hi,

installed latest version with Piwik 0.5.4, but I am unable to activate the plug in. While it shows up in the list of plug ins, clicking "Activate" will only reload the same page with no changes. No errors in the log file, either.

Sorry

in reply to: ↑ 34   Changed 2 years ago by jimbo

Replying to jimbo:

Ups, now I could activate it, will test it now.

  Changed 2 years ago by johnol

Hi,

Installed Piwik 0.5.4 and the latest version of piwik-clickheat. Works like a champ for the primary administrator account within Piwik. (Fantastic job on this!)

However, we are having a problem when a standard administrator account logs in to their assigned site within Piwik and try to create clickheat tracking for their site. When they click on clickheat, Piwik loops & loops, refreshing the screen but never loading anything... the looping /refreshing seems to go on for an eternity... we've lost count on how many times it can cycle with no resolution to the request.

Our goal is for all clients to be able to have one or more clickheat maps for each of their sites & to be able to login to their specific Piwik account to see those clickheat maps.

Any idea on why it works for the primary system administrator but not for individual site administrators? It almost behaves like some sort of permissions issue, but for the life of me, I can't figure it out.

follow-up: ↓ 38   Changed 2 years ago by tino

Hi johnol,

I had the same loop & refresh problem on one of my sites. As far as I remember I had a special character (in my case the letter 'é') in the clickHeatGroup string in the java script code. Removing this special character resolved the problem.

Maybe this helps you, good luck Tino

in reply to: ↑ 37   Changed 2 years ago by johnol

Replying to tino:

Hi johnol, I had the same loop & refresh problem on one of my sites. As far as I remember I had a special character (in my case the letter 'é') in the clickHeatGroup string in the java script code. Removing this special character resolved the problem. Maybe this helps you, good luck Tino

Tino, thanks for your help! Forgive my ignorance, but in what java script code? The generated code for a given group? If so, then the only code that has been generated is for the Primary Administrator /Site and that code is clean. If we are talking about a specific file, let me know. Also, -why would the looping occur for all other users but not for the primary administrator? Thanks again!

  Changed 2 years ago by blade106

That's true I didn't test it with another account... Rights are not easy to understand as I didn't look at the main piwik code at all. Let me look at this, I'll keep in touch soon.

  Changed 2 years ago by blade106

I can't figure it out... Another user with(out) admin permissions is working quite fine for me. Can you track the redirect? So we can see where the problem is. A good start would be to run LiveHttpHeaders (firefox plugin), to see what redirects are made (look for a Location:).

Perhaps the issue is in your website (the one loaded in the background iframe which appears behind the heatmap), with a redirect in Javascript. But if another account can see the page without the redirect that should not be the issue.

  Changed 2 years ago by matt

johnol, can you provide blade106 with your Piwik access credentials? seeing the error live would help debugging it. thx

follow-up: ↓ 43   Changed 2 years ago by blade106

Just create a new user with the good permissions, and send me the link to your piwik statistics, that would be good. Thanks! (mail in the subject of this ticket)

in reply to: ↑ 42   Changed 2 years ago by johnol

Replying to blade106:

Just create a new user with the good permissions, and send me the link to your piwik statistics, that would be good. Thanks! (mail in the subject of this ticket)

Thanks in advance for the help! The *only* user where Clickheat is working properly is the super-user. All other users fail. I have no problem with you accessing the super-user account in order to see what's happening. What Email address should I use?

  Changed 2 years ago by matt

please send your details to yvan DOT taviaud at m4am.net

  Changed 2 years ago by svenwbusch

Hi there, i copied the Folder "ClickHeat" out of the ZIP-File in the "plugins"-Folder on my ftp. But i can´t see the new Plugin in Piwik - have i anything to do?

  Changed 2 years ago by svenwbusch

Please forget it - i´m such an idiot -_-

It was the Plugins-FOlder of Joomla, not of Piwik...

  Changed 23 months ago by bthaxor

Hmm how come nothing is showing up for me?

I'm running Piwik 0.5.5, and downloaded ClickHeat from here:  http://www.labsmedia.com/clickheat/piwik/piwik-clickheat.tar.gz

I then uploaded the ClickHeat folder to /plugins/, and activated the plugin in the settings page - however when I get back to the 'ClickHeat' page in Piwik, all I get is a blank page with the loading gif. Not even an error...

What's wrong?

  Changed 22 months ago by johnol

Hi- in addition to the ongoing problem with other users outside of the main user not being able to access heatmaps, I found a configuration problem with Piwik 0.5.5. Specifically the .htaccess file in the plugins folder was creating a "Forbidden" error when a visitor clicks on an item on a page being monitored by clickheat. Because of the Forbidden error, even though the plugin reports that it is installed, none of the actions are recorded. If you disable the .htaccess file in the plugins folder, the clickheat plugin works. This is naturally dangerous and so I'm requesting that a revision be posted for how .htaccess should be configured to safely allow access to the clickheat plugin without giving access to the plugins folder. Thanks!!!

follow-up: ↓ 50   Changed 22 months ago by vipsoft

Try creating a .htaccess file in the ClickHeat/libs folder that contains:

<Files click.php>
Allow from all
Satisfy any
</Files>

in reply to: ↑ 49   Changed 22 months ago by johnol

Replying to vipsoft:

Try creating a .htaccess file in the ClickHeat/libs folder that contains: {{{ <Files click.php> Allow from all Satisfy any </Files> }}}

That worked perfectly. Thanks much!

  Changed 21 months ago by techeroaleman

Heyho I just tried to work with the Headmap on Piwik 6.0. By activating it i got a bunch of errors directly in the list of Plugins, so i had to disable it changing the config file. to see the errors:  http://nick.jaussi.eu/error/index.php.html (a copy of the original file). Apart from that it looks like the Plugin was doing its work i guess. if you need more informations about the problem just send me a mail: techeroaleman@…

Thanks for your work!!! Nick

  Changed 21 months ago by blade106

So far I've never tested piwik 0.6, so I can't tell what's going on. And I've too little free time to look at this issue right now. I hope someone can help you for now. From the errors, I would say that the file is loaded twice, but I've got no idea why. Does the heatmap work or not at all?

  Changed 21 months ago by Tomcraft

Unfortunately doesn't work with Piwik 0.6.1. No error messages are displayed, you simply cannot activate the plugin.

follow-up: ↓ 57   Changed 20 months ago by ChristianSchneider

@techeroaleman and all: I had the same problem, but it can be fixed by changing the coding for the language files from constants to array. Attached I will try to upload an english and german file, where fixed the error.
You have to put the files in plugins/ClickHeat/lang. Overwrite the existing files after a backup of them.
If you are using another language, try to change the coding.

@Tomcraft: Maybe it is the same problem. But for it worked under 0.6.1 and it also works on 0.6.2. Maybe you can try to look at your server log files if you can find some information.

Changed 20 months ago by ChristianSchneider

Changed 20 months ago by ChristianSchneider

  Changed 20 months ago by Tomcraft

The fixed files are great! No more messages in plugin-section.

My problem was the config.php file wasn't writable. *doh* *datz*

  Changed 20 months ago by matt

ChristianSchneider, can you please submit the new clickheat.zip with your changes that make it work as expected?

in reply to: ↑ 54   Changed 20 months ago by Tomcraft

Replying to ChristianSchneider:

@techeroaleman and all: I had the same problem, but it can be fixed by changing the coding for the language files from constants to array. Attached I will try to upload an english and german file, where fixed the error.
You have to put the files in plugins/ClickHeat/lang. Overwrite the existing files after a backup of them.
If you are using another language, try to change the coding. @Tomcraft: Maybe it is the same problem. But for it worked under 0.6.1 and it also works on 0.6.2. Maybe you can try to look at your server log files if you can find some information.

Oh no... =(

Noew the error messages just have moved from the settings/plugin page to the clickheat page. *gg*

  Changed 20 months ago by idonomad

Too much errors Notice: Use of undefined constant LANG_ALL - assumed 'LANG_ALL' in /home6/holidayw/public_html/analytics/plugins/ClickHeat/Controller.php on line 117

Backtrace --> #0 Piwik_ErrorHandler(8, Use of undefined constant LANG_ALL - assumed 'LANG_ALL', /home6/holidayw/public_html/analytics/plugins/ClickHeat/Controller.php, 117, Array ([groups] => Array ([3] => Array ([0] => <option value="3,acne.cpa">acne.cpa</option>,[1] => <option value="3,callmd">callmd</option>)),[d] => Directory Object ([path] => /home6/holidayw/public_html/analytics/tmp/cache/clickheat/logs/,[handle] => Resource id #116),[dir] => ,[pos] => 1,[site] => 3,[selectGroups] => <optgroup label="CPA- Acne Cream"><option value="3,acne.cpa">acne.cpa</option> <option value="3,callmd">callmd</option></optgroup>,[options] => Array ([0] => <option value="3,acne.cpa">acne.cpa</option>,[1] => <option value="3,callmd">callmd</option>),[key] => 3,[piwikSite] => Piwik_Site Object ([] => 3),[selectScreens] => ,[i] => 0)) called at /home6/holidayw/public_html/analytics/plugins/ClickHeat/Controller.php:117 #1 Piwik_ClickHeat_Controller->view() called at [(null):0] #2 call_user_func_array(Array ([0] => Piwik_ClickHeat_Controller Object ([] => ClickHeat,[] => 2010-06-02,[] => Piwik_Date Object ([] => 1275475906,[] => UTC),[] => 3,[] => Piwik_Site Object ([] => 3),[] => Array ([label] => General_ColumnLabel,[nb_visits] => General_ColumnNbVisits,[nb_actions] => General_ColumnNbActions,[max_actions] => General_ColumnMaxActions,[sum_visit_length] => General_ColumnSumVisitLength,[nb_uniq_visitors] => General_ColumnNbUniqVisitors,[nb_actions_per_visit] => General_ColumnActionsPerVisit,[avg_time_on_site] => General_ColumnAvgTimeOnSite,[bounce_rate] => General_ColumnBounceRate,[revenue_per_visit] => General_ColumnValuePerVisit,[goals_conversion_rate] => General_ColumnVisitsWithConversions)),[1] => view), Array ()) called at /home6/holidayw/public_html/analytics/core/FrontController.php:126 #3 Piwik_FrontController->dispatch() called at /home6/holidayw/public_html/analytics/index.php:59

Notice: Use of undefined constant LANG_ALL - assumed 'LANG_ALL' in /home6/holidayw/public_html/analytics/plugins/ClickHeat/Controller.php on line 124

Backtrace --> #0 Piwik_ErrorHandler(8, Use of undefined constant LANG_ALL - assumed 'LANG_ALL', /home6/holidayw/public_html/analytics/plugins/ClickHeat/Controller.php, 124, Arra

  Changed 19 months ago by matt

To all clickheat users (or who tried), is there anyone who got it working? I will take a look soon to fix issues. Sorry about the delay!

  Changed 19 months ago by JanPeters

Using: Piwik 0.6.3

Hi there,

here are the fixes for the Language Problem. Seems like the updated language files from ChristianSchneider needed some follow-up changes in the Controller.php. It was missing the "Piwik_Translate('LANG_xyz')" commands around the former constants. Furthermore I corrected the german lang file for correct use (as htmlenteties) of the German special chars (Umlaute).

There are still some errors in the ClickHeat/libs/js/admin.js File. Firebug states:

document.getElementById(div) is null
showPanel()
function onmouseover(event) { showPanel(); }(Object { name="event"})
(499 out of range 383)

So someone who's more in the code, should check out the showPanel() function.

Greetings

Jan

Changed 19 months ago by JanPeters

Fixed german language for ChristianSchneiders version with htmlenteties

Changed 19 months ago by JanPeters

Fixed "Missing Constants" Bug by using Piwik_Translate to get the translation from ChristianSchneiders en/de language files

  Changed 19 months ago by blade106

The real issue is that Piwik loads twice the same file...

The rewrite of the file has no useful effect, as ClickHeat only use constants and not the $translations array.

I'm releasing a fix right now, please wait a few hours.

follow-up: ↓ 63   Changed 19 months ago by blade106

Fix released. Download it at the same url as before:  http://www.labsmedia.com/clickheat/piwik/piwik-clickheat.tar.gz

Jan, I wasn't able to reproduce the bug, even if I'm also on Firefox. Can you tell me what went wrong (you've got my email on #comment:44)

in reply to: ↑ 62   Changed 19 months ago by JanPeters

Replying to blade106:

Fix released. Download it at the same url as before:  http://www.labsmedia.com/clickheat/piwik/piwik-clickheat.tar.gz Jan, I wasn't able to reproduce the bug, even if I'm also on Firefox. Can you tell me what went wrong (you've got my email on #comment:44)

Hi blade, just tried the updated version you provided yesterday. Works like a charm and no more js errors.

  Changed 19 months ago by blade106

May be the fix for the language solved it (that's possible as there's some JS in the main HTML file, that may be corrupted with those error messages).

I've added Google Chrome in the list of browsers.

follow-up: ↓ 66   Changed 19 months ago by JanPeters

Found another severe defect with the new version.

ClickHeat is tracking two websites on a per "address" base to get a heatmap for each subpage. Now I've got several users, who shouldn't be allowed to access all sites tracked with Piwik and also ClickHeat. The ClickHeat Piwik page ist continously reloading if a user hasn't at least "view" rights for each site tracked with ClickHeat. I tried the following cases to cause the problem with Crome5.0.375 and FF3.6.6:

User has access to one of the pages tracked with ClickHeat: Reload-Loop User has access to none of the pages tracked with ClickHeat: Reload-Loop User has (at least) "view" access to ALL of the pages tracked with ClickHeat: No Reload-Loop

Furthermore, when I change the rights for a logged-in user from "No Access" to "View"/"Administrator" for all ClickHeat tracked sites, the heatmap shows up but falls back to a reload-loop stating "Cleaning up" or something like that shortly before reloading. Logout and Login again solves the problem.

I would propose to try to move the site (not subpage) selection from the ClickHeat Panel to the main Piwik site selection, if thats possible in any way. That should circumvent the access-rigths problem which is supposedly causing this. Might be some work, as I believe it does not match the way ClickHeat works but I'm willing to help you to make the necessary changes, if you want to.

Furthermore I would propose to add a .htaccess file like suggested in #comment:50 to the piwik ClickHeat package to prevent some frustration of first-time-installers with getting 403s when trying to access the click.php file.

in reply to: ↑ 65   Changed 19 months ago by JanPeters

Replying to JanPeters:

Furthermore I would propose to add a .htaccess file like suggested in #comment:50 to the piwik ClickHeat package to prevent some frustration of first-time-installers with getting 403s when trying to access the click.php file.

My bad, it's #comment:49.

  Changed 19 months ago by blade106

This issue is well known, as I've talked with Matt about it 3 months ago. I hope he'll finally look into it :-)

ClickHeat may be modified to limit the list of websites to the current website (I thought I've done this, but seems that's not true). But I'm waiting for the rights management part, as it prevents me to work correctly because of the loop.

For the htaccess, as I'm not running Apache, I can't test it. So can you confirm me this: - should be in /plugins/ClickHeat/ directory - contains the code available in #comment:49

  Changed 19 months ago by JanPeters

Ok I see, forgive me for my comment skimming. Don't have much time till end of july, so I skipped some of the older comments. But great to hear thats work in progress!

Code from #comment:49 is fine and working on my installation. But the directory should be /plugins/ClickHeat/libs/ as that is where the click.php is.

  Changed 19 months ago by blade106

.htaccess added in the archive.

For the endless reload, this was discussed in a mail, following #comment:36. Matt let us know when the issue is fixed, so just wait a little bit (may be we'll end up on 1.0 directly).

  Changed 19 months ago by Khabaal

First of all, great plugin, i just installed it inside my piwik 0.6.4 installation. The only thing i am missing is that it seems not to be possible to see the clicks on every single site of my domain. If i click on the "ClickHeat" button inside Piwik i get a nice view of my frontsite together with the spots where ppl click. But your script is executed on every single page on my homepage and it seems that all the places where ppl click will be displayed with my frontpage as background. So i would like to ask, is this true and will there be a feature to click into the subpages as we know it from other click-overlay tools or do i have to use unique scripts on every page i would like to track the clicks on?

  Changed 19 months ago by blade106

You should use another code than the first option (when you created the Javascript code). Else, in piwik, you can't track easily each page.

So use the option of tracking by url (page's address), this will do the trick.

in reply to: ↑ description   Changed 18 months ago by iulianf

Replying to matt:

phpMyVisites supports ClickHeat ( http://www.labsmedia.com/clickheat/) and Piwik could do the same. The DEV version is available on  http://www.labsmedia.com/clickheat/piwik/piwik-clickheat.tar.gz This is DEV only and may not work with latest trunk. If you're interested to contribute please contact hello at piwik.org and yvan DOT taviaud at m4am.net

There is a problem with piwik version 0.9. Seems that some constants are already declared.

  Changed 18 months ago by blade106

I'll check this tomorrow. There have been too many releases of piwik this summer :-D

  Changed 18 months ago by blade106

Fix released (same url as before to download it).

Matt, why do you run init() on the Plugin multiple times? Even if I remove it from the view(), the init() method is loaded twice. I've set a static variable to forbid a new call, but that's weird to init() twice the same Plugin...

  Changed 18 months ago by vipsoft

init()? did you mean install()?

  Changed 18 months ago by blade106

I meant init(), really :-)

The plugin init() method is called twice, and the fact that I used define() triggered the error (constant already defined).

My old method was starting with:

/**

  • Main method */

function view() {

$this->init();

But even if I disable it, it's called at least twice. I'm using the latest (after update) release of piwik.

  Changed 18 months ago by vipsoft

If you're subclassing Piwik_Controller, then you should be aware that init() is defined in the base class and automatically called by the constructor.

  Changed 18 months ago by blade106

Okay, that's a new behaviour as it was not the case in 0.6.3. I've fixed it, by removing my $this->init() call. I just got tricked by the fact that the page is generated by many calls, and thought it was the same call, whereas it was another init() bad call.

So it's okay in the new clickheat-piwik file.

  Changed 18 months ago by iulianf

Now it works fine for piwik 0.9. Thanks!

  Changed 18 months ago by ChristianSchneider

I can't add a new entry for clickheat, because submit is not working.

Adding a group name and clicking "Enter" doesn't work for me.

  Changed 18 months ago by blade106

I didn't get your point (don't know where you found the «Enter»). Where is the issue (page, url...) and when did it happen? Can you send us a screenshot?

  Changed 18 months ago by ChristianSchneider

Sorry, was my fault... Did not understand that it was enough to add the javascript to the page that was tracked. Sorry...

follow-up: ↓ 84   Changed 18 months ago by Tomcraft

Is it possible to reset the tracked data to start after the layout of the webpage has changed?

in reply to: ↑ 83   Changed 18 months ago by Tomcraft

Replying to Tomcraft:

Is it possible to reset the tracked data to start after the layout of the webpage has changed?

Got it... /tmp/clickheat/ needs to be deleted.

  Changed 18 months ago by matt

To all ClickHeat users, is the plugin work as expected? Are there any blocker/critical bug?

  Changed 18 months ago by JanPeters

Piwik 0.9 with actual ClickHeat DEV Release works fine. Theres still a warning with a $config String or so, but works fine and as it should! I could post the error tomorrow if you wish blade.

  Changed 18 months ago by greg

I just installed the current DEV version on Piwik 0.9 and found a strange bug in the ClickHeat report. Seems that the ClickHeat plugin displays an IFrame with another instance of Piwik. Could it be that ClickHeat requires my site to be on the same domain as Piwik? The IFrame targets to the web-root "/".

Changed 18 months ago by greg

  Changed 18 months ago by blade106

@Jan: I'll look into this issue soon.

@greg: I don't see any bug here. You need to record data first, so just install the Javascript code as asked for on the «No log...» warning. When you'll have some records, the good URL will be set automatically.

  Changed 18 months ago by greg

I would suggest a slightly different behaviour.

When opening the ClickHeat admin page with no recorded data, the user should just see a help screen which explains the next required steps. There is no use in showing the IFrame, in my case the iframe even overlapped with the warning, so it was harder to read.

Have you looked at the  attached screenshot?

follow-up: ↓ 91   Changed 18 months ago by kowalikus

If anybody had problem with no superuser access You may add these line in ClickHeat controller

	/**
	 * Main method
	 */
	function view()
	{
		$this->init();
    
     //this line is added by Kowalikus to get the list of sites where the current user has view access
    $siteWithViewAccess = Zend_Registry::get('access')->getSitesIdWithAtLeastViewAccess();

		/** List of available groups */
		$groups = array();
		$d = dir(self::$conf['logPath']);
		while (($dir = $d->read()) !== false)
		{
			if ($dir[0] === '.' || !is_dir($d->path.$dir)) continue;
			$pos = strpos($dir, ',');

      
			if ($pos !== false)
			{
				$site = substr($dir, 0, $pos);
        
//this 3 line is added by Kowalikus to check if current user has view access, if  not the iteration of loop will be aborted
        if(!in_array($site, $siteWithViewAccess))
        {
          continue;
        }
        
			}
			else
			{
				$site = '';


In Piwik 0.9 I had problem with constants that were declared few times. (many calls of method init())

so i added static property 'initialized' and setting up 'false'; if self::$initialized property has 'true' the function return something to avoid define constants more times

//added by Kowalikus
	static $initialized = false;		

	function init()
	{

//added by Kowalikus
		if(self::$initialized)
		{
			return 0;
		}


		$__languages = array('bg', 'cz', 'de', 'en', 'es', 'fr', 'hu', 'id', 'it', 'ja', 'nl', 'pl', 'pt', 'ro', 'ru', 'sr', 'tr', 'uk', 'zh');

		if (isset($_SERVER['REQUEST_URI']) && $_SERVER['REQUEST_URI'] !== '')
		{
			$realPath = &$_SERVER['REQUEST_URI'];
		}
		elseif (isset($_SERVER['SCRIPT_NAME']) && $_SERVER['SCRIPT_NAME'] !== '')
		{
			$realPath = &$_SERVER['SCRIPT_NAME'];
		}
		else
		{
			exit(LANG_UNKNOWN_DIR);
		}

		/** First of all, check if we are inside Piwik */
		$dirName = dirname($realPath);
		if ($dirName === '/')
		{
			$dirName = '';
		}

		define('CLICKHEAT_PATH', $dirName.'/plugins/ClickHeat/libs/');
		define('CLICKHEAT_INDEX_PATH', 'index.php?module=ClickHeat&');
		define('CLICKHEAT_ROOT', PIWIK_INCLUDE_PATH.'/plugins/ClickHeat/libs/');
		define('CLICKHEAT_CONFIG', PIWIK_INCLUDE_PATH.'/config/clickheat.php');
		define('IS_PIWIK_MODULE', true);

		if (Zend_Registry::get('access')->isSuperUser())
		{
			define('CLICKHEAT_ADMIN', true);
		}
		else
		{
			define('CLICKHEAT_ADMIN', false);
		}

		define('CLICKHEAT_LANGUAGE', Piwik_Translate::getInstance()->getLanguageToLoad());
		include (CLICKHEAT_CONFIG);
		self::$conf = $clickheatConf;
		/** For use in external files */
		$GLOBALS['clickheatConf'] = &self::$conf;

		/** Specific definitions */
		self::$conf['__screenSizes'] = array(0 /** Must start with 0 */, 640, 800, 1024, 1280, 1440, 1600, 1800);
		self::$conf['__browsersList'] = array('all' => '', 'firefox' => 'Firefox', 'msie' => 'Internet Explorer', 'safari' => 'Safari', 'opera' => 'Opera', 'kmeleon' => 'K-meleon', 'unknown' => '');

//added by Kowalikus
		self::$initialized = true;
	}

in reply to: ↑ 90   Changed 18 months ago by kowalikus

Replying to kowalikus:

If anybody had problem with no superuser access You may add these line in ClickHeat controller

Problem is loop reccurency if user is not an admin

  Changed 18 months ago by kowalikus

I've installed script on my site  Ageno

The main content is centered I should setting up width of main content somwhere in config?

ClickHeat will know that my site is centered? What about different resolutions of screen?

can I edit my posts, I don't want flooding :)

Piwik + ClickHeat is Great!

  Changed 18 months ago by blade106

@greg: this scenario has been the same from the first public release of 0.1 and next. No one asked me about it since then (should be some years now). So I'll see if I change it or not, but many things are urgent.

@kowalikus: a new release has been made a few days/weeks ago, it includes the fix for the multi-call on init(). For the super-access part, I've just implemented your fix, thanks a lot! New release will be available in a few minutes (same url as before). Finally, for your website configuration: as your website is 960px wide, you should select fixed centered width, of 960 pixels. Screen resolutions are not an issue as soon as you provide this info. You can change this information by clicking the icon right next to the group's dropdown.

  Changed 18 months ago by blade106

@greg: in fact there was an issue: the stylesheet (in piwik) was missing for the element. I've added a background, so that it can be easily read. That's explain why people didn't care about in the original release.

Changed 17 months ago by luk

Corrected version of the clickheat.js (you have to minify this again!)

  Changed 17 months ago by luk

Hi,

just registered here and also use piwik for the first time (installed yesterday), so I'm kinda noob =)...forgive me if I write some b***shit...

I like the piwik idea very much and for sure I want to help where I can...

So I found your Clickheat Plugin and installed it right away =), works great (I use piwik v1.0), I just had a Javascript error which stopped every other js in IE7 (as usual, and also in Firefox w/ Firebug), it said something about a bad regex, so I visited jslint and checked the code of the /plugins/ClickHeat/libs/js/clickheat-original.js File, jslint had a huge list of things which are not "right" in it's view, but I found the regex thing, it was on line 213 which said: domain = window.location.href.match(/http:\/\/[/]+\//); and there was also the unescaped forward slash, so I corrected it to domain = window.location.href.match(/http:\/\/[\/]+\//); and now it doesn't throw errors anymore.

I also corrected everything else jslint had to beef about =)...so here it is:

/**
ClickHeat : Suivi et analyse des clics / Tracking and clicks analysis

@author Yvan Taviaud - LabsMedia - www.labsmedia.com/clickheat/
@since 27/10/2006
@update 01/03/2007 - Yvan Taviaud : correctif Firefox (Károly Marton)
@update 23/03/2007 - Yvan Taviaud : protection de 2 secondes entre chaque clic, et X clics maximum par page
@update 18/05/2007 - Yvan Taviaud : suppression de clickHeatPage, ajout de clickHeatGroup et clickHeatSite
@update 27/08/2007 - Yvan Taviaud : changement du système de débug
@update 28/09/2007 - Yvan Taviaud : ajout de quelques messages de débug
@update 16/03/2008 - Yvan Taviaud : utilisation des Listeners - ajout d'un délai pour enregistrer le clic correctement - correctif JSLint
@update 05/07/2010 - Yvan Taviaud : ajout de Chrome, ajout du test non-Ajax pour libérer le clic plus rapidement
@update 13/08/2010 - Yvan Taviaud : gestion de IE 8 qui posait des soucis sur l'event

Tested under :
Windows 2000 - IE 6.0
Linux - Firefox 2.0.0.1, Konqueror 3.5.5, IE 7
*/

/** Main variables */
var clickHeatGroup = '';
var clickHeatSite = '';
var clickHeatServer = '';
var clickHeatLastIframe = -1;
var clickHeatTime = 0;
var clickHeatQuota = -1;
var clickHeatBrowser = '';
var clickHeatDocument = '';
var clickHeatWait = 500;
var clickHeatLocalWait = 0;
var clickHeatDebug = (window.location.href.search(/debugclickheat/) != -1);

/**
* Shows a debug string
**/
function showClickHeatDebug(str)
{
	if (clickHeatDebug === true)
	{
		document.getElementById('clickHeatDebuggerSpan').innerHTML = str;
		document.getElementById('clickHeatDebuggerDiv').style.display = 'block';
	}
}

/** Main function */
function catchClickHeat(e)
{
	/** Use a try{} to avoid showing errors to users */
	try
	{
		showClickHeatDebug('Gathering click data...');
		if (clickHeatQuota === 0)
		{
			showClickHeatDebug('Click not logged: quota reached');
			return true;
		}
		if (clickHeatGroup === '')
		{
			showClickHeatDebug('Click not logged: group name empty (clickHeatGroup)');
			return true;
		}
		/** Look for the real event */
		if (e === undefined)
		{
			e = window.event;
		}
		c = e.which || e.button;
		element = e.srcElement || null;
		if (c === 0)
		{
			showClickHeatDebug('Click not logged: no button pressed');
			return true;
		}
		/** Filter for same iframe (focus on iframe => popup ad => close ad => new focus on same iframe) */
		if (element !== null && element.tagName.toLowerCase() == 'iframe')
		{
			if (element.sourceIndex == clickHeatLastIframe)
			{
				showClickHeatDebug('Click not logged: same iframe (a click on iframe opens a popup and popup is closed => iframe gets the focus again)');
				return true;
			}
			clickHeatLastIframe = element.sourceIndex;
		}
		else
		{
			clickHeatLastIframe = -1;
		}
		var x = e.clientX;
		var y = e.clientY;
		var w = clickHeatDocument.clientWidth !== undefined ? clickHeatDocument.clientWidth : window.innerWidth;
		var h = clickHeatDocument.clientHeight !== undefined ? clickHeatDocument.clientHeight : window.innerHeight;
		var scrollx = window.pageXOffset === undefined ? clickHeatDocument.scrollLeft : window.pageXOffset;
		var scrolly = window.pageYOffset === undefined ? clickHeatDocument.scrollTop : window.pageYOffset;
		/** Is the click in the viewing area? Not on scrollbars. The problem still exists for FF on the horizontal scrollbar */
		if (x > w || y > h)
		{
			showClickHeatDebug('Click not logged: out of document (should be a click on scrollbars)');
			return true;
		}
		/** Check if last click was at least 1 second ago */
		clickTime = new Date();
		if (clickTime.getTime() - clickHeatTime < 1000)
		{
			showClickHeatDebug('Click not logged: at least 1 second between clicks');
			return true;
		}
		clickHeatTime = clickTime.getTime();
		if (clickHeatQuota > 0)
		{
			clickHeatQuota = clickHeatQuota - 1;
		}
		params = 's=' + clickHeatSite + '&g=' + clickHeatGroup + '&x=' + (x + scrollx) + '&y=' + (y + scrolly) + '&w=' + w + '&b=' + clickHeatBrowser + '&c=' + c + '&random=' + Date();
		showClickHeatDebug('Ready to send click data...');
		/** Local request? Try an ajax call */
		var sent = false;
		if (clickHeatServer.substring(0, 4) != 'http')
		{
			var xmlhttp = false;
			try
			{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (er)
			{
				try
				{
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (oc)
				{
					xmlhttp = null;
				}
			}
			if (!xmlhttp && typeof XMLHttpRequest !== undefined)
			{
				xmlhttp = new XMLHttpRequest();
			}
			if (xmlhttp)
			{
				if (clickHeatDebug === true)
				{
					xmlhttp.onreadystatechange = function()
					{
						if (xmlhttp.readyState == 4)
						{
							if (xmlhttp.status == 200)
							{
								showClickHeatDebug('Click recorded at ' + clickHeatServer + ' with the following parameters:<br/>x = ' + (x + scrollx) + ' (' + x + 'px from left + ' + scrollx + 'px of horizontal scrolling)<br/>y = ' + (y + scrolly) + ' (' + y + 'px from top + ' + scrolly + 'px of vertical scrolling)<br/>width = ' + w + '<br/>browser = ' + clickHeatBrowser + '<br/>click = ' + c + '<br/>site = ' + clickHeatSite + '<br/>group = ' + clickHeatGroup + '<br/><br/>Server answer: ' + xmlhttp.responseText);
							}
							else if (xmlhttp.status == 404)
							{
								showClickHeatDebug('click.php was not found at: ' + (clickHeatServer !== '' ? clickHeatServer : '/clickheat/click.php') + ' please set clickHeatServer value');
							}
							else
							{
								showClickHeatDebug('click.php returned a status code ' + xmlhttp.status + ' with the following error: ' + xmlhttp.responseText);
							}
							/** Stop waiting */
							clickHeatLocalWait = 0;
						}
					};
				}
				xmlhttp.open('GET', clickHeatServer + '?' + params, true);
				xmlhttp.setRequestHeader('Connection', 'close');
				xmlhttp.send(null);
				sent = true;
			}
		}
		if (sent === false)
		{
			/** This test is needed, as it includes the call to click.php in the iframe */
			if (clickHeatDebug === true)
			{
				showClickHeatDebug('Click recorded at ' + clickHeatServer + ' with the following parameters:<br/>x = ' + (x + scrollx) + ' (' + x + 'px from left + ' + scrollx + 'px of horizontal scrolling)<br/>y = ' + (y + scrolly) + ' (' + y + 'px from top + ' + scrolly + 'px of vertical scrolling)<br/>width = ' + w + '<br/>browser = ' + clickHeatBrowser + '<br/>click = ' + c + '<br/>site = ' + clickHeatSite + '<br/>group = ' + clickHeatGroup + '<br/><br/>Server answer:<br/>' + '<iframe src="' + clickHeatServer + '?' + params + '" width="700" height="60"></iframe>');
			}
			else
			{
				var clickHeatImg = new Image();
				clickHeatImg.src = clickHeatServer + '?' + params;
				//			clickHeatImg.onload = function() { clickHeatLocalWait = 0; }
			}
		}
		/** Little waiting cycle: default is to wait until Ajax sent or until the end of the time if no Ajax is available */
		var now = new Date();
		clickHeatLocalWait = now.getTime() + clickHeatWait;
		while (clickHeatLocalWait > now.getTime())
		{
			now = new Date();
		}
	}
	catch(err)
	{
		showClickHeatDebug('An error occurred while processing click (Javascript error): ' + err.message);
	}
	return true;
}

function initClickHeat()
{
	/** Debug Window */
	if (clickHeatDebug === true)
	{
		document.write('<div id="clickHeatDebuggerDiv" style="padding:5px; display:none; position:absolute; top:200px; left:200px; border:1px solid #888; background-color:#eee; z-index:99;"><strong>ClickHeat debug: <a href="#" onmouseover="document.getElementById(\'clickHeatDebuggerDiv\').style.display = \'none\'; return false">Rollover to close</a></strong><br/><br/><span id="clickHeatDebuggerSpan"></span></div>');
	}

	if (clickHeatGroup === '' || clickHeatServer === '')
	{
		showClickHeatDebug('ClickHeat NOT initialised: either clickHeatGroup or clickHeatServer is empty');
		return false;
	}

	/** If current website has the same domain as the script, we remove the domain so that the call is made using Ajax */
	domain = window.location.href.match(/http:\/\/[^\/]+\//);
	if (domain !== null && clickHeatServer.substring(0, domain[0].length) == domain[0])
	{
		clickHeatServer = clickHeatServer.substring(domain[0].length - 1, clickHeatServer.length);
	}
	/** Add onmousedown event using listeners */
	if (document.addEventListener)
	{
		document.addEventListener('mousedown', catchClickHeat, false);
	}
	else if (document.attachEvent)
	{
		document.attachEvent('onmousedown', catchClickHeat);
	}
	/** Add onfocus event on iframes (mostly ads) - Does NOT work with Gecko-powered browsers, because onfocus doesn't exist on iframes */
	iFrames = document.getElementsByTagName('iframe');
	for (var i = 0; i < iFrames.length; i++)
	{
		if (document.addEventListener)
		{
			iFrames[i].addEventListener('focus', catchClickHeat, false);
		}
		else if (document.attachEvent)
		{
			iFrames[i].attachEvent('onfocus', catchClickHeat);
		}
	}
	/** Preparing main variables */
	clickHeatDocument = (document.documentElement !== undefined && document.documentElement.clientHeight !== 0) ? document.documentElement : document.body;
	/** Also the User-Agent is not the best value to use, it's the only one that gives the real browser */
	var b = navigator.userAgent !== undefined ? navigator.userAgent.toLowerCase().replace(/-/g, '') : '';
	/** Always test Chrome before Safari */
	var browsers = ['chrome', 'firefox', 'safari', 'msie', 'opera'];
	clickHeatBrowser = 'unknown';
	for (var j = 0; j < browsers.length; j++)
	{
		if (b.indexOf(browsers[j]) != -1)
		{
			clickHeatBrowser = browsers[j];
			break;
		}
	}
	showClickHeatDebug('ClickHeat initialised with:<br/>site = ' + clickHeatSite + '<br/>group = ' + clickHeatGroup + '<br/>server = ' + clickHeatServer + '<br/>quota = ' + (clickHeatQuota == -1 ? 'unlimited' : clickHeatQuota) + '<br/><br/>browser = ' + clickHeatBrowser + '<br/><strong>Click in a blank area (not on a link) to test ClickHeat</strong>');
}

hope this is a helpful little contribution...

follow-up: ↓ 97   Changed 17 months ago by halfdan

Hi luk, thanks for investing your time in this. However it would be better to provide your changes as a diff patch. Have a look at  http://dev.piwik.org/trac/wiki/PiwikDevelopmentProcess#Howtosubmitapatch on how to submit a patch.

in reply to: ↑ 96   Changed 17 months ago by luk

Replying to halfdan:

Hi luk, thanks for investing your time in this. However it would be better to provide your changes as a diff patch. Have a look at  http://dev.piwik.org/trac/wiki/PiwikDevelopmentProcess#Howtosubmitapatch on how to submit a patch.

I read through the link above, I skipped obviously the first steps with opening a ticket and so on...it's not really a big fix, just a little correction, so this would be a little overkill, wouldn't it? What I did is attach the file to this ticket (at the top of this "ticket/thread"...)

  Changed 17 months ago by blade106

Hello luk, I'll try to check it during this week and apply your fix. Thanks for your help.

  Changed 17 months ago by blade106

I'm looking at the issue you've stressed out: - I'm okay on the regex fix, I'm too used to use "~" as a delimiter in PHP to avoid the / issues... - for the === thing, the fact is most of the syntax is totally changed. So that will break some part of ClickHeat. Even if I do like XHTML and clean code, JSLint was never a good standard as many browsers handle Javascript differently. Hence «if (e == undefined)» becoming «if (e === undefined)» will mostly break, and should then be written as «if (!e)» (as specified in the JSLint «will hurt your feelings»). But that may be a good solution too... So I'm on it, don't know how long it'll take to fix everything to be JSLint okay.

  Changed 17 months ago by luk

ok, I didn't know that the === thing is breaking the JS...it seems to work as expected in piwik (I got a heatmap for every page which is nice =D, not soooo many clicks yet, but for a page that isn't launched, nice!), what would this break in which browsers? I'm just interested because I do comparing in JS always with the === and I think I have not recognized problems because of that...

It's also no problem to just fix the regex-issue and leave the rest alone, the error in IE is gone =)...

And to make JSLint happy, I don't know, this thing is never happy =P...

  Changed 17 months ago by blade106

It may break things if not used correctly. If you're a PHP coder too, you may know the difference, else here is one example:
if (e == 0) becomes if (e === 0)
if e is the number 0, both will return true. If e is the string "0", the second should return false, as the type is not the same. If e is an empty string "", first one may be true, the second will be false. And if e is undefined, I think the first one would be true, and the second one false.
In this case, the use of === is bad (if you are to compare with variables that are not numbers), and as JSLint's FAQ says: use "!" in this case => if (!e). But this may be necessary to use === :-)
It's true that I always use it in PHP (about 99 times out of 100), but I know exactly what I'm doing with PHP (even with it's loose variable typing). In Javascript, it's sometimes hard to know how every browser will react, so it's harder to code with «standards».
But I'll try to make it happy, and I'll make a JSLint checker in PHP to do this easily :-)

follow-up: ↓ 103   Changed 17 months ago by blade106

File has been updated, and should be available right now on the same link as before. Can someone test this new file? Thanks.

in reply to: ↑ 102   Changed 16 months ago by brandonkernell

Replying to blade106:

File has been updated, and should be available right now on the same link as before. Can someone test this new file? Thanks.

I have tested this running Piwik 1.0. I see no problems and it is reporting just fine, but it only started reporting after I did the test (using ?debugclickheat) and now it tracks just fine.

It seems to know when I have blacklisted an IP and all of that. Good work. I will check back here for updates.

One thing, the image needs to align with the current page.

follow-up: ↓ 105   Changed 16 months ago by blade106

Thanks Brandon,

Can you send a screenshot to picture the image issue?

For the IP blacklist, there's a cookie option in ClickHeat, but I don't remember if I've ported it to piwik (a link like «Remember my clicks?»).

in reply to: ↑ 104   Changed 16 months ago by brandonkernell

Replying to blade106:

Thanks Brandon, Can you send a screenshot to picture the image issue? For the IP blacklist, there's a cookie option in ClickHeat, but I don't remember if I've ported it to piwik (a link like «Remember my clicks?»).

Yea its called "Log my clicks?". All in all it should be ported in with the IP address block of piwik itself, that way there is no confusion.

Also, as to the image: http://img842.imageshack.us/img842/5880/clickheatimageresize.th.png

I also noticed, even though you are on a certain profile (site) you still have to select what group you want, is there not a way to make it so that it knows what group or by reading the website URL?

  Changed 16 months ago by blade106

The IP solution wasn't ported into ClickHeat as I thought it was difficult to use for many people. Here we have a simple cookie, set or not, that's really easy.

Perhaps I'll port it, at least I'm adding it to my todo.

For the second point, this may be an issue. You should only see the groups of your current website.

Also, I think you haven't set the layout for your page: click on the icon right next to the groups' dropdown, and set your layout as fixed and centered (and define the width). This will show clicks much better :-)

  Changed 15 months ago by ste_piwik

Hi all,

as I run Clickheat now for several weeks within Piwik, I discovered that it only and always shows the clicks of just 1 day.

No matter what I change it still brings up the Heatmap for 1 day. I changed the config file 'start'=>'d' to 'start'=>'m' without any changes (both of the config files, as I don't know which one will be the right one).

I even changed the $range variable in the Controller file from 'd' to 'm' without any effect. It would be great if that could be changed soon, as it not really useful this way.

BTW I run the Clickheat-Plugin where the files are created Sept.1, 2010. Hopefully that helps, as there is no version number.

Hope this information helps to better include Clickheat into Piwik.

  Changed 15 months ago by blade106

The "start" param is whether ClickHeat use Monday or Sunday as first day of week. So this will have no effect.

I'll look into it soon.

follow-up: ↓ 113   Changed 15 months ago by blade106

Fixed! The start date was set in Javascript in original ClickHeat, and not in Piwik. So I've fixed it. You should download the new file at the url above. Please leave a reply to tell if it's fixed for you too.

  Changed 15 months ago by luk

Just read this and I'm interested in trying it out =)...only which link "above" do you mean? The DEV version link here:  http://www.labsmedia.com/clickheat/piwik/piwik-clickheat.tar.gz ??

thanks for the fix!

  Changed 15 months ago by blade106

Yes, that's the official release. There's no «development» release for piwik in fact.

Just overwrite your libs/ClickHeat dir with this one, and this should do the trick.

in reply to: ↑ 110   Changed 15 months ago by ste_piwik

Replying to blade106:

Fixed! The start date was set in Javascript in original ClickHeat, and not in Piwik. So I've fixed it. You should download the new file at the url above. Please leave a reply to tell if it's fixed for you too.

That worked for me as well! Great Work, awesome! Thanks a lot for the Plugin.

  Changed 14 months ago by tyroden

I have successfully installed ClickHeat, and the heat maps work fine (once I setup the .htaccess change for click.php all went well).

I have several websites within my Piwik configuration, and no matter what site I choose, I always see the heatmap from the original site. How do I make sure that the heatmp only shows within the proper site?

Great plugin by the way!

  Changed 10 months ago by Nikita

I'm currently trying to install ClickHeat for piwk 1.2 Piwik has recognized it as plugin and I was able to enable it. But the only thing I can see is the empty ClickHeat window  http://img860.imageshack.us/f/clickheat.jpg/. Am I doing something wrong with the installation or it's a piwik 1.2 issue?

follow-up: ↓ 121   Changed 10 months ago by blade106

Hello, I'm sorry I haven't much time for now, I'll look into you issue by the end of April, may be sooner, but I can't tell for now. Just wanted to say: I know you're in trouble :-)

  Changed 10 months ago by morefx

I found an issue with Piwik 1.3 using when opening the ClickHeat tab:

Fatal error: Call to a member function read() on a non-object in 
/www/vhosts/piwik.foobar.com/htdocs/piwik/plugins/ClickHeat/Controller.php 
on line 89

Warning: dir() [<a href='function.dir'>function.dir</a>]: 
SAFE MODE Restriction in effect. The script whose uid is 10097 is not allowed to access 
/www/vhosts/piwik.foobar.com/htdocs/piwik/tmp/cache/clickheat/logs/ 
owned by uid 58 in 
/www/vhosts/piwik.foobar.com/htdocs/piwik/piwik/plugins/ClickHeat/Controller.php 
on line 84

System info:
- Apache with mod_php (PHP 5.2.10)
- safe_mod enabled
- Piwik 1.3
- CleckHeat 1.9-revB

I'll be happy to test patches or new versions of ClickHeat.

  Changed 10 months ago by blade106

Try to delete the clickheat directory within /www/vhosts/piwik.foobar.com/htdocs/piwik/tmp/cache/

Safe mode is a real pain... If it doesn't help, I don't know how to fix this (the issue is that the Apache user isn't the same as the FTP user, hence you can't create files using Apache if the directory is owned by the FTP user).

  Changed 10 months ago by morefx

Switched to FastCGI instead of mod_php for the time being. Works just fine!

  Changed 10 months ago by blade106

Do stick with FastCGI if possible. So great for tuning a webserver against memory overflow (limited number of PHP instances running, easy to limit without limiting server's MaxClients).

in reply to: ↑ 116   Changed 9 months ago by motin

Replying to blade106:

Hello, I'm sorry I haven't much time for now, I'll look into you issue by the end of April, may be sooner, but I can't tell for now. Just wanted to say: I know you're in trouble :-)

Having the same issue in piwik 1.4 as Nikita. It seems the plugin is broken in versions 1.2+. Any chance you have time to look into it now when end of April has passed? :)

I am getting a 403 error on including the javascript file - /plugins/ClickHeat/libs/js/admin.js

  Changed 9 months ago by motin

Replying to myself. The issue was permissions (as it very often is... :P)

After extracting the plugin folder, the permissions on the ClickHeat folder was

drwx------ 5 user user   4096 Nov 30 08:03 ClickHeat

Which prevented any access for the apache user to access the contents.

chmod g+rwx -R ClickHeat/

Solved the issue... Now the plugin tab is functional again.

  Changed 9 months ago by motin

One more thing to get it going:

Create a file named '.htaccess' in ClickHeat/libs/ with the following contents:

<Files ~ "\.(inc|tpl|in)$">
Deny from all
</Files>
<Files ~ "\.(test\.php|gif|ico|jpg|png|js|css|swf|php)$">
Satisfy any
Allow from all
</Files>

Otherwise your click tracking php script will be blocked by piwik's own .htaccess file in the plugins folder.

Now ClickHeat works beautifully in Piwik 1.4! :)

  Changed 9 months ago by blade106

I'm finally working a bit on this.

Thanks motin for pointing out the issue on files. I've set 0644 on files and 0755 on directories. But I can't find your .htaccess file (I've just upgraded to 1.4, and can't see it). Are you sure it's not a file you set up yourself? Also I'm on lighttpd, hence .htaccess files doesn't work, so I can't test it.

I'll update the tarball when the issue reported by tyroden is fixed (I'm working on it!)

  Changed 9 months ago by blade106

New release is available (always at the same url). Changes include: - fixed files permissions (as said just above) - list only groups from the selected website (hence you need to first select a website to see clicks from this website) -- solves tyroden issue - fixed Ajax support, as it wasn't using the parameters sent after the hash (#) in the piwik url.

For the IP filtering, I've tried to get the data from the API, but it's way too complicated. If someone can point me to a piece of code to know if an IP is excluded, that would be great. I've tried using Piwik_SitesManager_API or Tracker/Visit, but that wasn't easy. The main issue is that I'm not in a piwik environment, hence I need to load a lot of classes, and that would be a performance breaker for ClickHeat.

  Changed 9 months ago by vipsoft

re: .htaccess: for newer Piwik releases, this is created by the installer if it detects an Apache web server in use

re: IP filtering: you can try loading the .php cache files in tmp/cache/tracker where excluded_ips is an array of ip addresses in CIDR notation; most of the IP address handling code is in core/IP.php

re: logging. Have you looked The LOAD DATA INFILE code introduced in 1.4? I've done some refactoring for 1.5 that should make it more general purpose. We should probably look at ClickHeat's logging and see if cam benefit from the proposed bulk loader in #134.

  Changed 9 months ago by blade106

.htaccess: I've created a light file in plugins/Clickheat, can someone test it? It's just:

<Files ~ "^click\.php$">
        Satisfy any
        Allow from all
</Files>

This should be enough for what is necessary here.

IP: it's quite strange to do it that way, but I've done it as you said. Hope this helps :-)

Logging: Clickheat doesn't use SQL at all. Everything is logged in files, directly. For Clickheat 2.0 (planned for... years), with SQL support, I sure will use such a thing.

  Changed 7 months ago by opensourcer

Just tried installing the plugin, but got the following error:

Unable to load plugin 'clickheat' because '/---/public_html/piwik/plugins/clickheat/clickheat.php' couldn't be found.

Renaming click.php to clickheat.php (naturally) only threw up even more errors...

  Changed 7 months ago by blade106

That's because it should be /plugins/Clickheat/ and not /plugins/clickheat/ (typo error). Did you rename the directory? I don't recall changing anything to the package generated.

  Changed 7 months ago by opensourcer

Thanks for your fast answer. The file at  http://sourceforge.net/projects/clickheat/files/clickheat/clickheat-1.14.zip/download has the directory with a lower-case "c."

However, even after renaming to capital C, Piwik still gives me the error above as it expects a "clickheat.php" file, which is not present in your zip file.

  Changed 7 months ago by blade106

That's because it's ClickHeat, not ClickHeat plugin for Piwik. This one is available at:  http://www.labsmedia.com/clickheat/piwik/piwik-clickheat.tar.gz

That should be better with this one :-)

  Changed 7 months ago by morefx

I tried the version above with Piwik 1.5. After activating the plug-in and clicking on the ClickHeat tab, I get the following errors/warnings:

Warning: include() [<a href='function.include'>function.include</a>]: Unable to access /var/www/vhosts/piwik.foobar.de/httpdocs/piwik/config/clickheat.php in /var/www/vhosts/piwik.foobar.de/httpdocs/piwik/plugins/ClickHeat/Controller.php on line 55 
Warning: include(/var/www/vhosts/piwik.foobar.de/httpdocs/piwik/config/clickheat.php) [<a href='function.include'>function.include</a>]: failed to open stream: Datei oder Verzeichnis nicht gefunden in /var/www/vhosts/piwik.foobar.de/httpdocs/piwik/plugins/ClickHeat/Controller.php on line 55 
Warning: include() [<a href='function.include'>function.include</a>]: Failed opening '/var/www/vhosts/piwik.foobar.de/httpdocs/piwik/config/clickheat.php' for inclusion (include_path='.:') in /var/www/vhosts/piwik.foobar.de/httpdocs/piwik/plugins/ClickHeat/Controller.php on line 55 
Notice: Undefined index: logPath in /var/www/vhosts/piwik.foobar.de/httpdocs/piwik/plugins/ClickHeat/Controller.php on line 85

There is no /var/www/vhosts/piwik.cm-applications.de/httpdocs/piwik/config/clickheat.php Copying an old version of config/clickheat.php to the needed locations gets rid of two of the mentioned errors, three left:

Warning: dir() [<a href='function.dir'>function.dir</a>]: Unable to access /var/www/vhosts/piwik.foobar.de/httpdocs/piwik/tmp/cache/clickheat/logs/ in /var/www/vhosts/piwik.foobar.de/httpdocs/piwik/plugins/ClickHeat/Controller.php on line 85 
Warning: dir(/var/www/vhosts/piwik.foobar.de/httpdocs/piwik/tmp/cache/clickheat/logs/) [<a href='function.dir'>function.dir</a>]: failed to open dir: Datei oder Verzeichnis nicht gefunden in /var/www/vhosts/piwik.foobar.de/httpdocs/piwik/plugins/ClickHeat/Controller.php on line 85 
Fatal error: Call to a member function read() on a non-object in /var/www/vhosts/piwik.foobar.de/httpdocs/piwik/plugins/ClickHeat/Controller.php on line 94

Steps to reproduce: 1. Download and unpack  http://www.labsmedia.com/clickheat/piwik/piwik-clickheat.tar.gz to the piwik-plugin directory 2. adjust owner and permissions according to server needs 3. activate plug-in in piwik 1.5 4. click on ClickHeat tab

  Changed 7 months ago by opensourcer

@blade106: Thanks, that explains and solved it :-)

@morefx: Cannot reproduce your errors. Following your steps works fine for me.

  Changed 7 months ago by morefx

I had to do some steps manually, which obviously should happen during installation:

* mkdir httpdocs/piwik/tmp/cache/clickheat

* mkdir httpdocs/piwik/tmp/cache/clickheat/logs

* mkdir httpdocs/piwik/tmp/cache/clickheat/cache

* create httpdocs/piwik/config/clickheat.php (copy of an old clickheat.php which I happened to have on my server)

Might be a permission problem during installation? I don't see any errors/warnings however.

I'll be happy to do further tests.

  Changed 7 months ago by blade106

I also think that the installation part didn't run correctly. May be it's possible to send errors, so that the activation of the plugin is impossible, in case some errors happen. I'll check this out. The thing you could have tested: disable then enable the plugin, I think it goes through the installation part again.

  Changed 7 months ago by morefx

I did

* Uninstall the plugin within Piwik

* Removed the httpdocs/piwik/tmp/cache/ directory

* Activated the plugin again within Piwik

* Clicked on the ClickHeat tab in Piwik

-> Error:

Warning: dir() [<a href='function.dir'>function.dir</a>]: Unable to access /var/www/vhosts/piwik.foobar.de/httpdocs/piwik/tmp/cache/clickheat/logs/ in /var/www/vhosts/piwik.foobar.de/httpdocs/piwik/plugins/ClickHeat/Controller.php on line 85 

Warning: dir(/var/www/vhosts/piwik.foobar.de/httpdocs/piwik/tmp/cache/clickheat/logs/) [<a href='function.dir'>function.dir</a>]: failed to open dir: Datei oder Verzeichnis nicht gefunden in /var/www/vhosts/piwik.foobar.de/httpdocs/piwik/plugins/ClickHeat/Controller.php on line 85

The Apache error log does not show a problem during installation, but when clicking on the ClickHeat tab, I get

[Mon Jul 04 09:28:31 2011] [warn] mod_fcgid: stderr: PHP Fatal error:  Call to a member function read() on a non-object in /var/www/vhosts/piwik.foobar.de/httpdocs/piwik/plugins/ClickHeat/Controller.php on line 94

For the record: I am running php as fastcgi as you suggested earlier

  Changed 7 months ago by blade106

That's okay for the first run. In fact, to improve speed of some scripts, I avoid some tests («does the directory exists?» and things like that). But I think there's just an issue with the piwik plugin, as it should not have reached this piece of code (and not run this error then). I'll check on this too, soon. Thanks for your report.

  Changed 6 months ago by ssabchew

I have installed the dev version on COS6 in piwik 1.5.1 and I have this err in httpd on every record:

PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in /var/www/piwik/plugins/ClickHeat/libs/click.php on line 97

from php.ini:

date.timezone = "Europe/London"

  Changed 6 months ago by ssabchew

added before line 97

date_default_timezone_set('UTC');

and no more error/warnings

--- click.php<->2011-08-10 20:31:29.000000000 +0000
+++ plugins/ClickHeat/libs/click.php<-->2011-08-10 19:49:03.000000000 +0000
@@ -94,7 +94,6 @@
 <----->}
 }
 /* Logging the click */
-date_default_timezone_set('UTC');
 $f = fopen($clickheatConf['logPath'].$final.'/'.date('Y-m-d').'.log', 'a');
 if (!is_resource($f))
 {

  Changed 5 months ago by blade106

Thanks ssabchew for the tip. But for me it's not a ClickHeat issue, as long as any software that uses date() will bring the error. I think you're hitting the wrong php.ini, as you seem to set it correctly. See:  http://fr.php.net/manual/en/function.date-default-timezone-get.php which clearly states that the date.timezone will be taken out of php.ini, hence there's no way you end up on «UTC». Mine is set on "Europe/Paris", under PHP 5.3.3, and I don't see such an error.

Note: See TracTickets for help on using tickets.