🐛 Fixed link click counts for duplicate links (#15789)

refs https://github.com/TryGhost/Team/issues/2213

When an email contains multiple links to the same destination, that link
is only shown once on the analytics page. The total displayed count is
not summed correctly.
This commit is contained in:
Simon Backx 2022-11-10 10:51:26 +01:00 committed by GitHub
parent a5c4091620
commit c2dfb2b579
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -171,7 +171,14 @@ export default class Analytics extends Component {
if (!acc[link.link.title]) { if (!acc[link.link.title]) {
acc[link.link.title] = link; acc[link.link.title] = link;
} else { } else {
acc[link.link.title].clicks += link.clicks; if (!acc[link.link.title].count) {
acc[link.link.title].count = {clicks: 0};
}
if (!acc[link.link.title].count.clicks) {
acc[link.link.title].count.clicks = 0;
}
acc[link.link.title].count.clicks += (link.count?.clicks ?? 0);
} }
return acc; return acc;
}, {}); }, {});