Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattpiwik <matthieu.aubry@gmail.com>2011-05-16 02:14:48 +0400
committermattpiwik <matthieu.aubry@gmail.com>2011-05-16 02:14:48 +0400
commit371af63e77c78cf302ced9926e87f427b8d2d7d8 (patch)
tree8b9e91fe39f68ba32fb7f190bbd43b20fe2eaacc /plugins/Live/Visitor.php
parent9279b6ac7440620db237a7a213b8191442ffcb48 (diff)
Refs #898 Work in progress (but should leave trunk stable and not break anything)
* Now tracking Ecommerce Items (sku,name,category,qty,price) * zero, 1 or many items can be in a Ecommerce Cart (total), or an Ecommerce order (orderid, grandtotal, subtotal, tax, shipping, discount) * A Cart left at the end of a visit becomes an Abandoned cart. New reports separate orders from abandoned carts. * JS API and PHP API have 3 new functions (add items, track cart update, track ecommerce order) * JS stores timestamp last ecommerce transaction in id cookie so we can count repeat buyers * Goals.get API now returns stats for the two goals: ecommerceOrder and ecommerceAbandonedCart * new API functions to request Items (product) reports: getItemsSku, getItemsName, getItemsCategory. See doc: If you are tracking Ecommerce orders and products on your site, the functions "getItemsSku", "getItemsName" and "getItemsCategory" will return the list of products purchased on your site, either grouped by Product SKU, Product Name or Product Category. For each name, SKU or category, the following metrics are returned: Total revenue, quantity, average price, average quantity, number of orders with this product. By default, these functions returns the 'Products purchased'. These functions also accept an optional parameter &abandonedCarts=1. If the parameter is set, it will instead return the metrics for products that were left in an abandoned cart therefore not purchased. The API also lets you request overall Goal metrics via the method "get": Conversions, Visits with at least one conversion, Conversion rate and Revenue. If you wish to request specific metrics about Ecommerce goals, you can set the parameter &idGoal=ecommerceAbandonedCart to get metrics about abandoned carts (including Lost revenue, and number of items left in the cart) or &idGoal=ecommerceOrder to get metrics about Ecommerce orders (number of orders, visits with an order, subtotal, tax, shipping, discount, revenue, items ordered) * showing ecommerce orders/abandoned carts in the Live! API output * new segments: visitEcommerceStatus and daysSinceLastEcommerceOrder * these new attributes also appears in Live! API output * Fixes #1975 as side effect of cleaning up all this code this bug should now be fixed (bug was to use nb of conversions as dividend, rather than number of converted visits) * adding full integration test testing all possible use cases regarding Ecommerce carts/orders/items etc. * also integration testing the changes to piwik.js git-svn-id: http://dev.piwik.org/svn/trunk@4691 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/Live/Visitor.php')
-rw-r--r--plugins/Live/Visitor.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/plugins/Live/Visitor.php b/plugins/Live/Visitor.php
index 1d03159201..77b97c0c81 100644
--- a/plugins/Live/Visitor.php
+++ b/plugins/Live/Visitor.php
@@ -44,6 +44,7 @@ class Piwik_Live_Visitor
'visitorId' => $this->getVisitorId(),
'visitorType' => $this->isVisitorReturning() ? 'returning' : 'new',
'visitConverted' => $this->isVisitorGoalConverted(),
+ 'visitEcommerceStatus' => $this->getVisitEcommerceStatus(),
'actions' => $this->getNumberOfActions(),
// => false are placeholders to be filled in API later
@@ -65,6 +66,7 @@ class Piwik_Live_Visitor
'visitCount' => $this->getVisitCount(),
'daysSinceLastVisit' => $this->getDaysSinceLastVisit(),
'daysSinceFirstVisit' => $this->getDaysSinceFirstVisit(),
+ 'daysSinceLastEcommerceOrder' => $this->getDaysSinceLastEcommerceOrder(),
'country' => $this->getCountryName(),
'countryFlag' => $this->getCountryFlag(),
'continent' => $this->getContinent(),
@@ -117,6 +119,10 @@ class Piwik_Live_Visitor
return $this->details['visitor_days_since_last'];
}
+ function getDaysSinceLastEcommerceOrder()
+ {
+ return $this->details['visitor_days_since_order'];
+ }
function getDaysSinceFirstVisit()
{
return $this->details['visitor_days_since_first'];
@@ -379,6 +385,11 @@ class Piwik_Live_Visitor
return date('Y-m-d H:i:s', strtotime($this->details['visit_last_action_time']));
}
+ function getVisitEcommerceStatus()
+ {
+ return Piwik_API_API::getVisitEcommerceStatusFromId($this->details['visit_goal_buyer']);
+ }
+
function isVisitorGoalConverted()
{
return $this->details['visit_goal_converted'];