Fix save and track saved settings
[MAILPOET-2677]
This commit is contained in:
committed by
Veljko V
parent
c4d53df406
commit
e5ff076e78
@@ -12,12 +12,12 @@ export function* saveSettings() {
|
|||||||
const { success, error } = yield {
|
const { success, error } = yield {
|
||||||
type: 'CALL_API',
|
type: 'CALL_API',
|
||||||
endpoint: 'settings',
|
endpoint: 'settings',
|
||||||
method: 'save',
|
action: 'set',
|
||||||
data,
|
data,
|
||||||
};
|
};
|
||||||
if (!success) {
|
if (!success) {
|
||||||
return { type: 'SAVE_FAILED', error };
|
return { type: 'SAVE_FAILED', error };
|
||||||
}
|
}
|
||||||
yield { type: 'TRACK_SETTINGS_SAVED', data };
|
yield { type: 'TRACK_SETTINGS_SAVED' };
|
||||||
return { type: 'SAVE_DONE' };
|
return { type: 'SAVE_DONE' };
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,34 @@
|
|||||||
|
import MailPoet from 'mailpoet';
|
||||||
|
import { select } from '@wordpress/data';
|
||||||
|
import { STORE_NAME } from '.';
|
||||||
|
|
||||||
export { default as CALL_API } from 'common/controls/call_api';
|
export { default as CALL_API } from 'common/controls/call_api';
|
||||||
|
|
||||||
export function TRACK_SETTINGS_SAVED({ data }) {
|
export function TRACK_SETTINGS_SAVED() {
|
||||||
// ...
|
const settings = select(STORE_NAME).getSettings();
|
||||||
|
const { mailpoet_version, mailpoet_woocommerce_active } = window as any;
|
||||||
|
const data = {
|
||||||
|
'MailPoet Free version': mailpoet_version,
|
||||||
|
'Sending method type': settings.mta_group || null,
|
||||||
|
'Sending frequency (emails)': (
|
||||||
|
settings.mta_group !== 'mailpoet'
|
||||||
|
&& settings.mta
|
||||||
|
&& settings.mta.frequency
|
||||||
|
&& settings.mta.frequency.emails
|
||||||
|
),
|
||||||
|
'Sending frequency (interval)': (
|
||||||
|
settings.mta_group !== 'mailpoet'
|
||||||
|
&& settings.mta
|
||||||
|
&& settings.mta.frequency
|
||||||
|
&& settings.mta.frequency.interval
|
||||||
|
),
|
||||||
|
'Sending provider': settings.mta_group === 'smtp' && settings.smtp_provider,
|
||||||
|
'Sign-up confirmation enabled': settings.signup_confirmation && settings.signup_confirmation.enabled,
|
||||||
|
'Bounce email is present': settings.bounce && settings.bounce.address !== '',
|
||||||
|
'Newsletter task scheduler method': (settings.cron_trigger && settings.cron_trigger.method),
|
||||||
|
};
|
||||||
|
if (mailpoet_woocommerce_active) {
|
||||||
|
data['WooCommerce email customizer enabled'] = settings.woocommerce && settings.woocommerce.use_mailpoet_editor;
|
||||||
|
}
|
||||||
|
MailPoet.trackEvent('User has saved Settings', data);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user