Back to integrations
WordPress

WordPress

Connect your WordPress site to track content performance and optimize for AI visibility. Easy installation with custom HTML insertion on cloud platforms.

Overview

Our WordPress integration allows you to easily track AI interactions with your WordPress site. By inserting a simple HTML snippet into your WordPress theme or using our plugin, you can start monitoring how AI systems interact with your content immediately. This solution works with any WordPress site, including those hosted on cloud platforms, and provides comprehensive tracking across all pages.

Features

  • Custom HTML insertion option for cloud platforms
  • Works with all WordPress themes and page builders
  • Real-time AI visibility analytics
  • Zero impact on site performance
  • Automatic tracking of all pages and posts
  • Identifies all major AI bots and crawlers
  • Detailed analytics for WordPress content
  • Compatible with caching plugins

Requirements

  • WordPress website
  • Admin access to your WordPress site
  • API key from xseek
  • Website ID from your xseek dashboard

Setup Process

  1. 1

    Sign in to your WordPress admin dashboard

  2. 2

    Navigate to Appearance > Theme Editor or use a custom HTML plugin

  3. 3

    Insert our tracking code into the <head> section of your theme

  4. 4

    Replace the placeholder values with your API key and website ID

  5. 5

    Save your changes to start tracking AI visits

Integration Setup

Important Information

Make sure to replace YOUR_API_KEY and YOUR_WEBSITE_ID with your actual values in the integration code. Your API key can be found in your account settings.

1Add tracking script to your WordPress site

For WordPress sites on cloud platforms, add this script to your theme's header.php file or use a custom HTML plugin:

<!-- Add this script to your WordPress site's <head> section -->
<script>
  // Function to detect AI bots
  function checkForAIBot() {
    const userAgent = navigator.userAgent;
    
    // Define patterns for all known AI bots
    const AI_BOTS = [
    { name: 'anthropic-ai', pattern: /anthropic-ai/i },
    { name: 'claudebot', pattern: /ClaudeBot/i },
    { name: 'claude-web', pattern: /claude-web/i },

    { name: 'perplexitybot', pattern: /PerplexityBot/i },
    { name: 'perplexity-user', pattern: /Perplexity-User/i },

    { name: 'grokbot', pattern: /GrokBot(?!.*DeepSearch)/i },
    { name: 'grok-search', pattern: /xAI-Grok/i },
    { name: 'grok-deepsearch', pattern: /Grok-DeepSearch/i },

    { name: 'deepseekbot', pattern: /DeepSeekBot/i },

    { name: 'GPTBot', pattern: /GPTBot/i },
    { name: 'chatgpt-user', pattern: /ChatGPT-User/i },
    { name: 'oai-searchbot', pattern: /OAI-SearchBot/i },

    { name: 'google-extended', pattern: /Google-Extended/i },

    { name: 'applebot', pattern: /Applebot(?!-Extended)/i },
    { name: 'applebot-extended', pattern: /Applebot-Extended/i },

    { name: 'meta-external', pattern: /meta-externalagent/i },
    { name: 'meta-externalfetcher', pattern: /meta-externalfetcher/i },

    { name: 'bingbot', pattern: /Bingbot(?!.*AI)/i },
    { name: 'bingpreview', pattern: /bingbot.*Chrome/i },
    { name: 'microsoftpreview', pattern: /MicrosoftPreview/i },

    { name: 'cohere-ai', pattern: /cohere-ai/i },
    { name: 'cohere-training-data-crawler', pattern: /cohere-training-data-crawler/i },

    { name: 'youbot', pattern: /YouBot/i },

    { name: 'duckassistbot', pattern: /DuckAssistBot/i },

    { name: 'semanticscholarbot', pattern: /SemanticScholarBot/i },

    { name: 'ccbot', pattern: /CCBot/i },

    { name: 'ai2bot', pattern: /AI2Bot/i },
    { name: 'ai2bot-dolma', pattern: /AI2Bot-Dolma/i },

    { name: 'aihitbot', pattern: /aiHitBot/i },

    { name: 'amazonbot', pattern: /Amazonbot/i },
    { name: 'novaact', pattern: /NovaAct/i },

    { name: 'brightbot', pattern: /Brightbot/i },

    { name: 'bytespider', pattern: /Bytespider/i },
    { name: 'tiktokspider', pattern: /TikTokSpider/i },

    { name: 'cotoyogi', pattern: /Cotoyogi/i },

    { name: 'crawlspace', pattern: /Crawlspace/i },

    { name: 'pangubot', pattern: /PanguBot/i },
    { name: 'petalbot', pattern: /PetalBot/i },

    { name: 'semrushbot-ocob', pattern: /SemrushBot-OCOB/i },
    { name: 'semrushbot-swa', pattern: /SemrushBot-SWA/i },

    { name: 'sidetrade-indexer', pattern: /Sidetrade indexer bot/i },

    { name: 'timpibot', pattern: /Timpibot/i },

    { name: 'velenpublicwebcrawler', pattern: /VelenPublicWebCrawler/i },

    { name: 'omgili', pattern: /omgili/i },
    { name: 'omgilibot', pattern: /omgilibot/i },
    { name: 'webzio-extended', pattern: /Webzio-Extended/i }
    ];
    
    // Check if the user agent matches any bot pattern
    for (const bot of AI_BOTS) {
      if (bot.pattern.test(userAgent)) {
        // Send data to the tracking API
        fetch('https://api.aiseotracker.com/track-ai-bot', {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
            'x-api-key': 'YOUR_API_KEY', // Replace with your actual API key
          },
          body: JSON.stringify({
            botName: bot.name,
            userAgent: userAgent,
            url: window.location.href,
            referer: document.referrer || undefined,
            websiteId: 'YOUR_WEBSITE_ID', // Replace with your website ID
          }),
        }).catch(error => {
          console.error('Error tracking AI bot:', error);
        });
        
        console.log('AI bot detected:', bot.name);
        break;
      }
    }
  }
  
  // Run the check when the page loads
  window.addEventListener('load', checkForAIBot);
</script>

2Alternative: Use a WordPress plugin

If you prefer not to edit theme files, you can use plugins like "Header and Footer Scripts" or "Insert Headers and Footers" to add the tracking code to your site's <head> section.

  1. Install and activate one of these plugins from your WordPress dashboard
  2. Navigate to the plugin's settings page
  3. Paste the tracking code into the header section
  4. Save your changes

Ready to go!

Your WordPress site is now set up to track AI crawler visits. Visit the xseek dashboard to see your data.

Need more help?

Check our comprehensive documentation for detailed instructions.

View documentation