| Server IP : 3.93.235.159 / Your IP : 216.73.216.140 Web Server : Apache System : Linux ip-172-26-0-169 5.10.0-46-cloud-amd64 #1 SMP Debian 5.10.262-1 (2026-07-31) x86_64 User : bitnami ( 1000) PHP Version : 8.2.9 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /bitnami/wordpress/wp-content/plugins/site-mailer/assets/js/globals/services/ |
Upload File : |
import mixpanel from 'mixpanel-browser';
const SHARE_USAGE_DATA = 'share_usage_data';
const MIXPANEL_TOKEN = '150605b3b9f979922f2ac5a52e2dcfe9';
const MIXPANEL_HOST = 'https://api-eu.mixpanel.com';
const APP_INSTANCE_KEY = 'app_mailer';
const init = async () => {
const { siteMailerSettingsData } = window;
const plan = siteMailerSettingsData?.planData?.plan;
if ( ! siteMailerSettingsData?.planScope?.includes( SHARE_USAGE_DATA ) ) {
return;
}
await mixpanel.init( MIXPANEL_TOKEN, {
api_host: MIXPANEL_HOST,
debug: siteMailerSettingsData.pluginEnv === 'dev',
track_pageview: false,
persistence: 'localStorage',
persistence_name: APP_INSTANCE_KEY,
} );
mixpanel.register( {
productName: APP_INSTANCE_KEY,
appType: 'Apps',
environment: siteMailerSettingsData.pluginEnv,
is_trial: Boolean( plan?.features?.plan?.toLowerCase().includes( 'trial' ) ),
plan_type: plan?.name,
subscription_id: plan?.subscription_id,
} );
mixpanel.identify( siteMailerSettingsData?.planData?.user?.id );
const userData = {
$email: siteMailerSettingsData?.planData?.user?.email,
$user_id: siteMailerSettingsData?.planData?.user?.id,
$subscription_type: plan?.name,
$subscription_id: plan?.subscription_id,
$subscription_status: plan?.status,
};
mixpanel.people?.set_once( userData );
};
const sendEvent = ( name, event ) => {
if ( mixpanel.__loaded ) {
mixpanel.track( name, event );
}
};
export const mixpanelService = {
init,
sendEvent,
};
export const eventNames = {
review: {
promptShown: 'review_prompt_shown',
dismissClicked: 'review_dismiss_clicked',
starSelected: 'review_star_selected',
feedbackSubmitted: 'review_feedback_submitted',
publicRedirectClicked: 'review_public_redirect_clicked',
},
};