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

Scheduled Reports: error while sending report using segment with custom dimension when 'All Websites dashboard' statistic is included #16143

Open
adaqus opened this issue Aug 3, 2016 · 4 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc. c: Custom Dimensions For issues related to the Custom Dimensions plugin.

Comments

@adaqus
Copy link

adaqus commented Aug 3, 2016

Steps to reproduce:

  1. Create any segment using custom dimension (let's name it dimensionSegment).
  2. While creating new scheduled report, select dimensionSegment in 'Choose a segment'.
  3. Check 'All Websites dashboard' in 'Statistics included'.
  4. Click 'Update Report'.
  5. Run ./console core:run-scheduled-tasks "Piwik\Plugins\ScheduledReports\API.sendReport_ID OF CREATED REPORT".

Following error will appear:

INFO [2016-08-03 15:50:03] Error getting '?idSite=1&period=day&date=2016-08-01&apiModule=MultiSites&apiAction=getAll&idGoal=0&language=en&serialize=0&format=original&segment=dimension2%253D%253Dblabla' when generating scheduled report: API returned an error: Segment 'dimension2' is not a supported segment. at Segment.php:139

From what I understand, this is because MultiSites wants to get all segments for all sites, while CustomDimensions is able to return segments for one idsite at once: https://github.com/piwik/plugin-CustomDimensions/blob/master/CustomDimensions.php#L163. So when Segment instance is created, no segments from CustomDimensions are available and the Exception with 'Segment 'dimension2' is not a supported segment' message is thrown: https://github.com/piwik/piwik/blob/master/core/Segment.php#L139.

Current solution for this is to either not to select in report a segment that uses custom dimension or not to check 'All Websites dashboard' in 'Statistics included'.

@mattab
Copy link
Member

mattab commented Aug 3, 2016

Thank you for the bug report!

Current solution for this is to either not to select in report a segment that uses custom dimension or not to check 'All Websites dashboard' in 'Statistics included'.

There could be several ways to solve this. In any case, the scheduled report should not completely fail to generate. Maybe we could replace any failing statistics report such as the failing "All websites", by "The All Websites report could not be generated: $error_message". Other statistics added to the report should still generate.

There could be more elaborate solutions (eg. when Custom Dimension segment is selected in a scheduled report, display a note that All Websites stats report cannot be included in the list, and skip this report during generation to prevent errors).

Pull request very welcome 👍

@embrainer
Copy link

We want to use custom dimensions to create segments. When adding such a segment to a single website, this works as expected, however, when adding the segment to all websites, a popup appears with the same error:
The specified segment is invalid: Segment 'dimension1' is not a supported segment.

@tsteur
Copy link
Member

tsteur commented Apr 20, 2020

@embrainer this is expected unfortunately since the dimension1 might not exist for all websites (or when creating a new website in the future)

@tsteur tsteur transferred this issue from matomo-org/plugin-CustomDimensions Jun 29, 2020
@tsteur tsteur added Bug For errors / faults / flaws / inconsistencies etc. c: Custom Dimensions For issues related to the Custom Dimensions plugin. labels Jun 29, 2020
@bjammin
Copy link

bjammin commented Jul 18, 2023

@embrainer this is expected unfortunately since the dimension1 might not exist for all websites (or when creating a new website in the future)

I still note the same behaviour now. The dimension does exist for all websites, yet if I make any segment using a custom dimension for "all websites" I get the error "The specified segment is invalid: Segment 'dimension1' is not a supported segment."

Should this work, or is there a bug at play? (I have several deleted websites, could that be it?)

If it's not supported, is there any easy way to copy my segments to all 26 websites on my installation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. c: Custom Dimensions For issues related to the Custom Dimensions plugin.
Projects
None yet
Development

No branches or pull requests

6 participants