Skip to content
Extraits de code Groupes Projets
Valider 050fd0ae rédigé par Benaka Moorthi's avatar Benaka Moorthi
Parcourir les fichiers

Refs #3089, initial visitor profile integration with UserCountryMap..

parent a3bc6979
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -365,6 +365,4 @@ class PluginDeactivatedException extends Exception
{
parent::__construct("The plugin $module is not enabled. You can activate the plugin on Settings > Plugins page in Piwik.");
}
}
}
\ No newline at end of file
......@@ -53,6 +53,10 @@ require_once PIWIK_INCLUDE_PATH . '/plugins/Live/Visitor.php';
*/
class Piwik_Live_API
{
const VISITOR_PROFILE_MAX_VISITS_TO_AGGREGATE = 100;
const VISITOR_PROFILE_MAX_VISITS_TO_SHOW = 10;
const VISITOR_PROFILE_DATE_FORMAT = '%day% %shortMonth% %longYear%';
static private $instance = null;
/**
......@@ -155,10 +159,6 @@ class Piwik_Live_API
return $dataTable;
}
const VISITOR_PROFILE_MAX_VISITS_TO_AGGREGATE = 100;
const VISITOR_PROFILE_MAX_VISITS_TO_SHOW = 10;
const VISITOR_PROFILE_DATE_FORMAT = '%day% %shortMonth% %longYear%';
/**
* TODO
* TODO: add abandoned cart info.
......
......@@ -15,6 +15,7 @@ use Piwik\Config;
use Piwik\Controller;
use Piwik\ViewDataTable;
use Piwik\View;
use Piwik\FrontController;
/**
* @package Piwik_Live
......@@ -143,6 +144,25 @@ class Piwik_Live_Controller extends Controller
$view->idSite = $idSite;
$view->goals = Piwik_Goals_API::getInstance()->getGoals($idSite);
$view->visitorData = Request::processRequest('Live.getVisitorProfile');
$view->userCountryMap = $this->getUserCountryMapForVisitorProfile();
echo $view->render();
}
private function getUserCountryMapForVisitorProfile()
{
if (empty($_GET['segment'])) {
$_GET['segment'] = '';
$originalSegment = '';
} else {
$_GET['segment'] .= '&';
$originalSegment = $_GET['segment'];
}
$_GET['segment'] .= 'visitorId==' . Common::getRequestVar('idVisitor');
$result = FrontController::getInstance()->fetchDispatch('UserCountryMap', 'visitorMap', array('fetch' => true)); // TODO: check if plugin is enabled?
$_GET['segment'] = $originalSegment;
return $result;
}
}
\ No newline at end of file
// TODO: use less variables for height & width
.visitor-profile {
position:relative;
width:1149px;
height:758px;
height:844px;
border:1px solid #a19e96;
border-radius:5px;
background:url(../images/visitor_profile_background.jpg) repeat;
......@@ -66,7 +67,7 @@
}
.visitor-profile-info {
height:705px;
height:791px;
border-top:2px solid #f6f6f6;
border-bottom:1px solid #d1cec8;
border-radius:5px 5px 0 0;
......@@ -187,11 +188,11 @@
padding:19px 0 18px 19px;
}
.visitor-profile-map * {
.visitor-profile-map > div {
border-radius:2px;
background-color:#fff;
width:532px;
height:243px;
height:334px;
padding:2px;
}
......@@ -244,7 +245,7 @@
}
.visitor-profile-actions {
height:460px;
height:550px;
overflow-y:auto;
position:relative;
margin-right:10px;
......@@ -359,7 +360,8 @@
}
}
.visitor-profile-goal-name {
span.visitor-profile-goal-name {
font-weight:bold;
font-style:italic;
font-size:13px;
}
\ No newline at end of file
......@@ -45,23 +45,23 @@
</div>
<div style="clear:both; border:none!important;"></div>
<div class="visitor-profile-map">
<img alt="" src="plugins/Live/images/REMOVE_ME_map.jpg"/> {# TODO: map #}
{{ userCountryMap|raw }}
</div>
<div class="visitor-profile-important-visits">
<div>
<h1>First visit</h1>
<div>
<p><strong>{{ visitorData.firstVisit.prettyDate }}</strong><span> - {{ visitorData.firstVisit.daysAgo }} days ago</span></p>
<p><span>from:</span></p>
<p><strong>{{ visitorData.firstVisit.referralSummary }}</strong></p>
<p><strong>{{ visitorData.firstVisit.prettyDate }}</strong><span>&nbsp;- {{ visitorData.firstVisit.daysAgo }} days ago</span></p>
<p><span>from:</span>
<strong>{{ visitorData.firstVisit.referralSummary }}</strong></p>
</div>
</div>
<div>
<h1>Last visit</h1>
<div>
<p><strong>{{ visitorData.lastVisit.prettyDate }}</strong><span> - {{ visitorData.lastVisit.daysAgo }} days ago</span></p>
<p><span>from:</span></p>
<p><strong>{{ visitorData.lastVisit.referralSummary }}</strong></p>
<p><span>from:</span>
<strong>{{ visitorData.lastVisit.referralSummary }}</strong></p>
</div>
</div>
</div>
......
......@@ -27,7 +27,7 @@ class Piwik_UserCountryMap_Controller extends Controller
// By default plot up to the last 30 days of visitors on the map, for low traffic sites
const REAL_TIME_WINDOW = 'last30';
public function visitorMap()
public function visitorMap($fetch = false)
{
$this->checkUserCountryPluginEnabled();
......@@ -36,6 +36,7 @@ class Piwik_UserCountryMap_Controller extends Controller
$period = Common::getRequestVar('period');
$date = Common::getRequestVar('date');
$segment = Common::getRequestVar('segment', '', 'string');
$token_auth = Piwik::getCurrentUserTokenAuth();
$view = new View('@UserCountryMap/visitorMap');
......@@ -78,6 +79,7 @@ class Piwik_UserCountryMap_Controller extends Controller
'period' => $period,
'idSite' => $idSite,
'date' => $date,
'segment' => $segment,
'token_auth' => $token_auth,
'enable_filter_excludelowpop' => 1,
'filter_excludelowpop_value' => -1
......@@ -89,7 +91,11 @@ class Piwik_UserCountryMap_Controller extends Controller
$view->config = Common::json_encode($config);
$view->noData = empty($config['visitsSummary']['nb_visits']);
echo $view->render();
if ($fetch) {
return $view->render();
} else {
echo $view->render();
}
}
/**
......@@ -207,7 +213,7 @@ class Piwik_UserCountryMap_Controller extends Controller
. "&period=" . $period
. "&date=" . $date
. "&token_auth=" . $token_auth
. "&segment=" . \Piwik\API\Request::getRawSegmentFromRequest()
. "&segment=" . Common::getRequestVar('segment', '', 'string')
. "&enable_filter_excludelowpop=1"
. "&showRawMetrics=1";
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter