'; $body .= ''; $body .= '
' . esc_html( $title . ' | ' . $period ) . '
'; $body .= '
'; $body .= ''; // Flat navy masthead, true brand lockup, and teal accent. Never white // on bright teal (the approved brand contrast requirement). $body .= ''; $body .= ''; $body .= ''; $body .= '
'; $body .= 'AI-O'; $body .= '

AI-O OPTIMISER / REPORTING

'; $body .= '

' . esc_html( $title ) . '

'; $body .= '

' . esc_html( $site ) . '

'; $body .= '
 
'; if ( $test ) { $body .= '

TEST MESSAGE — sent by an administrator to verify delivery.

'; } $body .= '

Reporting period
' . esc_html( $period ) . '

'; $body .= '

AI bot / fetch requests

'; $body .= ''; $stats = array( array( 'Total bot / fetch requests', (int) ( $traffic['crawler_hits'] ?? 0 ) ), array( 'Delivered responses (2xx or legacy unknown)', (int) ( $traffic['crawler_successful'] ?? 0 ) ), array( 'Verified bot requests', (int) ( $traffic['crawler_verified'] ?? 0 ) ), array( 'AI-referred visits', (int) ( $traffic['referral_hits'] ?? 0 ) ), array( 'Guidance-file requests', (int) ( $traffic['guidance_hits'] ?? 0 ) ), ); foreach ( $stats as $stat ) { $body .= ''; $body .= ''; } $body .= '
' . esc_html( $stat[0] ) . '' . esc_html( number_format_i18n( $stat[1] ) ) . '
'; $body .= '

Delivered includes 2xx and legacy records with unknown status. Verified requires positive identity checks; unverified does not necessarily mean fake. Counts are requests, not unique users.

'; $detail = AI_O_Optimiser_Email_Report::traffic_details( $traffic ); $groups = array( 'bots' => array( 'title' => 'Top AI bots and fetchers', 'unit' => 'Requests' ), 'pages' => array( 'title' => 'Most-fetched pages by AI bots', 'unit' => 'Requests' ), 'referrers' => array( 'title' => 'AI referral sources', 'unit' => 'Visits' ), 'guidance' => array( 'title' => 'Guidance-file requests', 'unit' => 'Requests' ), ); foreach ( $groups as $key => $group ) { $body .= '

' . esc_html( $group['title'] ) . '

'; $body .= ''; if ( ! $detail[ $key ] ) { $body .= ''; } foreach ( $detail[ $key ] as $row ) { $subtitle = '' !== $row['last_seen'] ? 'Last seen ' . esc_html( $row['last_seen'] ) . ' UTC' : ''; $body .= ''; $body .= ''; } $body .= '
No matching activity recorded in this period.
' . esc_html( $row['label'] ) . $subtitle . '' . esc_html( number_format_i18n( $row['count'] ) ) . '
'; } $body .= '

View full Activity Report →

'; $body .= '

Sign in to WordPress to view the full report. A PDF summary is attached only when you enable that option.

'; $body .= '
'; $body .= 'Counts describe observed AI bot/fetch requests and referrals, not confirmed citations, rankings or unique users.
'; $body .= 'Manage recipients or stop report emails'; $body .= '
'; return $body; } }