-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #571 from plausible/revenue-metrics-apiv2
Revenue metrics in APIv2
- Loading branch information
Showing
7 changed files
with
171 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
// Whether imported data was included | ||
// Only set if include.imports was set | ||
"imports_included": false, | ||
|
||
// Information about why including imported data failed | ||
"imports_skip_reason": "unsupported_interval", | ||
"imports_warning": "Imported stats are not included because the time dimension (i.e. the interval) is too short.", | ||
|
||
// Warnings about specific metrics | ||
// Currently only set if a revenue metric was used and was unable to be calculated | ||
"metric_warnings": { | ||
"total_revenue": { | ||
"code": "no_revenue_goals_matching", | ||
"warning": "Revenue metrics are null as there are no matching revenue goals." | ||
} | ||
}, | ||
|
||
// Only set if include.time_labels was set | ||
"time_labels": [ | ||
"2024-09-10 00:00:00", | ||
"2024-09-10 01:00:00", | ||
"2024-09-10 02:00:00", | ||
"2024-09-10 03:00:00", | ||
"2024-09-10 04:00:00", | ||
"2024-09-10 05:00:00", | ||
"2024-09-10 06:00:00" | ||
], | ||
|
||
// Only set if include.total_rows was set | ||
"total_rows": 342 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"site_id": "dummy.site", | ||
"metrics": ["total_revenue"], | ||
"date_range": "all", | ||
"dimensions": ["event:goal"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"results": [ | ||
{ | ||
"dimensions": ["North America Purchases"], | ||
"metrics": [ | ||
{ | ||
"short": "$96.3M", | ||
"value": 96336315, | ||
"long": "$96,336,315.00", | ||
"currency": "USD" | ||
} | ||
] | ||
}, | ||
{ | ||
"dimensions": ["Visit /"], | ||
"metrics": [null] | ||
} | ||
], | ||
"meta": {}, | ||
"query": { | ||
"site_id": "dummy.site", | ||
"metrics": ["total_revenue"], | ||
"date_range": ["2021-12-14T00:00:00+00:00", "2024-12-11T23:59:59+00:00"], | ||
"filters": [], | ||
"dimensions": ["event:goal"], | ||
"order_by": [["total_revenue", "desc"]], | ||
"include": {}, | ||
"pagination": {"offset": 0, "limit": 10000} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"site_id": "dummy.site", | ||
"metrics": ["total_revenue"], | ||
"date_range": "all", | ||
"filters": [ | ||
["is", "event:goal", ["PurchaseUSD", "PurchaseEUR"]] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"results": [ | ||
{"metrics": [null], "dimensions": ["Visit /"]} | ||
], | ||
"meta": { | ||
"metric_warnings": { | ||
"total_revenue": { | ||
"code": "no_single_revenue_currency", | ||
"warning": "Revenue metrics are null as there are multiple currencies for the selected event:goals." | ||
} | ||
} | ||
}, | ||
"query": { | ||
"site_id": "dummy.site", | ||
"metrics": ["total_revenue"], | ||
"date_range": ["2021-12-14T00:00:00+00:00", "2024-12-11T23:59:59+00:00"], | ||
"filters": [["is", "event:goal", ["PurchaseUSD", "PurchaseEUR"]]], | ||
"dimensions": [], | ||
"order_by": [["total_revenue", "desc"]], | ||
"include": {}, | ||
"pagination": {"offset": 0, "limit": 10000} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters