}> */ public static function engines(): array { return array( 'chatgpt' => array( 'label' => 'ChatGPT', 'vendor' => 'OpenAI', 'tone' => 'green', 'why' => __( 'The assistant most buyers ask first. It crawls with GPTBot and OAI-SearchBot, and it is one of the few that reads llms.txt.', 'ai-rank-suite' ), 'bots' => array( 'gptbot', 'oai-searchbot', 'chatgpt-user' ), ), 'overviews' => array( 'label' => 'Google AI Overviews', 'vendor' => 'Google', 'tone' => 'blue', 'why' => __( 'Built on the classic index rather than a separate crawl, so eligibility is decided by ordinary technical SEO — structured data, canonicals and a sitemap Google can read.', 'ai-rank-suite' ), 'bots' => array( 'google-extended' ), ), 'perplexity' => array( 'label' => 'Perplexity', 'vendor' => 'Perplexity AI', 'tone' => 'violet', 'why' => __( 'Search-grounded and cites on every answer, which makes it the closest thing to a measurable AI ranking. It rewards freshness and pages that answer one question well.', 'ai-rank-suite' ), 'bots' => array( 'perplexitybot', 'perplexity-user' ), ), 'copilot' => array( 'label' => 'Microsoft Copilot', 'vendor' => 'Microsoft', 'tone' => 'blue', 'why' => __( 'Retrieves through the Bing index. If Bing has not crawled the page, no amount of structured data will get it cited.', 'ai-rank-suite' ), 'bots' => array( 'bingbot' ), ), 'claude' => array( 'label' => 'Claude', 'vendor' => 'Anthropic', 'tone' => 'yellow', 'why' => __( 'Quotes heavily and attributes carefully, so it rewards pages whose claims are attributable — named authors, dates, and an identity a reader can check.', 'ai-rank-suite' ), 'bots' => array( 'claudebot', 'claude-web', 'anthropic-ai' ), ), 'china' => array( 'label' => __( 'Chinese engines', 'ai-rank-suite' ), 'vendor' => 'DeepSeek, Qwen, Kimi, ERNIE', 'tone' => 'red', 'why' => __( 'They answer questions Google never sees. Most sites block them without ever deciding to — usually by copying a robots.txt from a blog post.', 'ai-rank-suite' ), 'bots' => array( 'bytespider', 'petalbot', 'baiduspider', 'deepseekbot', 'pangubot' ), ), ); } /** * Score every engine. * * @return array */ public function report(): array { $facts = $this->facts(); $out = array(); $total = 0; foreach ( self::engines() as $id => $engine ) { $checks = $this->checks_for( $id, $facts ); $earned = 0; $max = 0; $open = array(); foreach ( $checks as $check ) { $max += (int) $check['weight']; if ( ! empty( $check['pass'] ) ) { $earned += (int) $check['weight']; } else { $open[] = $check; } } $score = $max > 0 ? (int) round( ( $earned / $max ) * 100 ) : 0; $total += $score; $out[] = array( 'id' => $id, 'label' => (string) $engine['label'], 'vendor' => (string) $engine['vendor'], 'tone' => (string) $engine['tone'], 'why' => (string) $engine['why'], 'score' => $score, 'checks' => $checks, 'open' => $open, ); } return array( 'engines' => $out, // The average, not a weighted blend: a site strong on Google and // invisible to everything else should not read as 80%. 'overall' => count( $out ) > 0 ? (int) round( $total / count( $out ) ) : 0, 'facts' => $facts, ); } /** * Everything the checks read, gathered once. * * @return array */ private function facts(): array { global $wpdb; $llms = $this->options->get( 'llms_txt', array( 'enabled' => false ) ); $sitemap = $this->options->get( 'sitemap', array( 'enabled' => false ) ); $schema = $this->options->get( 'schema', array( 'enabled' => false ) ); $crawlers = $this->options->get( 'crawler_controls', array( 'blocked' => array() ) ); $identity = (array) ( $schema['identity'] ?? array() ); $blocked = array_map( 'strtolower', (array) ( $crawlers['blocked'] ?? array() ) ); // One query for the counts rather than one per check. // phpcs:disable WordPress.DB.DirectDatabaseQuery, WordPress.DB.PreparedSQL.NotPrepared // The site's page count comes from the one inventory every counter uses. $published = (int) \AiRankSuite\Support\Inventory::counts()['published']; $etypes = \AiRankSuite\Support\Inventory::eligible_types() ?: array( 'post' ); // One %s per post type, so the list is prepared like any other value // rather than escaped by hand and pasted into the string. $ein = implode( ',', array_fill( 0, count( $etypes ), '%s' ) ); $with_desc = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT p.ID) FROM %i p INNER JOIN %i m ON m.post_id = p.ID WHERE p.post_status = 'publish' AND p.post_type IN ({$ein}) AND m.meta_key = '_airanksuite_seo_desc' AND m.meta_value <> ''", $wpdb->posts, $wpdb->postmeta, ...$etypes ) ); $with_faq = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT p.ID) FROM %i p INNER JOIN %i m ON m.post_id = p.ID WHERE p.post_status = 'publish' AND p.post_type IN ({$ein}) AND m.meta_key = '_airanksuite_faq' AND m.meta_value <> ''", $wpdb->posts, $wpdb->postmeta, ...$etypes ) ); $fresh = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM %i WHERE post_status = 'publish' AND post_type IN ({$ein}) AND post_modified_gmt > %s", array_merge( array( $wpdb->posts ), $etypes, array( gmdate( 'Y-m-d H:i:s', time() - 180 * DAY_IN_SECONDS ) ) ) ) ); $mentions = (int) $wpdb->get_var( $wpdb->prepare( 'SELECT COUNT(*) FROM %i', Database::mentions() ) ); // phpcs:enable return array( 'llms' => ! empty( $llms['enabled'] ), 'llms_full' => ! empty( $llms['enabled'] ) && ! empty( $llms['full_enabled'] ), 'sitemap' => ! empty( $sitemap['enabled'] ), 'schema' => ! empty( $schema['enabled'] ), 'identity' => ! empty( $identity['description'] ) || ! empty( $schema['org_name'] ), 'same_as' => ! empty( array_filter( (array) ( $identity['same_as'] ?? array() ) ) ), 'knows_about' => ! empty( array_filter( (array) ( $identity['knows_about'] ?? array() ) ) ), 'blocked' => $blocked, 'https' => 0 === strpos( (string) home_url(), 'https://' ), 'public' => '0' !== (string) get_option( 'blog_public' ), 'bing_key' => '' !== (string) get_option( 'airanksuite_bing_key', '' ), 'gsc' => '' !== (string) get_option( 'airanksuite_gsc_token', '' ) || '' !== (string) get_option( 'airanksuite_google_account', '' ), 'indexnow' => '' !== (string) get_option( 'airanksuite_indexnow_key', '' ), 'published' => $published, 'with_desc' => $with_desc, 'with_faq' => $with_faq, 'fresh' => $fresh, 'mentions' => $mentions, ); } /** * Is any of these bots blocked? * * @param array $facts Facts. * @param list $bots Bot ids. */ private function allowed( array $facts, array $bots ): bool { foreach ( $bots as $bot ) { if ( in_array( strtolower( $bot ), (array) $facts['blocked'], true ) ) { return false; } } return true; } /** * The checks for one engine. * * @param array $facts Facts. * @return list */ private function checks_for( string $engine, array $facts ): array { $engines = self::engines(); $bots = (array) ( $engines[ $engine ]['bots'] ?? array() ); $coverage = static fn( int $n ): float => $facts['published'] > 0 ? $n / (int) $facts['published'] : 0.0; $shared = array( array( 'id' => 'indexable', 'label' => __( 'Search engines are not discouraged', 'ai-rank-suite' ), 'weight' => 10, 'pass' => (bool) $facts['public'], 'fix' => __( 'Settings → Reading: turn off "Discourage search engines".', 'ai-rank-suite' ), ), array( 'id' => 'bots', 'label' => __( 'This engine’s crawler is allowed', 'ai-rank-suite' ), 'weight' => 10, 'pass' => $this->allowed( $facts, $bots ), 'fix' => __( 'Unblock it under AI Crawlers — a blocked crawler is a guaranteed zero, whatever else you do.', 'ai-rank-suite' ), ), ); switch ( $engine ) { case 'chatgpt': return array_merge( $shared, array( array( 'id' => 'llms', 'label' => __( 'llms.txt is published', 'ai-rank-suite' ), 'weight' => 8, 'pass' => (bool) $facts['llms'], 'fix' => __( 'Switch on llms.txt — it tells the model which pages to read first.', 'ai-rank-suite' ), ), array( 'id' => 'llms_full', 'label' => __( 'llms-full.txt gives the whole text', 'ai-rank-suite' ), 'weight' => 4, 'pass' => (bool) $facts['llms_full'], 'fix' => __( 'The full variant hands over clean markdown, so nothing depends on how well your theme extracts.', 'ai-rank-suite' ), ), array( 'id' => 'desc', 'label' => __( 'Most pages have a description', 'ai-rank-suite' ), 'weight' => 6, 'pass' => $coverage( (int) $facts['with_desc'] ) >= 0.6, 'fix' => __( 'Generate them in bulk — the description is the sentence a model paraphrases.', 'ai-rank-suite' ), ), array( 'id' => 'identity', 'label' => __( 'The site says who it is', 'ai-rank-suite' ), 'weight' => 6, 'pass' => (bool) $facts['identity'], 'fix' => __( 'Fill in Schema → Identity. An unnamed source is not quoted by name.', 'ai-rank-suite' ), ), ) ); case 'overviews': return array_merge( $shared, array( array( 'id' => 'schema', 'label' => __( 'Structured data is on', 'ai-rank-suite' ), 'weight' => 10, 'pass' => (bool) $facts['schema'], 'fix' => __( 'AI Overviews are built on the classic index, where schema decides what kind of thing each page is.', 'ai-rank-suite' ), ), array( 'id' => 'sitemap', 'label' => __( 'XML sitemap is published', 'ai-rank-suite' ), 'weight' => 8, 'pass' => (bool) $facts['sitemap'], 'fix' => __( 'Switch the sitemap on so Google finds every page it could summarise.', 'ai-rank-suite' ), ), array( 'id' => 'gsc', 'label' => __( 'Search Console is connected', 'ai-rank-suite' ), 'weight' => 5, 'pass' => (bool) $facts['gsc'], 'fix' => __( 'Without it you cannot see which queries already trigger an overview for you.', 'ai-rank-suite' ), ), array( 'id' => 'https', 'label' => __( 'Served over HTTPS', 'ai-rank-suite' ), 'weight' => 5, 'pass' => (bool) $facts['https'], 'fix' => __( 'Install a certificate.', 'ai-rank-suite' ), ), array( 'id' => 'faq', 'label' => __( 'Some pages carry FAQ markup', 'ai-rank-suite' ), 'weight' => 4, 'pass' => (int) $facts['with_faq'] > 0, 'fix' => __( 'Question-and-answer pairs are the format overviews lift most readily.', 'ai-rank-suite' ), ), ) ); case 'perplexity': return array_merge( $shared, array( array( 'id' => 'fresh', 'label' => __( 'Content updated in the last six months', 'ai-rank-suite' ), 'weight' => 9, 'pass' => $coverage( (int) $facts['fresh'] ) >= 0.3, 'fix' => __( 'Perplexity weights recency heavily. Refresh your most important pages and republish.', 'ai-rank-suite' ), ), array( 'id' => 'faq', 'label' => __( 'Pages answer explicit questions', 'ai-rank-suite' ), 'weight' => 7, 'pass' => (int) $facts['with_faq'] > 0, 'fix' => __( 'A cited answer is usually one paragraph replying to one question. Add FAQs.', 'ai-rank-suite' ), ), array( 'id' => 'same_as', 'label' => __( 'Identity is cross-referenced (sameAs)', 'ai-rank-suite' ), 'weight' => 6, 'pass' => (bool) $facts['same_as'], 'fix' => __( 'Link your profiles so a citation resolves to a known entity rather than a domain.', 'ai-rank-suite' ), ), array( 'id' => 'tracking', 'label' => __( 'You are testing potential AI citations', 'ai-rank-suite' ), 'weight' => 5, 'pass' => (int) $facts['mentions'] > 0, 'fix' => __( 'Add prompts under AI Answer Simulation to simulate answers and estimate whether your configured model would cite the site.', 'ai-rank-suite' ), ), ) ); case 'copilot': return array_merge( $shared, array( array( 'id' => 'bing', 'label' => __( 'Bing Webmaster Tools is connected', 'ai-rank-suite' ), 'weight' => 10, 'pass' => (bool) $facts['bing_key'], 'fix' => __( 'Copilot retrieves through Bing. Connect it under Indexing → Bing to see and fix coverage.', 'ai-rank-suite' ), ), array( 'id' => 'indexnow', 'label' => __( 'IndexNow is configured', 'ai-rank-suite' ), 'weight' => 7, 'pass' => (bool) $facts['indexnow'], 'fix' => __( 'IndexNow pushes changes to Bing immediately instead of waiting for a crawl.', 'ai-rank-suite' ), ), array( 'id' => 'sitemap', 'label' => __( 'XML sitemap is published', 'ai-rank-suite' ), 'weight' => 6, 'pass' => (bool) $facts['sitemap'], 'fix' => __( 'Bing leans on sitemaps more than Google does.', 'ai-rank-suite' ), ), array( 'id' => 'schema', 'label' => __( 'Structured data is on', 'ai-rank-suite' ), 'weight' => 5, 'pass' => (bool) $facts['schema'], 'fix' => __( 'Switch the Schema module on.', 'ai-rank-suite' ), ), ) ); case 'claude': return array_merge( $shared, array( array( 'id' => 'identity', 'label' => __( 'The site says who it is', 'ai-rank-suite' ), 'weight' => 9, 'pass' => (bool) $facts['identity'], 'fix' => __( 'Claude attributes carefully. An unnamed publisher is quoted as "a website".', 'ai-rank-suite' ), ), array( 'id' => 'knows_about', 'label' => __( 'Expertise is declared (knowsAbout)', 'ai-rank-suite' ), 'weight' => 7, 'pass' => (bool) $facts['knows_about'], 'fix' => __( 'Name the subjects you actually know. It is the most direct expertise signal there is.', 'ai-rank-suite' ), ), array( 'id' => 'llms', 'label' => __( 'llms.txt is published', 'ai-rank-suite' ), 'weight' => 6, 'pass' => (bool) $facts['llms'], 'fix' => __( 'Point it at the pages you would want quoted.', 'ai-rank-suite' ), ), array( 'id' => 'desc', 'label' => __( 'Most pages have a description', 'ai-rank-suite' ), 'weight' => 5, 'pass' => $coverage( (int) $facts['with_desc'] ) >= 0.6, 'fix' => __( 'Generate them in bulk.', 'ai-rank-suite' ), ), ) ); case 'china': default: return array_merge( $shared, array( array( 'id' => 'schema', 'label' => __( 'Structured data is on', 'ai-rank-suite' ), 'weight' => 6, 'pass' => (bool) $facts['schema'], 'fix' => __( 'These engines lean on structured data because their text extraction is weaker on Western layouts.', 'ai-rank-suite' ), ), array( 'id' => 'sitemap', 'label' => __( 'XML sitemap is published', 'ai-rank-suite' ), 'weight' => 6, 'pass' => (bool) $facts['sitemap'], 'fix' => __( 'Baidu in particular discovers almost entirely through sitemaps.', 'ai-rank-suite' ), ), array( 'id' => 'https', 'label' => __( 'Served over HTTPS', 'ai-rank-suite' ), 'weight' => 4, 'pass' => (bool) $facts['https'], 'fix' => __( 'Install a certificate.', 'ai-rank-suite' ), ), ) ); } } }