Add MixPanel events

[MAILPOET-2549]
This commit is contained in:
Pavel Dohnal
2020-01-20 16:02:18 +01:00
committed by Jack Kitterhing
parent 20fdea408e
commit 139b3691bf
3 changed files with 18 additions and 1 deletions

View File

@@ -20,6 +20,10 @@ const FormPlacementPanel = ({ onToggle, isOpened }) => {
const exportLinkClicked = curry((type, event) => { const exportLinkClicked = curry((type, event) => {
event.preventDefault(); event.preventDefault();
MailPoet.trackEvent('Forms > Embed', {
'Embed type': type,
'MailPoet Free version': window.mailpoet_version,
});
if (type === 'php') { if (type === 'php') {
return setCopyAreaContent(formExports.php); return setCopyAreaContent(formExports.php);
} }

View File

@@ -84,6 +84,10 @@ export default {
}) })
.then((response) => { .then((response) => {
const customField = response.data; const customField = response.data;
MailPoet.trackEvent('Forms > Add new custom field', {
'Field type': customField.type,
'MailPoet Free version': window.mailpoet_version,
});
const blockName = registerCustomFieldBlock(customField); const blockName = registerCustomFieldBlock(customField);
const customFieldBlock = createBlock(blockName); const customFieldBlock = createBlock(blockName);
dispatch('core/block-editor').replaceBlock(action.clientId, customFieldBlock); dispatch('core/block-editor').replaceBlock(action.clientId, customFieldBlock);
@@ -108,6 +112,10 @@ export default {
}, },
}) })
.then(() => { .then(() => {
MailPoet.trackEvent('Forms > Delete custom field', {
'Field type': customField.type,
'MailPoet Free version': window.mailpoet_version,
});
dispatch('mailpoet-form-editor').deleteCustomFieldDone(actionData.customFieldId, actionData.clientId); dispatch('mailpoet-form-editor').deleteCustomFieldDone(actionData.customFieldId, actionData.clientId);
dispatch('core/block-editor').removeBlock(actionData.clientId); dispatch('core/block-editor').removeBlock(actionData.clientId);
unregisterBlockType( unregisterBlockType(

View File

@@ -131,7 +131,12 @@ class FormList extends React.Component {
endpoint: 'forms', endpoint: 'forms',
action: 'create', action: 'create',
}).done((response) => { }).done((response) => {
window.location = window.mailpoet_form_edit_url + response.data.id; MailPoet.trackEvent('Forms > Add New', {
'MailPoet Free version': window.mailpoet_version,
});
setTimeout(() => {
window.location = window.mailpoet_form_edit_url + response.data.id;
}, 200);
}).fail((response) => { }).fail((response) => {
if (response.errors.length > 0) { if (response.errors.length > 0) {
MailPoet.Notice.error( MailPoet.Notice.error(