mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-29 13:52:10 +03:00
Wired referrers API data to admin dashboard (#15454)
closes https://github.com/TryGhost/Team/issues/1939 - adds real source data counts to attribution table and chart on dashboard
This commit is contained in:
parent
b048b02f67
commit
98fc808e6e
@ -53,7 +53,7 @@ export default class SourceAttributionChart extends Component {
|
||||
} else {
|
||||
const sortedByPaid = [...this.sources];
|
||||
sortedByPaid.sort((a, b) => {
|
||||
return b.paidPercentage - a.paidPercentage;
|
||||
return b.paidConversions - a.paidConversions;
|
||||
});
|
||||
return {
|
||||
labels: sortedByPaid.slice(0, 5).map(source => source.source),
|
||||
|
@ -259,7 +259,7 @@ export default class DashboardStatsService extends Service {
|
||||
}
|
||||
return acc;
|
||||
}, []).sort((a, b) => {
|
||||
return (b.signups + b.paidConversions) - (a.signups - a.paidConversions);
|
||||
return b.signups - a.signups;
|
||||
});
|
||||
}
|
||||
|
||||
@ -547,14 +547,22 @@ export default class DashboardStatsService extends Service {
|
||||
*/
|
||||
@task
|
||||
*_loadMemberAttributionStats() {
|
||||
this.memberAttributionStats = null;
|
||||
this.memberAttributionStats = [];
|
||||
|
||||
if (this.dashboardMocks.enabled) {
|
||||
yield this.dashboardMocks.waitRandom();
|
||||
this.memberAttributionStats = this.dashboardMocks.memberAttributionStats;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
let statsUrl = this.ghostPaths.url.api('stats/referrers/history');
|
||||
let stats = yield this.ajax.request(statsUrl);
|
||||
|
||||
this.memberAttributionStats = stats.stats.map((stat) => {
|
||||
return {
|
||||
...stat,
|
||||
paidConversions: stat.paid_conversions
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
loadMrrStats() {
|
||||
|
Loading…
Reference in New Issue
Block a user