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

When creating a segment, Ecommerce Order value dimension should be numeric #20120

Closed
mattab opened this issue Dec 18, 2022 · 5 comments
Closed
Labels
answered For when a question was asked and we referred to forum or answered it. Potential Bug Something that might be a bug, but can't be reproduced (yet).

Comments

@mattab
Copy link
Member

mattab commented Dec 18, 2022

Expected Behavior

When creating a segment, Ecommerce Order value dimension should be numeric, and offer comparisons like "Less than, Less than or equal," etc.

Current Behavior

Order value shows the "string" operators instead:
Screenshot from 2022-12-19 08-12-40

Steps to Reproduce (for Bugs)

  1. add a new segment to an Ecommerce enabled website
  2. add the Order value dimension
  3. Try to say "Less than or equal" to 0 but it's not possible

Context

  • Trying to create a segment where Ecommerce order value is zero, currently the segment doesn't work (Order value is 0.00), and hoping it's just because of this bug.
@mattab mattab added Potential Bug Something that might be a bug, but can't be reproduced (yet). To Triage An issue awaiting triage by a Matomo core team member labels Dec 18, 2022
@mattab mattab added this to the 5.1.0 milestone Dec 18, 2022
@sgiehl
Copy link
Member

sgiehl commented Dec 19, 2022

Hm. I actually don't even have a segment "Order Value". The dimension does have different segments configured. See

protected $nameSingular = 'Ecommerce_OrderValue';
public function getDbDiscriminator()
{
return new Discriminator($this->dbTableName, 'idgoal', GoalManager::IDGOAL_ORDER);
}
public function configureSegments(SegmentsList $segmentsList, DimensionSegmentFactory $dimensionSegmentFactory)
{
//new Segment revenue on order
$segment = new Segment();
$segment->setCategory($this->category);
$segment->setName(Piwik::translate('Ecommerce_OrderRevenue'));
$segment->setSegment('revenueOrder');
$segment->setSqlSegment('log_conversion.idvisit');
$segment->setSqlFilter(function ($valueToMatch, $sqlField, $matchType) {
return $this->getRevenueQuery($valueToMatch, $sqlField , $matchType, 0);
});
$segmentsList->addSegment($dimensionSegmentFactory->createSegment($segment));
//new Segment revenue left in cart
$segment = new Segment();
$segment->setCategory($this->category);
$segment->setName(Piwik::translate('Ecommerce_RevenueLeftInCart'));
$segment->setSegment('revenueAbandonedCart');
$segment->setSqlSegment('log_conversion.idvisit');
$segment->setSqlFilter(function ($valueToMatch, $sqlField , $matchType) {
return $this->getRevenueQuery($valueToMatch, $sqlField , $matchType,-1);
});
$segmentsList->addSegment($dimensionSegmentFactory->createSegment($segment));
}

@bx80
Copy link
Contributor

bx80 commented Jan 4, 2023

@mattab Thanks for the screenshot and reproductions steps 👍 I've tried to recreate this issue, but I only have Order Revenue in the ecommerce segment dimensions, which is numeric as expected - is it possible that Order Value is a custom dimension or has been added by some other means? Do you also have an Order Revenue dimension in the list for this site?

image

@bx80 bx80 added the Waiting for user feedback Indicates the Matomo team is waiting for feedback from the author or other users. label Jan 4, 2023
@mattab
Copy link
Member Author

mattab commented Jan 4, 2023

Thanks for the feedback, it was indeed a custom dimension called "order value" and when using the correct "order revenue" dimension, then it works as expected 👍

@mattab mattab closed this as not planned Won't fix, can't repro, duplicate, stale Jan 4, 2023
@mattab mattab added the answered For when a question was asked and we referred to forum or answered it. label Jan 4, 2023
@heurteph-ei
Copy link

Hello @mattab and happy new year!
Maybe this could good idea to take the opportunity (with your initial issue) to define the format of custom dimension (string, boolean, numeric, date, etc.). Then the segment definition could take this info in consideration and they could be build properly?

@bx80 bx80 removed Waiting for user feedback Indicates the Matomo team is waiting for feedback from the author or other users. To Triage An issue awaiting triage by a Matomo core team member labels Jan 8, 2023
@mattab
Copy link
Member Author

mattab commented Jan 12, 2023

Absolutely @heurteph-ei and i believe this is already the case, for example for "strings" we have operators like "Contains" whereas for "numbers" we don't but then we have "less than" etc.

@mattab mattab removed this from the 5.1.0 milestone Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it. Potential Bug Something that might be a bug, but can't be reproduced (yet).
Projects
None yet
Development

No branches or pull requests

4 participants