Initialize NPS poll only once

[MAILPOET-1688]
This commit is contained in:
Rostislav Wolny
2018-12-17 10:21:07 +01:00
parent 5190c23274
commit 15d43ea716

View File

@@ -25,26 +25,10 @@ function displayPoll() {
&& window.satismeter
&& window.mailpoet_installed_at_isoFormat
) {
// New users poll
const newUsersPollId = '6L479eVPXk7pBn6S';
const oldUsersPollId = 'k0aJAsQAWI2ERyGv';
window.satismeter({
writeKey: '6L479eVPXk7pBn6S',
userId: window.mailpoet_current_wp_user.ID + window.mailpoet_site_url,
traits: {
name: window.mailpoet_current_wp_user.user_nicename,
email: window.mailpoet_current_wp_user.user_email,
createdAt: window.mailpoet_installed_at_isoFormat,
},
events: {
submit: (response) => {
if (response.rating >= 9 && response.completed) {
showReviewRequestModal();
}
},
},
});
// Old users poll
window.satismeter({
writeKey: 'k0aJAsQAWI2ERyGv',
writeKey: window.mailpoet_is_new_user ? newUsersPollId : oldUsersPollId,
userId: window.mailpoet_current_wp_user.ID + window.mailpoet_site_url,
traits: {
name: window.mailpoet_current_wp_user.user_nicename,