PluginProbe
Elementor Website Builder – more than just a page builder / 4.1.3
Elementor Website Builder – more than just a page builder v4.1.3
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 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 All 457 releases
← All changes | core/common/modules/events-manager/module.php +24 -4 4.0.9 → 4.1.3 View file →
@@ -3,8 +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;
7 8 use Elementor\Core\Experiments\Manager as Experiments_Manager;
8 9 use Elementor\Includes\EditorAssetsAPI;
9 10 use Elementor\Utils;
10 11 use Elementor\Plugin;
@@ -16,9 +17,9 @@
16 17
17 18 class Module extends BaseModule {
18 19
19 20 const EXPERIMENT_NAME = 'editor_events';
20 -
21 + const DEFAULT_SESSION_RECORDING_PERCENT = 0;
21 22 const REMOTE_MIXPANEL_CONFIG_URL = 'https://assets.elementor.com/mixpanel/v1/mixpanel.json';
22 23
23 24 public function get_name() {
24 25 return 'events-manager';
@@ -30,18 +31,26 @@
30 31 ! Tracker::has_terms_changed( '2025-07-07' ) &&
31 32 Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_NAME );
32 33
33 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;
34 37
35 38 if ( $can_send_events ) {
36 39 $mixpanel_config = self::get_remote_mixpanel_config();
37 - $is_flags_enabled = EditorAssetsAPI::has_valid_nested_array( $mixpanel_config, [ 0 ] )
38 - ? (bool) ( $mixpanel_config[0]['flags'] ?? false )
39 - : false;
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 + }
40 48 }
41 49
42 50 $settings = [
43 51 'can_send_events' => $can_send_events,
52 + 'debug' => $debug,
44 53 'elementor_version' => ELEMENTOR_VERSION,
45 54 'site_url' => hash( 'sha256', get_site_url() ),
46 55 'wp_version' => get_bloginfo( 'version' ),
47 56 'user_agent' => esc_html( Utils::get_super_global_value( $_SERVER, 'HTTP_USER_AGENT' ) ),
@@ -50,8 +59,10 @@
50 59 'subscription_id' => self::get_subscription_id(),
51 60 'subscription' => self::get_subscription(),
52 61 'token' => ELEMENTOR_EDITOR_EVENTS_MIXPANEL_TOKEN,
53 62 'flags_enabled' => $is_flags_enabled,
63 + 'user_id' => self::get_user_id(),
64 + 'session_recording_percent' => $session_recording_percent,
54 65 ];
55 66
56 67 return $settings;
57 68 }
@@ -97,6 +108,15 @@
97 108 EditorAssetsAPI::ASSETS_DATA_KEY => 'mixpanel',
98 109 ] );
99 110
100 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 );
115 +
116 + if ( ! is_array( $user_common_data ) ) {
117 + return null;
118 + }
119 +
120 + return Common_App::get_connect_user_id_from_access_token( $user_common_data['access_token'] ?? null );
101 121 }
102 122 }