PluginProbe
Elementor Website Builder – more than just a page builder / 3.35.0-dev2
Elementor Website Builder – more than just a page builder v3.35.0-dev2
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
← All changes | core/common/modules/events-manager/module.php +15 -33 4.2.13.35.0-dev2 View file →
@@ -3,11 +3,9 @@
3 3 namespace Elementor\Core\Common\Modules\EventsManager;
4 4
5 5 use Elementor\Core\Base\Module as BaseModule;
6 6 use Elementor\Core\Common\Modules\Connect\Apps\Base_App;
7 -use Elementor\Core\Common\Modules\Connect\Apps\Common_App;
8 7 use Elementor\Core\Experiments\Manager as Experiments_Manager;
9 -use Elementor\Includes\EditorAssetsAPI;
10 8 use Elementor\Utils;
11 9 use Elementor\Plugin;
12 10 use Elementor\Tracker;
13 11
@@ -17,9 +15,9 @@
17 15
18 16 class Module extends BaseModule {
19 17
20 18 const EXPERIMENT_NAME = 'editor_events';
21 - const DEFAULT_SESSION_RECORDING_PERCENT = 0;
19 +
22 20 const REMOTE_MIXPANEL_CONFIG_URL = 'https://assets.elementor.com/mixpanel/v1/mixpanel.json';
23 21
24 22 public function get_name() {
25 23 return 'events-manager';
@@ -30,27 +28,14 @@
30 28 Tracker::is_allow_track() &&
31 29 ! Tracker::has_terms_changed( '2025-07-07' ) &&
32 30 Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_NAME );
33 31
34 - $is_flags_enabled = false;
35 - $session_recording_percent = self::DEFAULT_SESSION_RECORDING_PERCENT;
36 - $debug = ( defined( 'ELEMENTOR_EDITOR_EVENTS_DEBUG' ) && ELEMENTOR_EDITOR_EVENTS_DEBUG ) ?? false;
32 + $mixpanel_config = self::get_remote_mixpanel_config();
33 + $session_replays = $mixpanel_config[0]['sessionReplays'] ?? [];
34 + $is_flags_enabled = $mixpanel_config[0]['flags'] ?? false;
37 35
38 - if ( $can_send_events ) {
39 - $mixpanel_config = self::get_remote_mixpanel_config();
40 - $has_config = EditorAssetsAPI::has_valid_nested_array( $mixpanel_config, [ 0 ] );
41 -
42 - if ( $has_config ) {
43 - $is_flags_enabled = (bool) ( $mixpanel_config[0]['flags'] ?? false );
44 -
45 - $session_replays = $mixpanel_config[0]['sessionReplays'] ?? [];
46 - $session_recording_percent = $session_replays['recordSessionsPercent'] ?? null;
47 - }
48 - }
49 -
50 36 $settings = [
51 37 'can_send_events' => $can_send_events,
52 - 'debug' => $debug,
53 38 'elementor_version' => ELEMENTOR_VERSION,
54 39 'site_url' => hash( 'sha256', get_site_url() ),
55 40 'wp_version' => get_bloginfo( 'version' ),
56 41 'user_agent' => esc_html( Utils::get_super_global_value( $_SERVER, 'HTTP_USER_AGENT' ) ),
@@ -58,11 +43,11 @@
58 43 'site_key' => get_option( Base_App::OPTION_CONNECT_SITE_KEY ),
59 44 'subscription_id' => self::get_subscription_id(),
60 45 'subscription' => self::get_subscription(),
61 46 'token' => ELEMENTOR_EDITOR_EVENTS_MIXPANEL_TOKEN,
47 + 'session_replays' => $session_replays,
62 48 'flags_enabled' => $is_flags_enabled,
63 - 'user_id' => self::get_user_id(),
64 - 'session_recording_percent' => $session_recording_percent,
49 + 'isEditorOneActive' => Plugin::$instance->experiments->is_feature_active( 'e_editor_one' ),
65 50 ];
66 51
67 52 return $settings;
68 53 }
@@ -101,22 +86,19 @@
101 86 return json_decode( $license_data['value'], true );
102 87 }
103 88
104 89 private static function get_remote_mixpanel_config() {
105 - $editor_assets_api = new EditorAssetsAPI( [
106 - EditorAssetsAPI::ASSETS_DATA_URL => static::REMOTE_MIXPANEL_CONFIG_URL,
107 - EditorAssetsAPI::ASSETS_DATA_TRANSIENT_KEY => '_elementor_mixpanel_config',
108 - EditorAssetsAPI::ASSETS_DATA_KEY => 'mixpanel',
109 - ] );
90 + $data = wp_remote_get( static::REMOTE_MIXPANEL_CONFIG_URL );
110 91
111 - return $editor_assets_api->get_assets_data();
112 - }
113 - private static function get_user_id() {
114 - $user_common_data = get_user_option( Common_App::OPTION_CONNECT_COMMON_DATA_KEY );
92 + if ( is_wp_error( $data ) ) {
93 + return [];
94 + }
115 95
116 - if ( ! is_array( $user_common_data ) ) {
117 - return null;
96 + $data = json_decode( wp_remote_retrieve_body( $data ), true );
97 +
98 + if ( empty( $data['mixpanel'] ) || ! is_array( $data['mixpanel'] ) ) {
99 + return [];
118 100 }
119 101
120 - return Common_App::get_connect_user_id_from_access_token( $user_common_data['access_token'] ?? null );
102 + return $data['mixpanel'];
121 103 }
122 104 }