PluginProbe
Elementor Website Builder – more than just a page builder / 3.35.0-dev4
Elementor Website Builder – more than just a page builder v3.35.0-dev4
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 -28 4.1.33.35.0-dev4 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,19 @@
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
32 + $session_replays = [];
34 33 $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;
37 34
38 35 if ( $can_send_events ) {
39 36 $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 - }
37 + $session_replays = $mixpanel_config[0]['sessionReplays'] ?? [];
38 + $is_flags_enabled = $mixpanel_config[0]['flags'] ?? false;
48 39 }
49 40
50 41 $settings = [
51 42 'can_send_events' => $can_send_events,
52 - 'debug' => $debug,
53 43 'elementor_version' => ELEMENTOR_VERSION,
54 44 'site_url' => hash( 'sha256', get_site_url() ),
55 45 'wp_version' => get_bloginfo( 'version' ),
56 46 'user_agent' => esc_html( Utils::get_super_global_value( $_SERVER, 'HTTP_USER_AGENT' ) ),
@@ -58,11 +48,11 @@
58 48 'site_key' => get_option( Base_App::OPTION_CONNECT_SITE_KEY ),
59 49 'subscription_id' => self::get_subscription_id(),
60 50 'subscription' => self::get_subscription(),
61 51 'token' => ELEMENTOR_EDITOR_EVENTS_MIXPANEL_TOKEN,
52 + 'session_replays' => $session_replays,
62 53 'flags_enabled' => $is_flags_enabled,
63 - 'user_id' => self::get_user_id(),
64 - 'session_recording_percent' => $session_recording_percent,
54 + 'isEditorOneActive' => Plugin::$instance->experiments->is_feature_active( 'e_editor_one' ),
65 55 ];
66 56
67 57 return $settings;
68 58 }
@@ -101,22 +91,19 @@
101 91 return json_decode( $license_data['value'], true );
102 92 }
103 93
104 94 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 - ] );
95 + $data = wp_remote_get( static::REMOTE_MIXPANEL_CONFIG_URL );
110 96
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 );
97 + if ( is_wp_error( $data ) ) {
98 + return [];
99 + }
115 100
116 - if ( ! is_array( $user_common_data ) ) {
117 - return null;
101 + $data = json_decode( wp_remote_retrieve_body( $data ), true );
102 +
103 + if ( empty( $data['mixpanel'] ) || ! is_array( $data['mixpanel'] ) ) {
104 + return [];
118 105 }
119 106
120 - return Common_App::get_connect_user_id_from_access_token( $user_common_data['access_token'] ?? null );
107 + return $data['mixpanel'];
121 108 }
122 109 }