Hi all,
my interest has been spurned by your discussion. So I tried some small hack style_emoticons/<#EMO_DIR#>/wink.gif
What did I do?
First of all, I added a new column to the table “piwik_log_visit”. I named it “username”.
As my websites are mainly visited by Users known to me, I edited the table “piwik_log_visit” and entered the username with the visits I could identify.
Next I edited core/Tracker/Visits.php
I created a function
* Returns the visitor's username
*
* @return varchar
*/
protected function getVisitorUsername()
{
return $this->visitorInfo['username'];
}
and inserted a call where needed ($visitRow =, $country =, $this->visitorInfo = array)
Most interesting for me was adding it where piwik checks wether we have a known visitor
if($visitRow
&& count($visitRow) > 0)
{
$this->visitorInfo['visitor_idcookie'] = $visitRow['visitor_idcookie'];
$this->visitorInfo['visit_last_action_time'] = strtotime($visitRow['visit_last_action_time']);
$this->visitorInfo['visit_first_action_time'] = strtotime($visitRow['visit_first_action_time']);
$this->visitorInfo['idvisit'] = $visitRow['idvisit'];
$this->visitorInfo['username'] = $visitRow['username'];
$this->visitorInfo['visit_exit_idaction_url'] = $visitRow['visit_exit_idaction_url'];
$this->visitorKnown = true;
printDebug("The visitor is known because of his userSettings+IP (idcookie = {$visitRow['visitor_idcookie']}, idvisit$
}
Thus I ensured, that when a known visitor returns the correct username is added. So only new visitors remain without username - for me a small problem, as my websites have rarely new visitors.
I added the username then in some widgets, so I get the information displayed.
What my hack lacks? First of all, it is not integrated with the using websites. The username from Joomla, Gallery, WordPress, … is not used. First of all, I found no convenient way to do it. Either you change the tracking code (which would have to be made seperately for each website) or you try to retrieve it somehow from within piwik… I suppose hooks would be the best way to do it (Tracker.newVisitorInformation and Tracker.knownVisitorInformation). But it only works, when user log in to the website. As long as they don’t log in, we remain blind style_emoticons/<#EMO_DIR#>/wink.gif
The hack is not usable for websites with a lot of users.
If there is interest the small hack could be integrated into the core, although I think, it could be done more elegantly, than I did it.
lg
Andy