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

Redefine when revenue information is displayed on All Websites Dashboard #22886

Open
wants to merge 6 commits into
base: 5.x-dev
Choose a base branch
from

Conversation

mneudert
Copy link
Member

Description:

In the current All Websites Dashboard (AWD), the revenue information is always shown, unless the Goals plugin is disabled.

For the redesigned AWD, this condition will be changed to only display revenue information if:

  • the Goals plugin is enabled
  • and
    • at least one website is an ecommerce website
    • or at least one goal has a non-zero default revenue
    • or at least one goal is flagged with "use event value as revenue"

This check is done on a per-user basis, a user needs at least view access to any site that would quality for displaying revenue information.


The API Goals.getGoals was fixed to properly return goals for multiple sites. The goal list was indexed by idgoal, but that value is not unique across sites, so if two sites had idgoal = 1, you would only get one result instead of two. The API was changed to NOT index the return list with any defined keys to work around this limitation. Requesting goals for a single site will still return them indexed by idgoal.

Fetching 40k goals across 10k sites took a varying time between 500ms and 1250ms in my development environment according to XHProf (around 50% of the total runtime), with most of the time spent in Goals\API::formatGoal(). The API will not be called if there is at least one ecommerce site available.

Without XHProf active, the response times were always hovering between 175ms and 200ms locally (according to curl), and around 75ms to 100ms without any of the new checks.

If necessary, we can add an (internal?) Goals.hasAtLeastOneGoalWithRevenue($idSites) that could take care of that check in a single database query and circumvent the goal formatting. We can also take this approach if the change to Goals.getGoals qualifies as a breaking change and can not be done in a feature release, even though it is also a fix.


Fixes #5045
Refs DEV-15665

Review

@mneudert mneudert added Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Needs Review PRs that need a code review labels Dec 19, 2024
@mneudert mneudert added this to the 5.3.0 milestone Dec 19, 2024
@mneudert mneudert requested a review from a team December 19, 2024 15:15

### Breaking Changes

* When requesting goals for multiple sites at once using `Goals.getGoals`, the result will no longer be indexed by `idgoal` anymore. Requesting the goals for a single site will still return them indexed by `idgoal`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* When requesting goals for multiple sites at once using `Goals.getGoals`, the result will no longer be indexed by `idgoal` anymore. Requesting the goals for a single site will still return them indexed by `idgoal`.
* When requesting goals for multiple sites at once using `Goals.getGoals`, the result will no longer be indexed by `idgoal`. Requesting the goals for a single site will still return them indexed by `idgoal`.

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. Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove Revenue column in All websites dashboard (when all websites have no ecommerce & no goal revenue > 0)
2 participants