From a43fd34f7d03aa25f81545f78bf52f04fc6a87d5 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Thu, 27 Jan 2022 17:50:04 -0300 Subject: [PATCH] Stats email: display clicked in the first row and opened in the second This commit makes some changes to the stats email. It displays just the clicked stats in the first row and it moves the opened stats to the second row. It also adds machine-opens alongside opens in the second row. [MAILPOET-3324] --- .../Workers/StatsNotifications/Worker.php | 2 + mailpoet/views/emails/statsNotification.html | 132 +++++++++++------- 2 files changed, 87 insertions(+), 47 deletions(-) diff --git a/mailpoet/lib/Cron/Workers/StatsNotifications/Worker.php b/mailpoet/lib/Cron/Workers/StatsNotifications/Worker.php index 6072f33ca0..e9efafcaa7 100644 --- a/mailpoet/lib/Cron/Workers/StatsNotifications/Worker.php +++ b/mailpoet/lib/Cron/Workers/StatsNotifications/Worker.php @@ -136,6 +136,7 @@ class Worker { $statistics = $this->newsletterStatisticsRepository->getStatistics($newsletter); $clicked = ($statistics->getClickCount() * 100) / $statistics->getTotalSentCount(); $opened = ($statistics->getOpenCount() * 100) / $statistics->getTotalSentCount(); + $machineOpened = ($statistics->getMachineOpenCount() * 100) / $statistics->getTotalSentCount(); $unsubscribed = ($statistics->getUnsubscribeCount() * 100) / $statistics->getTotalSentCount(); $subject = $sendingQueue->getNewsletterRenderedSubject(); $subscribersCount = $this->subscribersRepository->getTotalSubscribers(); @@ -153,6 +154,7 @@ class Worker { 'linkStats' => WPFunctions::get()->getSiteUrl(null, '/wp-admin/admin.php?page=mailpoet-newsletters&stats=' . $newsletter->getId()), 'clicked' => $clicked, 'opened' => $opened, + 'machineOpened' => $machineOpened, 'subscribersLimitReached' => $this->subscribersFeature->check(), 'hasValidApiKey' => $hasValidApiKey, 'subscribersLimit' => $this->subscribersFeature->getSubscribersLimit(), diff --git a/mailpoet/views/emails/statsNotification.html b/mailpoet/views/emails/statsNotification.html index 9d2ebf9a71..2177fe4bd7 100644 --- a/mailpoet/views/emails/statsNotification.html +++ b/mailpoet/views/emails/statsNotification.html @@ -153,52 +153,6 @@ -
- - - - -
- - <%= opened_stats_text(opened) %> -
-
- - - - -

- - <%= number_format_i18n(opened, 1) %>% - -

- - - - - - - - -
- - <%= __('open rate') %> - -
- - - - - - -
- - - - + + +
@@ -227,7 +181,91 @@ + +
- <%= __('click rate') %> + <%= __('clicked') %> + +
+
+
+ + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+

+ + <%= number_format_i18n(opened, 1) %>% + +

+
+ + + + +
+ + <%= __('opened') %> + +
+
+
+ +
+ + + + + + +
+

+ + <%= number_format_i18n(machineOpened, 1) %>% + +

+
+ + +
+ + <%= __('machine-opened') %>