PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.0
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.0
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
← All changes | front/FrontControllers/FronturlController.php +29 -11 11.0.2 → 11.1.0 View file →
@@ -55,13 +55,15 @@
55 55 if (empty($mail) || empty($userStat) || acym_isRobot() || (!empty($delay) && acym_getTimeFromUTCDate($userStat->send_date) > time() - $delay)) {
56 56 acym_redirect($this->resolveSubscriberTags($urlObject->url, $userId), '', 'message', false);
57 57 }
58 58
59 + $anonymousStats = !empty($this->config->get('anonymous_stats', 0));
60 +
59 61 $urlClick = new \stdClass();
60 62 $urlClick->mail_id = $mailId;
61 63 $urlClick->url_id = $urlObject->id;
62 64 $urlClick->click = 1;
63 - $urlClick->user_id = $userId;
65 + $urlClick->user_id = $anonymousStats ? 0 : $userId;
64 66 $urlClick->date_click = acym_date('now', 'Y-m-d H:i:s', false);
65 67
66 68 $mailStatClass = new MailStatClass();
67 69 $urlClickClass = new UrlClickClass();
@@ -66,25 +68,41 @@
66 68 $mailStatClass = new MailStatClass();
67 69 $urlClickClass = new UrlClickClass();
68 70 $urlClickClass->save($urlClick);
69 71
70 - if (empty($userStat->open)) {
71 - $userStatToInsert = new \stdClass();
72 - $userStatToInsert->user_id = $userId;
73 - $userStatToInsert->mail_id = $mailId;
74 - $userStatToInsert->open = 1;
75 - $userStatToInsert->open_date = acym_date('now', 'Y-m-d H:i:s', false);
76 - $userStatClass->save($userStatToInsert);
72 + UserStatClass::triggerActivity('user_click', $userId, $mailId);
77 73
74 + if (!$anonymousStats) {
75 + if (empty($userStat->open)) {
76 + $userStatToInsert = new \stdClass();
77 + $userStatToInsert->user_id = $userId;
78 + $userStatToInsert->mail_id = $mailId;
79 + $userStatToInsert->open = 1;
80 + $userStatToInsert->open_date = acym_date('now', 'Y-m-d H:i:s', false);
81 + $userStatClass->save($userStatToInsert);
82 +
83 + $mailStat = new \stdClass();
84 + $mailStat->mail_id = $mailId;
85 + $mailStat->open_unique = 1;
86 + $mailStat->open_total = 1;
87 + $mailStatClass->save($mailStat);
88 +
89 + UserStatClass::triggerActivity('user_open', $userId, $mailId);
90 + }
91 +
92 + $clickStats = $urlClickClass->getOneByMailIdAndUserId($mailId, $userId);
93 + $mailStatClass->incrementClicks($mailId, $clickStats->click == 1);
94 + } else {
95 + $mailStatClass->incrementClicks($mailId, true);
96 +
97 + // Anonymous mode tracks totals only and keeps no per-recipient open state, so this is not deduplicated.
78 98 $mailStat = new \stdClass();
79 99 $mailStat->mail_id = $mailId;
80 100 $mailStat->open_unique = 1;
81 101 $mailStat->open_total = 1;
82 102 $mailStatClass->save($mailStat);
103 + $mailStatClass->incrementDetail($mailId, 'open_time', acym_date('now', 'Y-m-d H', false).':00:00');
83 104 }
84 -
85 - $clickStats = $urlClickClass->getOneByMailIdAndUserId($mailId, $userId);
86 - $mailStatClass->incrementClicks($mailId, $clickStats->click == 1);
87 105
88 106 $userClass = new UserClass();
89 107 $subscriber = $userClass->getOneById($userId);
90 108 if (!empty($subscriber)) {