Track MixPanel events for Settings [MAILPOET-998]
This commit is contained in:
committed by
pavel-mailpoet
parent
7e6d900b53
commit
08bbfcb5e8
@@ -70,6 +70,14 @@ define(
|
||||
|
||||
// show "save settings" button
|
||||
jQuery('.mailpoet_settings_submit').show();
|
||||
|
||||
MailPoet.trackEvent(
|
||||
'User has clicked a tab in Settings',
|
||||
{
|
||||
'MailPoet Free version': window.mailpoet_version,
|
||||
'Tab ID': tab
|
||||
}
|
||||
);
|
||||
}
|
||||
}));
|
||||
|
||||
|
@@ -131,7 +131,7 @@ class Functions extends \Twig_Extension {
|
||||
}
|
||||
|
||||
function getMailPoetPremiumVersion() {
|
||||
return (defined('MAILPOET_PREMIUM_VERSION')) ? MAILPOET_PREMIUM_VERSION : 'N/A';
|
||||
return (defined('MAILPOET_PREMIUM_VERSION')) ? MAILPOET_PREMIUM_VERSION : false;
|
||||
}
|
||||
|
||||
function getWPTimeFormat() {
|
||||
|
@@ -45,7 +45,7 @@ jQuery('.toplevel_page_mailpoet-newsletters.menu-top-last')
|
||||
var mailpoet_date_format = "<%= wp_datetime_format()|escape('js') %>";
|
||||
var mailpoet_time_format = "<%= wp_time_format()|escape('js') %>";
|
||||
var mailpoet_version = "<%= mailpoet_version() %>";
|
||||
var mailpoet_premium_version = "<%= mailpoet_premium_version() %>";
|
||||
var mailpoet_premium_version = <%= json_encode(mailpoet_premium_version()) %>;
|
||||
var mailpoet_analytics_enabled = <%= is_analytics_enabled() | json_encode %>;
|
||||
var mailpoet_analytics_data = <%= json_encode(get_analytics_data()) %>;
|
||||
</script>
|
||||
|
@@ -97,6 +97,19 @@
|
||||
"<%= __('Settings saved') | escape('js') %>",
|
||||
{ scroll: true }
|
||||
);
|
||||
MailPoet.trackEvent(
|
||||
'User has saved Settings',
|
||||
{
|
||||
'MailPoet Free version': window.mailpoet_version,
|
||||
'Sending method type': settings_data.mta_group || null,
|
||||
'Sending frequency (emails)': settings_data.mta_group != 'mailpoet' && settings_data.mta && settings_data.mta.frequency && settings_data.mta.frequency.emails,
|
||||
'Sending frequency (interval)': settings_data.mta_group != 'mailpoet' && settings_data.mta && settings_data.mta.frequency && settings_data.mta.frequency.interval,
|
||||
'Sending provider': settings_data.mta_group == 'smtp' && settings_data.smtp_provider,
|
||||
'Sign-up confirmation enabled': (settings_data.signup_confirmation && settings_data.signup_confirmation.enabled == true),
|
||||
'Bounce email is present': (settings_data.bounce && settings_data.bounce.address != ""),
|
||||
'Newsletter task scheduler method': (settings_data.cron_trigger && settings_data.cron_trigger.method)
|
||||
}
|
||||
);
|
||||
}).fail(function(response) {
|
||||
if (response.errors.length > 0) {
|
||||
MailPoet.Notice.error(
|
||||
|
@@ -724,6 +724,7 @@
|
||||
"<%= __('The email has been sent! Check your inbox.') | escape('js') %>",
|
||||
{ scroll: true }
|
||||
);
|
||||
trackTestEmailSent(true);
|
||||
}).fail(function(response) {
|
||||
if (response.errors.length > 0) {
|
||||
MailPoet.Notice.error(
|
||||
@@ -731,6 +732,7 @@
|
||||
{ scroll: true }
|
||||
);
|
||||
}
|
||||
trackTestEmailSent(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -858,6 +860,24 @@
|
||||
// render sending frequency form
|
||||
$('#mailpoet_smtp_provider').trigger('change');
|
||||
$('#mailpoet_web_host').trigger('change');
|
||||
|
||||
function trackTestEmailSent(success) {
|
||||
MailPoet.trackEvent(
|
||||
'User has sent a test email from Settings',
|
||||
{
|
||||
'Sending was successful': !!success,
|
||||
'Sending method type': mailer.method,
|
||||
'MailPoet Free version': window.mailpoet_version
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
$('.mailpoet_sending_methods_help a').on('click', function() {
|
||||
MailPoet.trackEvent(
|
||||
'User has clicked to view the sending comparison table',
|
||||
{'MailPoet Free version': window.mailpoet_version}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
function setProviderForm() {
|
||||
|
@@ -146,6 +146,13 @@
|
||||
.attr('href', response.meta.premium_activate_url || '#');
|
||||
$('.mailpoet_premium_activate').show();
|
||||
}
|
||||
MailPoet.trackEvent(
|
||||
'User has validated a Premium key',
|
||||
{
|
||||
'MailPoet Free version': window.mailpoet_version,
|
||||
'Premium plugin is active': response.meta.premium_plugin_active
|
||||
}
|
||||
);
|
||||
}).fail(function(response) {
|
||||
if (response.errors.length > 0) {
|
||||
$('.mailpoet_premium_key_invalid').text(
|
||||
@@ -153,6 +160,13 @@
|
||||
);
|
||||
$('.mailpoet_premium_key_invalid').removeClass('mailpoet_hidden');
|
||||
}
|
||||
MailPoet.trackEvent(
|
||||
'User has failed to validate a Premium key',
|
||||
{
|
||||
'MailPoet Free version': window.mailpoet_version,
|
||||
'Premium plugin is active': !!window.mailpoet_premium_version
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -184,6 +198,20 @@
|
||||
});
|
||||
}
|
||||
|
||||
$('.mailpoet_premium_install_link').on('click', function() {
|
||||
MailPoet.trackEvent(
|
||||
'User has installed the Premium plugin from Settings',
|
||||
{'MailPoet Free version': window.mailpoet_version}
|
||||
);
|
||||
});
|
||||
|
||||
$('.mailpoet_premium_activate_link').on('click', function() {
|
||||
MailPoet.trackEvent(
|
||||
'User has activated the Premium plugin from Settings',
|
||||
{'MailPoet Free version': window.mailpoet_version}
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user