Opened 3 years ago

Closed 3 years ago

#1975 closed Bug (fixed)

Some goals have conversion rate more than 100%

Reported by: matt Owned by: matt
Priority: normal Milestone: 1.5 - Piwik 1.5
Component: Core Keywords:
Cc: Sensitive: no

Description (last modified by matt)

Is this expected? if yes, create FAQ to explain why. If not, this is a bug to fix.

see http://forum.piwik.org/read.php?2,70802

Change History (4)

comment:1 Changed 3 years ago by matt (mattab)

  • Description modified (diff)

comment:2 Changed 3 years ago by SteveG (sgiehl)

I would suppose that is a bug. Checking the code I found this in plugins/Goals/Controller.php:

private function getConversionRateReturningVisitors( $idSite, $period, $date, $idGoal = false )
{
	// visits converted for returning for all goals = call Frequency API
	if($idGoal === false)
	{
		$request = new Piwik_API_Request("method=VisitFrequency.getConvertedVisitsReturning&idSite=$idSite&period=$period&date=$date&format=original");
		$nbVisitsConvertedReturningVisitors = $request->process();
	}
	// visits converted for returning = nb conversion for this goal
	else
	{
		$nbVisitsConvertedReturningVisitors = Piwik_Goals_API::getInstance()->getConversions($idSite, $period, $date, $segment=false,$idGoal);
	}
	// all returning visits
	$request = new Piwik_API_Request("method=VisitFrequency.getVisitsReturning&idSite=$idSite&period=$period&date=$date&format=original");
	$nbVisitsReturning = $request->process();

	return Piwik::getPercentageSafe($nbVisitsConvertedReturningVisitors, $nbVisitsReturning, Piwik_Goals::ROUNDING_PRECISION);
}

If I seen that right, if a goalid is given, the plugin uses the overall conversion rate for calculating the rate for returning visitors?

comment:3 Changed 3 years ago by matt (mattab)

  • Owner set to matt

comment:4 Changed 3 years ago by matt (mattab)

  • Resolution set to fixed
  • Status changed from new to closed

(In [4691]) 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
Note: See TracTickets for help on using tickets.