Add human and machine opens setting
[MAILPOET-6164]
This commit is contained in:
@@ -2,6 +2,7 @@ import { SaveButton } from 'settings/components';
|
|||||||
import { TaskScheduler } from './task-scheduler';
|
import { TaskScheduler } from './task-scheduler';
|
||||||
import { Roles } from './roles';
|
import { Roles } from './roles';
|
||||||
import { EngagementTracking } from './engagement-tracking';
|
import { EngagementTracking } from './engagement-tracking';
|
||||||
|
import { HumanAndMachineOpens } from './human-and-machine-opens';
|
||||||
import { Transactional } from './transactional';
|
import { Transactional } from './transactional';
|
||||||
import { InactiveSubscribers } from './inactive-subscribers';
|
import { InactiveSubscribers } from './inactive-subscribers';
|
||||||
import { ShareData } from './share-data';
|
import { ShareData } from './share-data';
|
||||||
@@ -19,6 +20,7 @@ export function Advanced() {
|
|||||||
<TaskScheduler />
|
<TaskScheduler />
|
||||||
<Roles />
|
<Roles />
|
||||||
<EngagementTracking />
|
<EngagementTracking />
|
||||||
|
<HumanAndMachineOpens />
|
||||||
<Transactional />
|
<Transactional />
|
||||||
<RecalculateSubscriberScore />
|
<RecalculateSubscriberScore />
|
||||||
<InactiveSubscribers />
|
<InactiveSubscribers />
|
||||||
|
@@ -0,0 +1,45 @@
|
|||||||
|
import { ReactElement } from 'react';
|
||||||
|
import { t } from 'common/functions';
|
||||||
|
import { Radio } from 'common/form/radio/radio';
|
||||||
|
import { useSetting } from 'settings/store/hooks';
|
||||||
|
import { Label, Inputs } from 'settings/components';
|
||||||
|
|
||||||
|
export function HumanAndMachineOpens(): ReactElement {
|
||||||
|
const [opens, setOpensMode] = useSetting('tracking', 'opens');
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Label
|
||||||
|
title={t('humanAndMachineOpensTitle')}
|
||||||
|
description={t('humanAndMachineOpensDescription')}
|
||||||
|
htmlFor="opens_mode"
|
||||||
|
/>
|
||||||
|
<Inputs>
|
||||||
|
<div className="mailpoet-settings-inputs-row">
|
||||||
|
<Radio
|
||||||
|
id="opens-merged"
|
||||||
|
value="merged"
|
||||||
|
checked={opens === 'merged'}
|
||||||
|
onCheck={setOpensMode}
|
||||||
|
automationId="opens-merged-radio"
|
||||||
|
/>
|
||||||
|
<label htmlFor="opens-merged">
|
||||||
|
{t('humanAndMachineOpensMerged')}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div className="mailpoet-settings-inputs-row">
|
||||||
|
<Radio
|
||||||
|
id="opens-separated"
|
||||||
|
value="separated"
|
||||||
|
checked={opens === 'separated'}
|
||||||
|
onCheck={setOpensMode}
|
||||||
|
automationId="opens-separated-radio"
|
||||||
|
/>
|
||||||
|
<label htmlFor="opens-separated">
|
||||||
|
{t('humanAndMachineOpensSeparated')}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</Inputs>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
@@ -115,7 +115,10 @@ export function normalizeSettings(data: Record<string, unknown>): Settings {
|
|||||||
'Action Scheduler',
|
'Action Scheduler',
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
tracking: asObject({ level: asEnum(['full', 'partial', 'basic'], 'full') }),
|
tracking: asObject({
|
||||||
|
level: asEnum(['full', 'partial', 'basic'], 'full'),
|
||||||
|
opens: asEnum(['merged', 'separated'], 'merged'),
|
||||||
|
}),
|
||||||
send_transactional_emails: disabledRadio,
|
send_transactional_emails: disabledRadio,
|
||||||
deactivate_subscriber_after_inactive_days: asEnum(
|
deactivate_subscriber_after_inactive_days: asEnum(
|
||||||
['', '90', '180', '365', '540'],
|
['', '90', '180', '365', '540'],
|
||||||
|
@@ -49,6 +49,7 @@ export type Settings = {
|
|||||||
};
|
};
|
||||||
tracking: {
|
tracking: {
|
||||||
level: 'full' | 'basic' | 'partial';
|
level: 'full' | 'basic' | 'partial';
|
||||||
|
opens: 'merged' | 'separated';
|
||||||
};
|
};
|
||||||
'3rd_party_libs': {
|
'3rd_party_libs': {
|
||||||
enabled: '' | '1';
|
enabled: '' | '1';
|
||||||
|
@@ -64,6 +64,7 @@ function WooCommerceController({
|
|||||||
MailPoet.trackingConfig.level === 'basic' ? 'basic' : 'partial';
|
MailPoet.trackingConfig.level === 'basic' ? 'basic' : 'partial';
|
||||||
const trackingData: Settings['tracking'] = {
|
const trackingData: Settings['tracking'] = {
|
||||||
level: allowed ? 'full' : trackingLevelForDisabledCookies,
|
level: allowed ? 'full' : trackingLevelForDisabledCookies,
|
||||||
|
opens: 'merged',
|
||||||
};
|
};
|
||||||
const subscribeOldCustomersData: Settings['mailpoet_subscribe_old_woocommerce_customers'] =
|
const subscribeOldCustomersData: Settings['mailpoet_subscribe_old_woocommerce_customers'] =
|
||||||
{
|
{
|
||||||
@@ -77,6 +78,8 @@ function WooCommerceController({
|
|||||||
// cookies allowed
|
// cookies allowed
|
||||||
'tracking.level': trackingData.level,
|
'tracking.level': trackingData.level,
|
||||||
'woocommerce.accept_cookie_revenue_tracking.set': '1',
|
'woocommerce.accept_cookie_revenue_tracking.set': '1',
|
||||||
|
// human and machine opens
|
||||||
|
'tracking.opens': trackingData.opens,
|
||||||
};
|
};
|
||||||
await updateSettings(settings);
|
await updateSettings(settings);
|
||||||
setTracking(trackingData);
|
setTracking(trackingData);
|
||||||
|
@@ -233,4 +233,9 @@
|
|||||||
'engagementTrackingFull': __('Full – additionally use browser cookies to improve the site and email engagement tracking and abandoned cart email accuracy.'),
|
'engagementTrackingFull': __('Full – additionally use browser cookies to improve the site and email engagement tracking and abandoned cart email accuracy.'),
|
||||||
'engagementTrackingPartial': __('Partial – additionally track email engagement (opens, clicks). Disable cookie-based tracking.'),
|
'engagementTrackingPartial': __('Partial – additionally track email engagement (opens, clicks). Disable cookie-based tracking.'),
|
||||||
'engagementTrackingBasic': __('Basic – only use data your site already has about your subscribers. Disable email engagement and cookie-based tracking, and re-engagement emails.'),
|
'engagementTrackingBasic': __('Basic – only use data your site already has about your subscribers. Disable email engagement and cookie-based tracking, and re-engagement emails.'),
|
||||||
|
|
||||||
|
'humanAndMachineOpensTitle': __('Human and machine opens'),
|
||||||
|
'humanAndMachineOpensDescription': __('Choose how human and machine opens should be displayed.'),
|
||||||
|
'humanAndMachineOpensMerged': __('Merged – both are counted as total opens. Similar to other email marketing tools.'),
|
||||||
|
'humanAndMachineOpensSeparated': __('Separated – only human opens are counted as total opens. More accurate, but the numbers tend to be lower.'),
|
||||||
}) %>
|
}) %>
|
||||||
|
Reference in New Issue
Block a user