Tracking new events

This commit is contained in:
Amine Ben hammou
2017-08-24 10:19:03 +00:00
parent d92b1f57bd
commit 609f1b5e67
9 changed files with 1139 additions and 1075 deletions

View File

@ -32,6 +32,9 @@ define(
}, },
onCreate: function () { onCreate: function () {
MailPoet.Notice.success(MailPoet.I18n.t('segmentAdded')); MailPoet.Notice.success(MailPoet.I18n.t('segmentAdded'));
MailPoet.trackEvent('Lists > Add new', {
'MailPoet Free version': window.mailpoet_version,
});
}, },
}; };

View File

@ -144,6 +144,9 @@ define(
}, },
onCreate: function () { onCreate: function () {
MailPoet.Notice.success(MailPoet.I18n.t('subscriberAdded')); MailPoet.Notice.success(MailPoet.I18n.t('subscriberAdded'));
MailPoet.trackEvent('Subscribers > Add new', {
'MailPoet Free version': window.mailpoet_version,
});
}, },
}; };

View File

@ -157,6 +157,11 @@ define(
.replace('[/link]', '</a>'); .replace('[/link]', '</a>');
jQuery('#export_result_notice').html('<p>' + resultMessage + '</p>').show(); jQuery('#export_result_notice').html('<p>' + resultMessage + '</p>').show();
window.location.href = response.data.exportFileURL; window.location.href = response.data.exportFileURL;
MailPoet.trackEvent('Subscribers export completed', {
'Total exported': response.data.totalExported,
'Only confirmed?': exportData.exportConfirmedOption,
'MailPoet Free version': window.mailpoet_version
});
}).fail(function(response) { }).fail(function(response) {
if (response.errors.length > 0) { if (response.errors.length > 0) {
MailPoet.Notice.error( MailPoet.Notice.error(

View File

@ -141,7 +141,7 @@ define(
// delay loading indicator for 10ms or else it's just too fast :) // delay loading indicator for 10ms or else it's just too fast :)
MailPoet.Modal.loading(true); MailPoet.Modal.loading(true);
setTimeout(function () { setTimeout(function () {
Papa.parse(pasteInputElement.val(), parseCSV()); Papa.parse(pasteInputElement.val(), parseCSV(false));
}, 10); }, 10);
}); });
@ -168,7 +168,7 @@ define(
MailPoet.Modal.loading(true); MailPoet.Modal.loading(true);
setTimeout(function () { setTimeout(function () {
uploadElement.parse({ uploadElement.parse({
config: parseCSV() config: parseCSV(true)
}) })
}, 10); }, 10);
} }
@ -238,6 +238,10 @@ define(
MailPoet.Modal.loading(false); MailPoet.Modal.loading(false);
}).done(function(response) { }).done(function(response) {
importData.step1 = response.data; importData.step1 = response.data;
MailPoet.trackEvent('Subscribers import started', {
source: 'MailChimp',
'MailPoet Free version': window.mailpoet_version
});
router.navigate('step2', {trigger: true}); router.navigate('step2', {trigger: true});
}).fail(function(response) { }).fail(function(response) {
if (response.errors.length > 0) { if (response.errors.length > 0) {
@ -289,7 +293,7 @@ define(
element.closest('table a').addClass(disabled); element.closest('table a').addClass(disabled);
} }
function parseCSV() { function parseCSV(isFile) {
var processedSubscribers = [], var processedSubscribers = [],
parsedEmails = [], parsedEmails = [],
duplicateEmails = [], duplicateEmails = [],
@ -415,6 +419,10 @@ define(
duplicate: duplicateEmails, duplicate: duplicateEmails,
invalid: invalidEmails invalid: invalidEmails
}; };
MailPoet.trackEvent('Subscribers import started', {
source: isFile ? 'file upload' : 'pasted data',
'MailPoet Free version': window.mailpoet_version
});
router.navigate('step2', {trigger: true}); router.navigate('step2', {trigger: true});
} }
else { else {
@ -1070,6 +1078,12 @@ define(
MailPoet.Notice.error(_.flatten(importData.step2.errors)); MailPoet.Notice.error(_.flatten(importData.step2.errors));
} }
MailPoet.trackEvent('Subscribers import finished', {
'Subscribers created': importData.step2.created,
'Subscribers updated': importData.step2.updated,
'MailPoet Free version': window.mailpoet_version
});
// display statistics // display statistics
var subscribersDataImportResultsTemplate = var subscribersDataImportResultsTemplate =
Handlebars Handlebars

View File

@ -513,6 +513,10 @@
}); });
} }
MailPoet.trackEvent('Forms > Add New', {
'MailPoet Free version': window.mailpoet_version
});
// if there is a callback, call it! // if there is a callback, call it!
if(callback !== undefined) { if(callback !== undefined) {
callback(); callback();
@ -566,8 +570,13 @@
mailpoet_form_export(); mailpoet_form_export();
$(document).on('click', '.mailpoet_form_export_toggle', function() { $(document).on('click', '.mailpoet_form_export_toggle', function() {
var type = $(this).data('type');
$('.mailpoet_form_export_output').hide(); $('.mailpoet_form_export_output').hide();
$('#mailpoet_form_export_'+$(this).data('type')).show(); $('#mailpoet_form_export_' + type).show();
MailPoet.trackEvent('Forms > Embed', {
'Embed type': type,
'MailPoet Free version': window.mailpoet_version
});
return false; return false;
}); });
@ -614,6 +623,7 @@
var id = $(this).data('id'); var id = $(this).data('id');
var item = $(this).parent(); var item = $(this).parent();
var name = $(this).siblings('.mailpoet_form_field').attr('wysija_name'); var name = $(this).siblings('.mailpoet_form_field').attr('wysija_name');
var type = $(this).siblings('.mailpoet_form_field').attr('wysija_type');
if(window.confirm( if(window.confirm(
"<%= __('This field will be deleted for all your subscribers. Are you sure?') %>" "<%= __('This field will be deleted for all your subscribers. Are you sure?') %>"
@ -636,6 +646,12 @@
MailPoet.Notice.success( MailPoet.Notice.success(
"<%= __('Removed custom field %$1s') | escape('js') %>".replace('%$1s', '"' + name + '"') "<%= __('Removed custom field %$1s') | escape('js') %>".replace('%$1s', '"' + name + '"')
); );
MailPoet.trackEvent('Forms > Delete custom field', {
'Field type': type,
'MailPoet Free version': window.mailpoet_version
});
}); });
} }
}); });

View File

@ -82,6 +82,11 @@
// close popup // close popup
MailPoet.Modal.close(); MailPoet.Modal.close();
MailPoet.trackEvent('Forms > Add new custom field', {
'Field type': data.type,
'MailPoet Free version': window.mailpoet_version
});
if(WysijaForm.updateBlock(response.data) === true) { if(WysijaForm.updateBlock(response.data) === true) {
// trigger save, if a block has been updated // trigger save, if a block has been updated
mailpoet_form_save(false); mailpoet_form_save(false);

View File

@ -6,7 +6,7 @@
<div> <div>
<p class="mailpoet_sending_methods_help help"> <p class="mailpoet_sending_methods_help help">
<%= __('<strong>Tip:</strong> we have a [link]list of plugins[/link] that work with MailPoet if you need fancier forms.') <%= __('<strong>Tip:</strong> we have a [link]list of plugins[/link] that work with MailPoet if you need fancier forms.')
|replaceLinkTags('http://beta.docs.mailpoet.com/article/198-list-of-forms-plugins-that-work-with-mailpoet?utm_source=plugin&utm_medium=settings&utm_campaign=helpdocs', {'target' : '_blank'}) |replaceLinkTags('http://beta.docs.mailpoet.com/article/198-list-of-forms-plugins-that-work-with-mailpoet?utm_source=plugin&utm_medium=settings&utm_campaign=helpdocs', {'target' : '_blank', id: 'mailpoet_helper_link'})
|raw |raw
%> %>
</p> </p>
@ -68,3 +68,13 @@
'new': __('Add New'), 'new': __('Add New'),
}) %> }) %>
<% endblock %> <% endblock %>
<% block after_javascript %>
<script type="text/javascript">
jQuery('#mailpoet_helper_link').on('click', function() {
MailPoet.trackEvent('Forms page > link to doc page', {
'MailPoet Free version': window.mailpoet_version
});
});
</script>
<% endblock %>

View File

@ -148,3 +148,11 @@
</div> </div>
<% endblock %> <% endblock %>
<% block after_javascript %>
<script type="text/javascript">
MailPoet.trackEvent('Premium page viewed', {
'MailPoet Free version': window.mailpoet_version
});
</script>
<% endblock %>