-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs #3490 wondering whether all tests still pass when converting use…
…rid to dimension
- Loading branch information
Showing
8 changed files
with
84 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
/** | ||
* Piwik - free/libre analytics platform | ||
* | ||
* @link http://piwik.org | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
* | ||
*/ | ||
namespace Piwik\Plugins\CoreHome\Columns; | ||
|
||
use Piwik\Plugin\Dimension\VisitDimension; | ||
use Piwik\Tracker\Request; | ||
use Piwik\Tracker\Visitor; | ||
use Piwik\Tracker\Action; | ||
|
||
/** | ||
* UserId dimension. | ||
*/ | ||
class UserId extends VisitDimension | ||
{ | ||
/** | ||
* This will be the name of the column in the log_visit table if a $columnType is specified. | ||
* @var string | ||
*/ | ||
protected $columnName = 'user_id'; | ||
|
||
/** | ||
* If a columnType is defined, we will create this a column in the MySQL table having this type. Please make sure | ||
* MySQL will understand this type. Once you change the column type the Piwik platform will notify the user to | ||
* perform an update which can sometimes take a long time so be careful when choosing the correct column type. | ||
* @var string | ||
*/ | ||
protected $columnType = 'VARCHAR(200) NOT NULL'; | ||
|
||
protected function configureSegments() | ||
{ | ||
/* | ||
$segment = new Segment(); | ||
$segment->setSegment('userId'); | ||
$segment->setCategory('General_Visit'); | ||
$segment->setName('CoreHome_UserId'); | ||
$segment->setAcceptedValues('Here you should explain which values are accepted/useful: Any number, for instance 1, 2, 3 , 99'); | ||
$this->addSegment($segment);*/ | ||
} | ||
|
||
/** | ||
* @param Request $request | ||
* @param Visitor $visitor | ||
* @param Action|null $action | ||
* @return mixed|false | ||
*/ | ||
public function onNewVisit(Request $request, Visitor $visitor, $action) | ||
{ | ||
return $request->getForcedUserId(); | ||
} | ||
|
||
/** | ||
* @param Request $request | ||
* @param Visitor $visitor | ||
* @param Action|null $action | ||
* | ||
* @return mixed|false | ||
*/ | ||
public function onExistingVisit(Request $request, Visitor $visitor, $action) | ||
{ | ||
$forcedUserId = $request->getForcedUserId(); | ||
if (strlen($forcedUserId) > 0) { | ||
return $forcedUserId; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters