Show third/first party total size (#2920)

This commit is contained in:
Peter Hedenskog 2020-03-13 08:50:27 +01:00 committed by GitHub
parent 7ee505ad68
commit 9dacb295a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 5 deletions

View File

@ -71,6 +71,20 @@ class Aggregator {
['totalTransfer'],
data.transferPerPage
);
statsHelpers.pushGroupStats(
this.urls[url],
this.groups[group],
['firstPartyTransferPerPage'],
data.firstPartyTransferPerPage
);
statsHelpers.pushGroupStats(
this.urls[url],
this.groups[group],
['thirdPartyTransferPerPage'],
data.thirdPartyTransferPerPage
);
}
summarize() {

View File

@ -119,6 +119,11 @@ module.exports = {
: co2PerPageView;
const transferPerPage = message.data.transferSize;
const firstPartyTransferPerPage =
message.data.firstParty.transferSize;
const thirdPartyTransferPerPage =
message.data.thirdParty.transferSize;
// adding these to make the link between data and CO2 clearer
// and also so we can give an idea how big this is compared to
// the norm
@ -141,7 +146,9 @@ module.exports = {
co2PerParty,
hostingInfo,
totalCO2,
transferPerPage
transferPerPage,
firstPartyTransferPerPage,
thirdPartyTransferPerPage
},
message.group,
message.url
@ -158,6 +165,8 @@ module.exports = {
hostingInfo,
co2PerDomain,
totalTransfer: transferPerPage,
firstPartyTransferPerPage,
thirdPartyTransferPerPage,
co2FirstParty: co2PerParty.firstParty,
co2ThirdParty: co2PerParty.thirdParty,
hostingGreenCheck,

View File

@ -25,7 +25,8 @@ if (sustainable.hostingInfo)
- const co2PerPageView = sustainable.co2PerPageView.median || sustainable.co2PerPageView
- const totalCO2 = sustainable.totalCO2.median || sustainable.totalCO2
- const totalTransfer = sustainable.totalTransfer.median || sustainable.totalTransfer
- const firstPartyTransferPerPage = sustainable.firstPartyTransferPerPage.median || sustainable.firstPartyTransferPerPage
- const thirdPartyTransferPerPage = sustainable.thirdPartyTransferPerPage.median || sustainable.thirdPartyTransferPerPage
table
tr
@ -39,12 +40,12 @@ table
tr
td 1 page view first party
td #{h.co2.format(co2FirstParty)}
td
td #{h.co2.format(co2FirstParty)} (#{Number(co2FirstParty / (co2FirstParty + co2ThirdParty) * 100).toFixed(2)} %)
td #{h.size.format(firstPartyTransferPerPage)}
tr
td 1 page view third party
td #{h.co2.format(co2ThirdParty)} (#{Number(co2ThirdParty / (co2FirstParty + co2ThirdParty) * 100).toFixed(2)} %)
td
td #{h.size.format(thirdPartyTransferPerPage)}
if (options.sustainable && options.sustainable.pageViews)
tr