Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ecommerce Life Time Value metrics + New Ecommerce section in Visitor Profile #11294

Merged
merged 7 commits into from Jan 30, 2017

Conversation

mattab
Copy link
Member

@mattab mattab commented Jan 30, 2017

All Ecommerce metrics shown in the Visitor Profile now apply to "Life time" (before they used to apply to last 100 visits only).

Need to fix system test before merging

Fixes #2750

@mattab mattab added this to the 3.0.2 milestone Jan 30, 2017
COALESCE(SUM(" . LogAggregator::getSqlRevenue('items') . "), 0) as lifeTimeEcommerceItems
FROM " . Common::prefixTable('log_visit') . " AS log_visit
LEFT JOIN " . Common::prefixTable('log_visit') . " AS log_visit_visitors
ON (log_visit.idsite = log_visit_visitors.idsite AND log_visit.idvisitor = log_visit_visitors.idvisitor)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't we safe one join when matching by idvisitor directly? do we not have the idVisitor in Live API?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, will do this

private function getSqlEcommerceConversionsLifeTimeMetricsForIdGoal($ecommerceIdGoal)
{
$sql = "SELECT
COALESCE(SUM(" . LogAggregator::getSqlRevenue('revenue') . "), 0) as lifeTimeRevenue,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering why we need COALESCE ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUM returns NULL when there are not matching rows (ie. no ecommerce conversions)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, usually just doing it in PHP as usually better readable

@mattab mattab merged commit 9ccb607 into 3.x-dev Jan 30, 2017
@mattab mattab deleted the ecommerce_ltv branch January 30, 2017 04:34
@mattab mattab mentioned this pull request Jan 30, 2017
@mattab mattab mentioned this pull request Feb 21, 2017
@mattab mattab added the Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. label Feb 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LTV analytics - Ecommerce Life Time Value metric in Piwik Visitor Profile and Live APIs
2 participants