@adaqus opened this Issue on August 3rd 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 commented on August 3rd 2016 Member

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 :+1:

@embrainer commented on April 17th 2020

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 commented on April 20th 2020 Member

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

Powered by GitHub Issue Mirror