don't identify mixpanel users if public_id is null
This commit is contained in:
@@ -15,14 +15,17 @@ if (mailpoet_analytics_enabled) {
|
|||||||
|
|
||||||
mixpanel.register({'Platform': 'Plugin'});
|
mixpanel.register({'Platform': 'Plugin'});
|
||||||
|
|
||||||
if(window.mailpoet_analytics_new_public_id === true) {
|
console.log(window.mailpoet_analytics_public_id);
|
||||||
mixpanel.alias(window.mailpoet_analytics_public_id);
|
if(typeof window.mailpoet_analytics_public_id === 'string' && window.mailpoet_analytics_public_id.length > 0) {
|
||||||
} else {
|
if(window.mailpoet_analytics_new_public_id === true) {
|
||||||
mixpanel.identify(window.mailpoet_analytics_public_id);
|
mixpanel.alias(window.mailpoet_analytics_public_id);
|
||||||
}
|
} else {
|
||||||
|
mixpanel.identify(window.mailpoet_analytics_public_id);
|
||||||
|
}
|
||||||
|
|
||||||
if (mailpoet_analytics_data != null) {
|
if (mailpoet_analytics_data != null) {
|
||||||
mixpanel.people.set(mailpoet_analytics_data);
|
mixpanel.people.set(mailpoet_analytics_data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -46,7 +46,7 @@ class Analytics {
|
|||||||
|
|
||||||
/** @return string */
|
/** @return string */
|
||||||
function getPublicId() {
|
function getPublicId() {
|
||||||
$public_id = Setting::getValue('public_id');
|
$public_id = Setting::getValue('public_id', '');
|
||||||
// if we didn't get the user public_id from the shop yet : we create one based on mixpanel distinct_id
|
// if we didn't get the user public_id from the shop yet : we create one based on mixpanel distinct_id
|
||||||
if(empty($public_id) && !empty($_COOKIE['mixpanel_distinct_id'])) {
|
if(empty($public_id) && !empty($_COOKIE['mixpanel_distinct_id'])) {
|
||||||
// the public id has to be diffent that mixpanel_distinct_id in order to be used on different browser
|
// the public id has to be diffent that mixpanel_distinct_id in order to be used on different browser
|
||||||
|
Reference in New Issue
Block a user