Skip to content

Commit

Permalink
Refs matomo-org#3089, show abandoned cart info in visitor profile if …
Browse files Browse the repository at this point in the history
…present.
  • Loading branch information
Benaka Moorthi committed Sep 11, 2013
1 parent ef9a068 commit c3190b1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
3 changes: 2 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,8 @@
"LastVisit": "Last visit",
"VisitSummary": "Spent a total of %1$s%2$s on the website%3$s, and %4$sviewed %5$s pages in %6$s visits.%7$s",
"ConvertedNGoals": "Converted %s Goals",
"EcommerceSummary": "Ecommerce: %1$s%2$s orders for a total of %3$s%4$s, purchased %5$s items.",
"EcommerceSummaryConversions": "%1$s%2$s orders for a total of %3$s%4$s, purchased %5$s items.",
"AbandonedCartSummary": "%1$s%2$s abandoned carts%3$s and %4$s abandoned items %5$sworth a total of %6$s%7$s.",
"VisitedPages": "Visited pages",
"LoadMoreVisits": "Load more visits",
"NoMoreVisits_js": "There are no more visits for this visitor.",
Expand Down
13 changes: 9 additions & 4 deletions plugins/Live/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,17 @@ public function getLastVisitsDetails($idSite, $period, $date, $segment = false,
}

/**
* TODO
* TODO: add abandoned cart info.
* Returns an array describing a visitor using her last visits (uses a maximum of 100).
*
* TODO: check for most recent vs. first visit
* TODO: check for goals plugin, etc.
*
* @param int $idSite Site ID
* @param string $idVisitor The ID of the visitor whose profile to retrieve.
* @param string|false $segment
* @return array
*/
public function getVisitorProfile($idSite, $idVisitor = false, $segment = false)
public function getVisitorProfile($idSite, $idVisitor, $segment = false)
{
if ($idVisitor === false) {
$idVisitor = $this->getMostRecentVisitorId($idSite, $segment);
Expand All @@ -179,7 +184,7 @@ public function getVisitorProfile($idSite, $idVisitor = false, $segment = false)
if ($segment !== false) {
$segment .= ';';
}
$segment .= 'visitorId==' . $idVisitor; // TODO what happens when visitorId is in the segment?
$segment .= 'visitorId==' . $idVisitor;

$visits = $this->getLastVisitsDetails($idSite, $period = false, $date = false, $segment,
$filter_limit = self::VISITOR_PROFILE_MAX_VISITS_TO_AGGREGATE,
Expand Down
1 change: 1 addition & 0 deletions plugins/Live/stylesheets/visitor_profile.less
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@

.visitor-profile-summary > div {
margin-top:6px;
margin-right:1em;
}

.visitor-profile-summary strong {
Expand Down
9 changes: 7 additions & 2 deletions plugins/Live/templates/getVisitorProfilePopup.twig
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,13 @@
{%- if not loop.first %}, {% endif -%}{{- totalConversions }} <span class="visitor-profile-goal-name">{{ goals[idGoal]['name'] -}}</span>
{%- endfor -%}
){% endif %}.</p>
{% if visitorData.totalEcommerceConversions is defined %}
<p>{{ 'Live_EcommerceSummary'|translate('<strong>', visitorData.totalEcommerceConversions, visitorData.totalEcommerceRevenue|money(idSite), '</strong>', visitorData.totalEcommerceItems)|raw }}</p>
{% if visitorData.totalEcommerceConversions is defined or visitorData.totalAbandonedCarts is defined %}
<p>
{{ 'Goals_Ecommerce'|translate }}:
{%- if visitorData.totalEcommerceConversions is defined %} {{ 'Live_EcommerceSummaryConversions'|translate('<strong>', visitorData.totalEcommerceConversions, visitorData.totalEcommerceRevenue|money(idSite), '</strong>', visitorData.totalEcommerceItems)|raw }}
{%- endif -%}
{%- if visitorData.totalAbandonedCarts|default(0) >= 0 %} {{ 'Live_AbandonedCartSummary'|translate('<strong>', visitorData.totalAbandonedCarts, '</strong>', visitorData.totalAbandonedCartsItems, '<strong>', visitorData.totalAbandonedCartsRevenue|money(idSite), '</strong>')|raw }}{%- endif -%}
</p>
{% endif %}
</div>
</div>
Expand Down

0 comments on commit c3190b1

Please sign in to comment.