false ); $fmt = function ( $s ) { $s = (int) $s; if ( $s <= 0 ) { return '—'; } if ( $s < 60 ) { return $s . 's'; } $m = (int) floor( $s / 60 ); $r = $s % 60; return $m . 'm' . ( $r ? ' ' . $r . 's' : '' ); }; ?> 0 ? AIEO_DMM_UI::title_badge( sprintf( _n( '%s checkout', '%s checkouts', $aieo_ct_n, 'ai-eshop-optimizer' ), number_format_i18n( $aieo_ct_n ) ) ) : ''; ?> 'checkout-timing-overall-d-checkouts-2', 'icon' => 'hash', 'title' => $aieo_ct_overall_title, 'description' => __( 'How long shoppers actively engage vs sit idle during checkout, and a recommended exit-intent warm-up delay per product. The baseline EXCLUDES coupon-completed orders — a returning/fast cohort that would deflate genuine deliberation time.', 'ai-eshop-optimizer' ), ) ); echo $aieo_ct_open; echo \Rooster\Admin\States::from( array( 'ready' => ! empty( $data['available'] ), 'total' => isset( $data['rows'] ) ? (int) $data['rows'] : 0 ), array( 'title' => __( 'No checkout-timing data captured yet. Rows appear here after successful checkouts (the session tracker records active vs idle time on the checkout pages).', 'ai-eshop-optimizer' ) ) ); echo $aieo_ct_close; ?> $base, 'all' => $all ) as $aieo_ct_k => $aieo_ct_s ) { $aieo_ct_cmp[] = array( 'k' => $aieo_ct_k, 'which' => 'base' === $aieo_ct_k ? __( 'Baseline (no coupon)', 'ai-eshop-optimizer' ) : __( 'All orders', 'ai-eshop-optimizer' ), 'n' => '(' . number_format_i18n( (int) $aieo_ct_s['n'] ) . ')', 'active' => $fmt( $aieo_ct_s['median_active'] ), 'active_s' => (int) $aieo_ct_s['median_active'], 'idle' => $fmt( $aieo_ct_s['median_idle'] ), 'idle_s' => (int) $aieo_ct_s['median_idle'], 'total' => $fmt( $aieo_ct_s['median_total'] ), 'total_s' => (int) $aieo_ct_s['median_total'], 'rec' => $fmt( $aieo_ct_s['recommended'] ), 'rec_s' => (int) $aieo_ct_s['recommended'], ); } AIEO_Table::card( array( 'anchor' => 'checkout-timing-overall-d-checkouts-2', 'icon' => 'hash', 'heading' => 'h2', 'title' => $aieo_ct_overall_title, 'meta' => $aieo_ct_overall_meta, 'description' => __( 'How long shoppers actively engage vs sit idle during checkout, and a recommended exit-intent warm-up delay per product. The baseline EXCLUDES coupon-completed orders — a returning/fast cohort that would deflate genuine deliberation time.', 'ai-eshop-optimizer' ), 'page_id' => 'checkout_timing', 'row_key' => 'k', 'rows' => $aieo_ct_cmp, 'sortable' => false, 'columns' => array( array( 'key' => 'which', 'label' => '', 'sr_label' => __( 'Orders', 'ai-eshop-optimizer' ), 'suffix' => 'n' ), array( 'key' => 'active', 'label' => __( 'Median active', 'ai-eshop-optimizer' ), 'sort_key' => 'active_s', 'align' => 'right' ), array( 'key' => 'idle', 'label' => __( 'Median idle', 'ai-eshop-optimizer' ), 'sort_key' => 'idle_s', 'align' => 'right' ), array( 'key' => 'total', 'label' => __( 'Median total', 'ai-eshop-optimizer' ), 'sort_key' => 'total_s', 'align' => 'right' ), array( 'key' => 'rec', 'label' => __( 'Recommended delay', 'ai-eshop-optimizer' ), 'sort_key' => 'rec_s', 'align' => 'right', 'tone' => 'success' ), ), 'footnote' => __( 'Recommended delay = the baseline median active time — fire the offer around when genuine deliberation typically ends and idle begins.', 'ai-eshop-optimizer' ), ) ); ?> 'checkout-timing-per-product-coupon-excluded', 'icon' => 'package', 'title' => __( 'Time per product (no coupon)', 'ai-eshop-optimizer' ), ) ); echo $aieo_ct_open; echo empty( $data['products']['available'] ) ? \Rooster\Admin\States::state( 'not-set-up', array( 'title' => __( 'The per-product breakdown needs the Order-Products analytics table (Tools → Product/Orders analytics). The overall figures above work without it.', 'ai-eshop-optimizer' ) ) ) : \Rooster\Admin\States::state( 'first-use', array( 'title' => __( 'No per-product rows yet.', 'ai-eshop-optimizer' ) ) ); echo $aieo_ct_close; ?> $aieo_ct_pid, 'name' => get_the_title( $aieo_ct_pid ) ?: ( '#' . $aieo_ct_pid ), 'edit' => admin_url( 'post.php?post=' . $aieo_ct_pid . '&action=edit' ), 'orders' => (int) $r['orders'], 'active' => $fmt( $r['avg_active'] ), 'active_s' => (int) $r['avg_active'], 'idle' => $fmt( $r['avg_idle'] ), 'idle_s' => (int) $r['avg_idle'], 'rec' => $fmt( $r['avg_active'] ), 'rec_s' => (int) $r['avg_active'], ); } AIEO_Table::card( array( 'anchor' => 'checkout-timing-per-product-coupon-excluded', 'icon' => 'package', 'heading' => 'h2', 'title' => __( 'Time per product (no coupon)', 'ai-eshop-optimizer' ), 'page_id' => 'checkout_timing', 'row_key' => 'pid', 'rows' => $aieo_ct_prod, 'columns' => array( array( 'key' => 'name', 'label' => __( 'Product', 'ai-eshop-optimizer' ), 'type' => 'link', 'format' => array( 'href' => 'edit', 'external' => true ) ), array( 'key' => 'orders', 'label' => __( 'Checkouts', 'ai-eshop-optimizer' ), 'type' => 'integer' ), array( 'key' => 'active', 'label' => __( 'Avg active', 'ai-eshop-optimizer' ), 'sort_key' => 'active_s', 'align' => 'right' ), array( 'key' => 'idle', 'label' => __( 'Avg idle', 'ai-eshop-optimizer' ), 'sort_key' => 'idle_s', 'align' => 'right' ), array( 'key' => 'rec', 'label' => __( 'Recommended delay', 'ai-eshop-optimizer' ), 'sort_key' => 'rec_s', 'align' => 'right', 'tone' => 'success' ), ), ) ); ?>