Skip to main content
POST
https://searchcompany-main.up.railway.app
/
api
/
ai-recommendation-store
curl -X POST https://searchcompany-main.up.railway.app/api/ai-recommendation-store \
  -H "Content-Type: application/json" \
  -d '{
    "business_id": "nike",
    "page_url": "https://nike.searchcompany.co/",
    "page_type": "ai_site",
    "page_title": "Nike - AI Profile",
    "user_agent": "Mozilla/5.0 (compatible; GPTBot/1.0; +https://openai.com/gptbot)"
  }'
{
  "status": "success",
  "platform_id": "chatgpt",
  "platform_name": "ChatGPT",
  "message": "Visit from ChatGPT recorded"
}
Public webhook endpoint for storing AI bot visit data from tracking scripts embedded in AI-optimized sites. No authentication required - this is a public webhook similar to the Stripe webhook.

How It Works

  1. AI-optimized sites include a tracking script that runs on page load
  2. The script detects AI bots via user-agent patterns
  3. When an AI bot is detected, the script sends visit data to this endpoint
  4. We record the visit and which AI platform made the request

Supported AI Platforms

PlatformDetection Patterns
ChatGPTgptbot, chatgpt-user, oai-searchbot
Claudeclaudebot, claude-web, anthropic
Geminigoogle-extended, gemini
Perplexityperplexitybot
Copilotbingbot, bingpreview, copilot
DeepSeekdeepseekbot
Grokxai-bot, grok
Google AIgooglebot, googleother

Request Body

business_id
string
required
Business/organization identifier
item_id
string
Optional product/item ID
page_url
string
required
Full URL of the page visited
page_type
string
default:"ai_site"
Type of page: website, blog_post, or ai_site
page_title
string
Title of the page
user_agent
string
required
User-Agent header from the request
ip_address
string
IP address of the visitor
referrer
string
Referrer URL if available

Response

status
string
"success", "ignored", or "error"
platform_id
string
ID of the detected AI platform (e.g., chatgpt, claude)
platform_name
string
Display name of the AI platform (e.g., ChatGPT, Claude)
message
string
Human-readable status message
curl -X POST https://searchcompany-main.up.railway.app/api/ai-recommendation-store \
  -H "Content-Type: application/json" \
  -d '{
    "business_id": "nike",
    "page_url": "https://nike.searchcompany.co/",
    "page_type": "ai_site",
    "page_title": "Nike - AI Profile",
    "user_agent": "Mozilla/5.0 (compatible; GPTBot/1.0; +https://openai.com/gptbot)"
  }'
{
  "status": "success",
  "platform_id": "chatgpt",
  "platform_name": "ChatGPT",
  "message": "Visit from ChatGPT recorded"
}

Tracking Script

The tracking script is automatically included in AI-optimized sites generated by The Search Company:
(function () {
  var ua = navigator.userAgent.toLowerCase();
  var aiPatterns = [
    "gptbot",
    "chatgpt",
    "openai",
    "claudebot",
    "anthropic",
    "gemini",
    "google-extended",
    "perplexitybot",
    "bingbot",
    "copilot",
    "deepseek",
    "grok",
    "xai",
    "googlebot",
  ];
  var isAI = aiPatterns.some(function (p) {
    return ua.indexOf(p) !== -1;
  });
  if (isAI || ua.indexOf("bot") !== -1) {
    fetch(
      "https://searchcompany-main.up.railway.app/api/ai-recommendation-store",
      {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({
          business_id: "YOUR_BUSINESS_ID",
          page_url: window.location.href,
          page_type: "ai_site",
          page_title: document.title,
          user_agent: navigator.userAgent,
          referrer: document.referrer || null,
        }),
      }
    ).catch(function () {});
  }
})();