(function ($, Drupal, drupalSettings, cookies) {
'use strict';
Drupal.tabClicked = false;
Drupal.behaviors.mixpanelInit = {
attach: function (context, settings) {
// Check if Mixpanel has been initialized
if (!Drupal.behaviors.mixpanelInit.initialized) {
// Mixpanel token
var token = drupalSettings.mixpanel?.mp_token;
mixpanel.init(token, {debug: true, persistence: 'localStorage'});
// Identify user logged in or anonymous.
if (drupalSettings.user.uid) {
mixpanel.identify(drupalSettings.mixpanel.userData.user_id);
} else {
const mixpanelAnnonId = getCookie('mixpanel_annon_id');
mixpanelAnnonId ? mixpanel.identify(mixpanelAnnonId) : mixpanel.identify(drupalSettings.mixpanel.userData?.device_id)
}
// Set a flag to indicate that Mixpanel has been initialized
Drupal.behaviors.mixpanelInit.initialized = true;
}
why we are getting 255467 format of distinct id for guest users as anonymous id on cleint side and also identify call is not getting triggered?