cwp_ai_widget_config() ) ); return array( 'script' => strlen( $raw ), 'scriptZip' => function_exists( 'gzencode' ) ? strlen( gzencode( $raw, 6 ) ) : 0, 'config' => strlen( $cfg ), 'configZip' => function_exists( 'gzencode' ) ? strlen( gzencode( $cfg, 6 ) ) : 0, ); } add_action( 'wp_ajax_cwp_ai_perf', function () { check_ajax_referer( 'cwp_ai_admin', 'nonce' ); if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( array( 'message' => 'Unauthorized' ) ); } global $wpdb; $days = isset( $_POST['days'] ) ? max( 1, min( 180, absint( $_POST['days'] ) ) ) : 30; $since = gmdate( 'Y-m-d H:i:s', time() - $days * DAY_IN_SECONDS ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- the plugin's own analytics table. $rows = $wpdb->get_results( $wpdb->prepare( "SELECT fields, device FROM %i WHERE event = 'perf' AND is_admin = 0 AND created >= %s ORDER BY id DESC LIMIT 3000", cwp_ai_events_table(), $since ), ARRAY_A ); $samples = array(); foreach ( $rows as $row ) { $one = array( 'device' => $row['device'] ); foreach ( explode( ',', (string) $row['fields'] ) as $part ) { $bits = preg_split( '/\s+/', trim( $part ) ); if ( count( $bits ) === 2 && is_numeric( $bits[1] ) ) { $one[ sanitize_key( $bits[0] ) ] = (int) $bits[1]; } } if ( isset( $one['load'] ) ) { $samples[] = $one; } } wp_send_json_success( array( 'samples' => $samples, 'sizes' => cwp_ai_perf_sizes(), ) ); } ); /** * Prints the Performance screen. */ function cwp_ai_render_performance_tab() { $home = home_url( '/' ); ?>
The chatbot is built to stay out of the way: it starts only after your page has finished loading.
Loads your home page several times with the chatbot on, then with it switched off for that test only, and compares. Your visitors are not affected. Takes about a minute.
Nothing loads before your page shows. Most of it waits until a visitor needs it.
Measured in your visitors' browsers - once per visit - over the last 30 days.