Added clicks stats to links table
This commit is contained in:
parent
09de6e4576
commit
3273c43184
2 changed files with 21 additions and 3 deletions
|
@ -278,6 +278,12 @@ router.get('/view/:id', passport.csrfProtection, (req, res) => {
|
|||
let index = 0;
|
||||
campaign.links = (links || []).map(link => {
|
||||
link.index = ++index;
|
||||
link.totalPercentage = campaign.delivered ? Math.round(((link.clicks / campaign.delivered) * 100) * 1000) / 1000 : 0;
|
||||
link.relPercentage = campaign.clicks ? Math.round(((link.clicks / campaign.clicks) * 100) * 1000) / 1000 : 0;
|
||||
link.short = link.url.replace(/^https?:\/\/(www.)?/i, '');
|
||||
if (link.short > 63) {
|
||||
link.short = link.short.substr(0, 60) + '…';
|
||||
}
|
||||
return link;
|
||||
});
|
||||
campaign.showOverview = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue