Skip to content

Commit

Permalink
Refs #5113 This may fix the bug where Outlinks are marked as "Page na…
Browse files Browse the repository at this point in the history
…me not defined".

Let's see which integration tests now fail
  • Loading branch information
mattab committed May 14, 2014
1 parent 214f556 commit 1bf9a20
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions core/Tracker/Action.php
Expand Up @@ -250,25 +250,22 @@ public function record($idVisit, $visitorIdCookie, $idReferrerActionUrl, $idRefe
{
$this->loadIdsFromLogActionTable();

$idActionName = in_array($this->getActionType(), array(Tracker\Action::TYPE_PAGE_TITLE,
Tracker\Action::TYPE_PAGE_URL,
Tracker\Action::TYPE_SITE_SEARCH
))
? (int)$this->getIdActionName()
: 0;

$visitAction = array(
'idvisit' => $idVisit,
'idsite' => $this->request->getIdSite(),
'idvisitor' => $visitorIdCookie,
'server_time' => Tracker::getDatetimeFromTimestamp($this->request->getCurrentTimestamp()),
'idaction_url' => $this->getIdActionUrl(),
'idaction_name' => $idActionName,
'idaction_url_ref' => $idReferrerActionUrl,
'idaction_name_ref' => $idReferrerActionName,
'time_spent_ref_action' => $timeSpentReferrerAction
);

// idaction_name is NULLable. we only set it when applicable
if($this->isActionHasActionName()) {
$visitAction['idaction_name'] = (int)$this->getIdActionName();
}

foreach($this->actionIdsCached as $field => $idAction) {
$visitAction[$field] = $idAction;
}
Expand Down Expand Up @@ -307,4 +304,14 @@ public function record($idVisit, $visitorIdCookie, $idReferrerActionUrl, $idRefe
*/
Piwik::postEvent('Tracker.recordAction', array($trackerAction = $this, $visitAction));
}

/**
* @return bool
*/
protected function isActionHasActionName()
{
return in_array($this->getActionType(), array(Tracker\Action::TYPE_PAGE_TITLE,
Tracker\Action::TYPE_PAGE_URL,
Tracker\Action::TYPE_SITE_SEARCH));
}
}

0 comments on commit 1bf9a20

Please sign in to comment.