diff --git a/assets/js/src/nps_poll.jsx b/assets/js/src/nps_poll.jsx index ad3183c635..17e5826b84 100644 --- a/assets/js/src/nps_poll.jsx +++ b/assets/js/src/nps_poll.jsx @@ -41,10 +41,7 @@ const withNpsPoll = function withNpsPoll(Component) { } displayPoll() { - if ( - !this.state.pollShown - && window.mailpoet_installed_at_isoFormat - ) { + if (!this.state.pollShown) { this.setState({ pollShown: true }); getTrackingData().then(this.callSatismeter); } @@ -59,9 +56,9 @@ const withNpsPoll = function withNpsPoll(Component) { traits: { name: window.mailpoet_current_wp_user.user_nicename, email: window.mailpoet_current_wp_user.user_email, - createdAt: window.mailpoet_installed_at_isoFormat, mailpoetVersion: window.mailpoet_version, mailpoetPremiumIsActive: window.mailpoet_premium_active, + createdAt: trackingData.installedAtIso, newslettersSent: trackingData.newslettersSent, welcomeEmails: trackingData.welcomeEmails, postnotificationEmails: trackingData.postnotificationEmails, diff --git a/lib/Analytics/Reporter.php b/lib/Analytics/Reporter.php index f9ec0bbe45..8fb815d42a 100644 --- a/lib/Analytics/Reporter.php +++ b/lib/Analytics/Reporter.php @@ -1,6 +1,7 @@ settings->get('mta', []); + $installed_at = new DateTime($this->settings->get('installed_at')); return [ + 'installedAtIso' => $installed_at->format(DateTime::ISO8601), 'newslettersSent' => $newletters['sent_newsletters_count'], 'welcomeEmails' => $newletters['welcome_newsletters_count'], 'postnotificationEmails' => $newletters['notifications_count'], diff --git a/views/newsletters.html b/views/newsletters.html index 16fb917277..1764ae43cd 100644 --- a/views/newsletters.html +++ b/views/newsletters.html @@ -8,7 +8,6 @@ var mailpoet_display_nps_poll = <%= settings.display_nps_poll ? 'true' : 'false' %>; var mailpoet_segments = <%= json_encode(segments) %>; var mailpoet_show_congratulate_after_first_newsletter = <%= show_congratulate_after_first_newsletter %>; - var mailpoet_installed_at_isoFormat = "<%= settings['installed_at'] | date('c') %>"; var mailpoet_installed_days_ago = <%= installed_days_ago %>; var mailpoet_current_wp_user = <%= json_encode(current_wp_user) %>; var mailpoet_current_wp_user_firstname = '<%= current_wp_user_firstname %>';