{
 "version": "1",
 "collection": "snippets",
 "about": "Copy-ready code from the guides. Examples: replace the sample values before using them.",
 "updated": "2026-10-26",
 "count": 25,
 "items": [
  {
   "id": "robots-allow-assistants-block-training",
   "url": "https://ghostagentlab.com/learn/snippets/#robots-allow-assistants-block-training",
   "group": "robots.txt and llms.txt",
   "title": "Allow assistants, block AI training",
   "use": "Use when you want AI search and assistants to reach your store but not train on it; change the paths and sitemap URL.",
   "language": "robots.txt",
   "code": "# Allow AI search and assistants; opt out of AI training\nUser-agent: GPTBot\nUser-agent: ClaudeBot\nUser-agent: CCBot\nUser-agent: Google-Extended\nUser-agent: Applebot-Extended\nUser-agent: meta-externalagent\nDisallow: /\n\nUser-agent: *\nDisallow: /cart\nDisallow: /account\nAllow: /\n\nSitemap: https://www.example.com/sitemap.xml",
   "guide": "https://ghostagentlab.com/articles/robots-txt-ai-agents/"
  },
  {
   "id": "robots-allow-all-with-sitemap",
   "url": "https://ghostagentlab.com/learn/snippets/#robots-allow-all-with-sitemap",
   "group": "robots.txt and llms.txt",
   "title": "Simple robots.txt that allows everyone",
   "use": "Use as a starting point for a store with nothing to hide from crawlers; swap in your own sitemap URL.",
   "language": "robots.txt",
   "code": "User-agent: *\nAllow: /\n\nSitemap: https://www.example.com/sitemap.xml",
   "guide": "https://ghostagentlab.com/articles/robots-txt-ai-agents/"
  },
  {
   "id": "llms-txt-store",
   "url": "https://ghostagentlab.com/learn/snippets/#llms-txt-store",
   "group": "robots.txt and llms.txt",
   "title": "llms.txt for an online store",
   "use": "Use to give AI assistants a short guide to your key pages; replace the summary, links and descriptions with your own.",
   "language": "Markdown",
   "code": "# Northwind Coffee\n\n> Northwind Coffee roasts and sells specialty coffee beans, ground coffee and\n> brewing equipment online, shipping to the US and Canada.\n\nOrders over $40 ship free in the US. We don't sell gift cards or wholesale online;\nwholesale enquiries go through the contact page.\n\n## Shop\n\n- [All coffee](https://northwind.example/collections/coffee): Every bean we sell, with roast level, origin and price\n- [Subscriptions](https://northwind.example/subscriptions): Recurring deliveries every 2, 4 or 6 weeks; pause or cancel any time\n- [Brewing equipment](https://northwind.example/collections/equipment): Grinders, kettles and pour-over kits\n\n## Help and policies\n\n- [Shipping](https://northwind.example/pages/shipping): Rates, delivery times and countries we ship to\n- [Returns](https://northwind.example/pages/returns): 30-day returns on unopened items and equipment\n- [FAQ](https://northwind.example/pages/faq): Grind sizes, freshness, subscriptions and account questions\n- [Contact](https://northwind.example/pages/contact): Email and live chat hours\n\n## Optional\n\n- [Our story](https://northwind.example/pages/about): Who we are and how we source our beans\n- [Brewing guides](https://northwind.example/blog/guides): Step-by-step guides for each brewing method",
   "guide": "https://ghostagentlab.com/articles/llms-txt/"
  },
  {
   "id": "xml-sitemap-basic",
   "url": "https://ghostagentlab.com/learn/snippets/#xml-sitemap-basic",
   "group": "robots.txt and llms.txt",
   "title": "Basic XML sitemap",
   "use": "Use if your platform does not generate a sitemap; list your own page URLs and real last changed dates.",
   "language": "XML",
   "code": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n  <url>\n    <loc>https://northwind.example/</loc>\n    <lastmod>2026-10-01</lastmod>\n  </url>\n  <url>\n    <loc>https://northwind.example/products/ethiopia-yirgacheffe</loc>\n    <lastmod>2026-10-07</lastmod>\n  </url>\n  <url>\n    <loc>https://northwind.example/pages/shipping</loc>\n    <lastmod>2026-08-14</lastmod>\n  </url>\n</urlset>",
   "guide": "https://ghostagentlab.com/articles/xml-sitemaps-ai-agents/"
  },
  {
   "id": "jsonld-product-offer",
   "url": "https://ghostagentlab.com/learn/snippets/#jsonld-product-offer",
   "group": "Structured data",
   "title": "Product structured data with price and stock",
   "use": "Use on every product page; replace the name, SKU, GTIN, price, stock and return policy with each product's real values.",
   "language": "HTML",
   "code": "<script type=\"application/ld+json\">\n{\n  \"@context\": \"https://schema.org\",\n  \"@type\": \"Product\",\n  \"name\": \"Ethiopia Yirgacheffe Whole Bean Coffee, 340 g\",\n  \"description\": \"Light roast single-origin coffee with notes of jasmine and lemon.\",\n  \"sku\": \"NW-ETH-340\",\n  \"gtin13\": \"0123456789012\",\n  \"brand\": { \"@type\": \"Brand\", \"name\": \"Northwind Coffee\" },\n  \"image\": \"https://northwind.example/images/ethiopia-340.jpg\",\n  \"url\": \"https://northwind.example/products/ethiopia-yirgacheffe\",\n  \"aggregateRating\": {\n    \"@type\": \"AggregateRating\",\n    \"ratingValue\": \"4.7\",\n    \"reviewCount\": \"212\"\n  },\n  \"offers\": {\n    \"@type\": \"Offer\",\n    \"price\": \"18.00\",\n    \"priceCurrency\": \"USD\",\n    \"availability\": \"https://schema.org/InStock\",\n    \"itemCondition\": \"https://schema.org/NewCondition\",\n    \"url\": \"https://northwind.example/products/ethiopia-yirgacheffe\",\n    \"hasMerchantReturnPolicy\": {\n      \"@type\": \"MerchantReturnPolicy\",\n      \"applicableCountry\": \"US\",\n      \"returnPolicyCategory\": \"https://schema.org/MerchantReturnFiniteReturnWindow\",\n      \"merchantReturnDays\": 30\n    }\n  }\n}\n</script>",
   "guide": "https://ghostagentlab.com/articles/structured-data-ai-shopping-agents/"
  },
  {
   "id": "jsonld-organization",
   "url": "https://ghostagentlab.com/learn/snippets/#jsonld-organization",
   "group": "Structured data",
   "title": "Organization structured data for your store",
   "use": "Use on your home page; swap in your business name, address, contact details, social profiles and return policy.",
   "language": "HTML",
   "code": "<script type=\"application/ld+json\">\n{\n  \"@context\": \"https://schema.org\",\n  \"@type\": \"OnlineStore\",\n  \"@id\": \"https://northwind.example/#organization\",\n  \"name\": \"Northwind Coffee\",\n  \"legalName\": \"Northwind Coffee Ltd\",\n  \"url\": \"https://northwind.example/\",\n  \"logo\": \"https://northwind.example/images/logo.png\",\n  \"description\": \"Specialty coffee roasted to order and shipped across the US.\",\n  \"email\": \"help@northwind.example\",\n  \"telephone\": \"+1-555-010-0199\",\n  \"address\": {\n    \"@type\": \"PostalAddress\",\n    \"streetAddress\": \"120 Harbor Street\",\n    \"addressLocality\": \"Portland\",\n    \"addressRegion\": \"OR\",\n    \"postalCode\": \"97201\",\n    \"addressCountry\": \"US\"\n  },\n  \"contactPoint\": [{\n    \"@type\": \"ContactPoint\",\n    \"contactType\": \"customer service\",\n    \"email\": \"help@northwind.example\",\n    \"telephone\": \"+1-555-010-0199\",\n    \"availableLanguage\": [\"en\"],\n    \"hoursAvailable\": {\n      \"@type\": \"OpeningHoursSpecification\",\n      \"dayOfWeek\": [\"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\"],\n      \"opens\": \"09:00\",\n      \"closes\": \"17:00\"\n    }\n  }],\n  \"sameAs\": [\n    \"https://www.instagram.com/northwindcoffee.example\",\n    \"https://www.linkedin.com/company/northwind-coffee-example\"\n  ],\n  \"hasMerchantReturnPolicy\": {\n    \"@type\": \"MerchantReturnPolicy\",\n    \"applicableCountry\": \"US\",\n    \"returnPolicyCategory\": \"https://schema.org/MerchantReturnFiniteReturnWindow\",\n    \"merchantReturnDays\": 30,\n    \"returnMethod\": \"https://schema.org/ReturnByMail\",\n    \"returnFees\": \"https://schema.org/FreeReturn\",\n    \"merchantReturnLink\": \"https://northwind.example/returns\"\n  }\n}\n</script>",
   "guide": "https://ghostagentlab.com/articles/organization-structured-data/"
  },
  {
   "id": "jsonld-breadcrumblist",
   "url": "https://ghostagentlab.com/learn/snippets/#jsonld-breadcrumblist",
   "group": "Structured data",
   "title": "BreadcrumbList structured data",
   "use": "Use on product and category pages; match the names and URLs to the breadcrumb trail shown on the page.",
   "language": "HTML",
   "code": "<script type=\"application/ld+json\">\n{\n  \"@context\": \"https://schema.org\",\n  \"@type\": \"BreadcrumbList\",\n  \"itemListElement\": [\n    { \"@type\": \"ListItem\", \"position\": 1, \"name\": \"Coffee\",\n      \"item\": \"https://northwind.example/coffee/\" },\n    { \"@type\": \"ListItem\", \"position\": 2, \"name\": \"Espresso\",\n      \"item\": \"https://northwind.example/coffee/espresso/\" },\n    { \"@type\": \"ListItem\", \"position\": 3, \"name\": \"Dark Roast Beans\" }\n  ]\n}\n</script>",
   "guide": "https://ghostagentlab.com/articles/breadcrumbs-site-structure-ai-agents/"
  },
  {
   "id": "jsonld-videoobject",
   "url": "https://ghostagentlab.com/learn/snippets/#jsonld-videoobject",
   "group": "Structured data",
   "title": "VideoObject with transcript",
   "use": "Use on pages with product or how-to videos; fill in your video's title, dates, length, URLs and transcript.",
   "language": "JSON-LD",
   "code": "{\n  \"@context\": \"https://schema.org\",\n  \"@type\": \"VideoObject\",\n  \"name\": \"Setting the Northwind Aero kettle for green tea\",\n  \"description\": \"How to fill the Aero to 1.7 liters and use the 80°C setting.\",\n  \"thumbnailUrl\": \"https://northwind.example/media/aero-tea.jpg\",\n  \"uploadDate\": \"2026-09-14T09:00:00-05:00\",\n  \"duration\": \"PT2M05S\",\n  \"embedUrl\": \"https://northwind.example/embed/aero-tea\",\n  \"transcript\": \"Hi, I'm Dana from Northwind. Today we're making green tea...\"\n}",
   "guide": "https://ghostagentlab.com/articles/video-transcripts-ai-agents/"
  },
  {
   "id": "jsonld-productgroup-variants",
   "url": "https://ghostagentlab.com/learn/snippets/#jsonld-productgroup-variants",
   "group": "Structured data",
   "title": "ProductGroup for sizes and colors",
   "use": "Use when one product comes in several variants; list each variant's SKU, options, URL, price and stock.",
   "language": "JSON-LD",
   "code": "{\n  \"@context\": \"https://schema.org\",\n  \"@type\": \"ProductGroup\",\n  \"name\": \"Field jacket\",\n  \"productGroupID\": \"FJ-100\",\n  \"variesBy\": [\"https://schema.org/color\", \"https://schema.org/size\"],\n  \"hasVariant\": [{\n    \"@type\": \"Product\",\n    \"sku\": \"FJ-100-NAV-M\",\n    \"color\": \"Navy\",\n    \"size\": \"M\",\n    \"url\": \"https://northwind.example/products/field-jacket?variant=40318\",\n    \"offers\": {\n      \"@type\": \"Offer\",\n      \"price\": \"189.00\",\n      \"priceCurrency\": \"USD\",\n      \"availability\": \"https://schema.org/InStock\"\n    }\n  }]\n}",
   "guide": "https://ghostagentlab.com/articles/variant-pickers-ai-agents/"
  },
  {
   "id": "jsonld-reviews-ratings",
   "url": "https://ghostagentlab.com/learn/snippets/#jsonld-reviews-ratings",
   "group": "Structured data",
   "title": "Product ratings and reviews markup",
   "use": "Use when product pages show reviews; the rating, count and review text must match what shoppers see on the page.",
   "language": "JSON-LD",
   "code": "{\n  \"@context\": \"https://schema.org\",\n  \"@type\": \"Product\",\n  \"name\": \"Ethiopia Yirgacheffe Whole Bean Coffee, 340 g\",\n  \"aggregateRating\": {\n    \"@type\": \"AggregateRating\",\n    \"ratingValue\": \"4.6\",\n    \"bestRating\": \"5\",\n    \"reviewCount\": \"318\"\n  },\n  \"review\": [{\n    \"@type\": \"Review\",\n    \"author\": { \"@type\": \"Person\", \"name\": \"Dana R.\" },\n    \"datePublished\": \"2026-09-14\",\n    \"reviewRating\": { \"@type\": \"Rating\", \"ratingValue\": \"5\", \"bestRating\": \"5\" },\n    \"reviewBody\": \"Bright and floral as a pour-over. Arrived two days after roasting.\"\n  }],\n  \"offers\": {\n    \"@type\": \"Offer\",\n    \"price\": \"18.00\",\n    \"priceCurrency\": \"USD\",\n    \"availability\": \"https://schema.org/InStock\"\n  }\n}",
   "guide": "https://ghostagentlab.com/articles/reviews-ratings-ai-agents/"
  },
  {
   "id": "html-icon-button-name",
   "url": "https://ghostagentlab.com/learn/snippets/#html-icon-button-name",
   "group": "Buttons, forms and navigation",
   "title": "Give icon buttons a name",
   "use": "Use for any button that shows only an icon, such as cart or close; write a label that says what it does.",
   "language": "HTML",
   "code": "<!-- An agent sees: button, no name -->\n<button><svg>…</svg></button>\n\n<!-- An agent sees: button \"Cart, 2 items\" -->\n<button aria-label=\"Cart, 2 items\"><svg aria-hidden=\"true\">…</svg></button>",
   "guide": "https://ghostagentlab.com/articles/agent-friendly-buttons-forms/"
  },
  {
   "id": "html-inline-field-error",
   "url": "https://ghostagentlab.com/learn/snippets/#html-inline-field-error",
   "group": "Buttons, forms and navigation",
   "title": "Field error linked to its input",
   "use": "Use for form validation messages; change the field, ID and wording to say exactly how to fix the problem.",
   "language": "HTML",
   "code": "<label for=\"zip\">ZIP code</label>\n<input id=\"zip\" name=\"zip\" autocomplete=\"postal-code\"\n       aria-invalid=\"true\" aria-describedby=\"zip-error\">\n<p id=\"zip-error\">Enter a 5-digit ZIP code, like 10001</p>",
   "guide": "https://ghostagentlab.com/articles/error-messages-ai-agents/"
  },
  {
   "id": "html-error-summary",
   "url": "https://ghostagentlab.com/learn/snippets/#html-error-summary",
   "group": "Buttons, forms and navigation",
   "title": "Form error summary with field links",
   "use": "Use on checkout and sign-up forms with several fields; list each real problem and link to its field.",
   "language": "HTML",
   "code": "<div role=\"alert\" tabindex=\"-1\" id=\"error-summary\">\n  <h2>There are 2 problems with your details</h2>\n  <ul>\n    <li><a href=\"#zip\">Enter a 5-digit ZIP code, like 10001</a></li>\n    <li><a href=\"#phone\">Enter a phone number with area code</a></li>\n  </ul>\n</div>",
   "guide": "https://ghostagentlab.com/articles/error-messages-ai-agents/"
  },
  {
   "id": "html-variant-radio-swatches",
   "url": "https://ghostagentlab.com/learn/snippets/#html-variant-radio-swatches",
   "group": "Buttons, forms and navigation",
   "title": "Color picker built from real radio buttons",
   "use": "Use for color or size swatches; keep a visible text name for each option and use your own values.",
   "language": "HTML",
   "code": "<fieldset>\n  <legend>Color</legend>\n  <label class=\"swatch\">\n    <input type=\"radio\" name=\"color\" value=\"navy\" checked>\n    <span class=\"dot\" style=\"background:#1f2a44\" aria-hidden=\"true\"></span>\n    Navy\n  </label>\n  <label class=\"swatch\">\n    <input type=\"radio\" name=\"color\" value=\"olive\">\n    <span class=\"dot\" style=\"background:#5b5e3a\" aria-hidden=\"true\"></span>\n    Olive\n  </label>\n</fieldset>",
   "guide": "https://ghostagentlab.com/articles/variant-pickers-ai-agents/"
  },
  {
   "id": "html-breadcrumb-nav",
   "url": "https://ghostagentlab.com/learn/snippets/#html-breadcrumb-nav",
   "group": "Buttons, forms and navigation",
   "title": "Breadcrumb trail with real links",
   "use": "Use on product and category pages; replace the links with your own category path to the current page.",
   "language": "HTML",
   "code": "<nav aria-label=\"Breadcrumb\">\n  <ol>\n    <li><a href=\"/\">Home</a></li>\n    <li><a href=\"/coffee/\">Coffee</a></li>\n    <li><a href=\"/coffee/espresso/\">Espresso</a></li>\n    <li><a href=\"/coffee/espresso/dark-roast-beans\" aria-current=\"page\">Dark Roast Beans</a></li>\n  </ol>\n</nav>",
   "guide": "https://ghostagentlab.com/articles/breadcrumbs-site-structure-ai-agents/"
  },
  {
   "id": "html-consent-banner",
   "url": "https://ghostagentlab.com/learn/snippets/#html-consent-banner",
   "group": "Buttons, forms and navigation",
   "title": "Cookie banner with plain buttons",
   "use": "Use as the pattern for your consent bar; link your own cookie policy and keep reject as easy as accept.",
   "language": "HTML",
   "code": "<div class=\"consent-bar\" role=\"region\" aria-label=\"Cookie choices\">\n  <p>We use cookies to run the store and, with your OK, to measure ads.\n     <a href=\"/pages/cookies\">Cookie policy</a></p>\n  <button type=\"button\">Reject all</button>\n  <button type=\"button\">Accept all</button>\n  <button type=\"button\">Choose cookies</button>\n</div>",
   "guide": "https://ghostagentlab.com/articles/cookie-banners-popups-ai-agents/"
  },
  {
   "id": "html-search-form",
   "url": "https://ghostagentlab.com/learn/snippets/#html-search-form",
   "group": "Buttons, forms and navigation",
   "title": "Site search form that works without scripts",
   "use": "Use for your store search box; point the action at your search page and keep the query in the URL.",
   "language": "HTML",
   "code": "<form role=\"search\" action=\"/search\" method=\"get\">\n  <label for=\"q\">Search products</label>\n  <input id=\"q\" name=\"q\" type=\"search\" autocomplete=\"off\">\n  <button type=\"submit\">Search</button>\n</form>",
   "guide": "https://ghostagentlab.com/articles/site-search-filters-ai-agents/"
  },
  {
   "id": "http-429-retry-after",
   "url": "https://ghostagentlab.com/learn/snippets/#http-429-retry-after",
   "group": "Servers, CDNs and headers",
   "title": "429 response with Retry-After",
   "use": "Use when your rate limiter turns requests away; set the wait time and message to match your real limit.",
   "language": "HTTP",
   "code": "HTTP/1.1 429 Too Many Requests\nRetry-After: 30\nContent-Type: text/plain\n\nToo many requests from this client. Please wait 30 seconds and try again.",
   "guide": "https://ghostagentlab.com/articles/rate-limits-ai-agents/"
  },
  {
   "id": "http-503-maintenance",
   "url": "https://ghostagentlab.com/learn/snippets/#http-503-maintenance",
   "group": "Servers, CDNs and headers",
   "title": "503 maintenance page with Retry-After",
   "use": "Use during planned downtime instead of a 200 or 404; set Retry-After in seconds and your own return time.",
   "language": "HTTP",
   "code": "HTTP/1.1 503 Service Unavailable\nRetry-After: 1800\nContent-Type: text/html\n\n<h1>We're updating the store</h1>\n<p>Back by 10:30 UTC. Orders placed before 10:00 are safe.</p>",
   "guide": "https://ghostagentlab.com/articles/status-codes-redirects-ai-agents/"
  },
  {
   "id": "shell-check-redirects",
   "url": "https://ghostagentlab.com/learn/snippets/#shell-check-redirects",
   "group": "Servers, CDNs and headers",
   "title": "Check a URL's status and redirects",
   "use": "Use to see the final status code and redirect count for any page; replace the URL with one of yours.",
   "language": "Shell",
   "code": "curl -s -o /dev/null -L -w \"%{http_code} %{num_redirects} %{url_effective}\\n\" \\\n  https://northwind.example/beans/kenya",
   "guide": "https://ghostagentlab.com/articles/status-codes-redirects-ai-agents/"
  },
  {
   "id": "nginx-log-format-agents",
   "url": "https://ghostagentlab.com/learn/snippets/#nginx-log-format-agents",
   "group": "Servers, CDNs and headers",
   "title": "nginx log format that records user agents",
   "use": "Use if your logs leave out the user agent or response time; add it to your nginx config and point access_log at it.",
   "language": "nginx",
   "code": "log_format agents '$time_iso8601 $remote_addr \"$request_method $uri\" '\n                  '$status $body_bytes_sent $request_time \"$http_user_agent\"';",
   "guide": "https://ghostagentlab.com/articles/agent-errors-in-logs/"
  },
  {
   "id": "shell-agent-status-codes",
   "url": "https://ghostagentlab.com/learn/snippets/#shell-agent-status-codes",
   "group": "Measurement",
   "title": "Count status codes AI assistants get",
   "use": "Use on a raw access log to spot blocks and errors for assistant visits; point it at your log file.",
   "language": "Shell",
   "code": "grep -E 'ChatGPT-User|Claude-User|Perplexity-User' access.log \\\n  | awk '{print $9}' | sort | uniq -c | sort -rn",
   "guide": "https://ghostagentlab.com/articles/agent-errors-in-logs/"
  },
  {
   "id": "sql-agent-errors-weekly",
   "url": "https://ghostagentlab.com/learn/snippets/#sql-agent-errors-weekly",
   "group": "Measurement",
   "title": "Weekly error rates by AI agent",
   "use": "Use if your logs are in a SQL database; rename the table and columns to match your own log schema.",
   "language": "SQL",
   "code": "SELECT\n  CASE\n    WHEN user_agent ILIKE '%ChatGPT-User%'    THEN 'ChatGPT-User'\n    WHEN user_agent ILIKE '%OAI-SearchBot%'   THEN 'OAI-SearchBot'\n    WHEN user_agent ILIKE '%Claude-User%'     THEN 'Claude-User'\n    WHEN user_agent ILIKE '%Perplexity-User%' THEN 'Perplexity-User'\n    WHEN user_agent ILIKE '%PerplexityBot%'   THEN 'PerplexityBot'\n    WHEN user_agent ILIKE '%Googlebot%'       THEN 'Googlebot'\n    ELSE 'everything else'\n  END AS agent,\n  COUNT(*) AS requests,\n  COUNT(*) FILTER (WHERE status IN (401, 403)) AS blocked,\n  COUNT(*) FILTER (WHERE status = 429)         AS rate_limited,\n  COUNT(*) FILTER (WHERE status = 404)         AS not_found,\n  COUNT(*) FILTER (WHERE status >= 500)        AS server_errors,\n  ROUND(100.0 * COUNT(*) FILTER (WHERE status >= 400) / COUNT(*), 1) AS error_pct\nFROM requests\nWHERE ts >= now() - interval '7 days'\nGROUP BY 1\nORDER BY requests DESC;",
   "guide": "https://ghostagentlab.com/articles/agent-errors-in-logs/"
  },
  {
   "id": "shell-count-ai-crawlers",
   "url": "https://ghostagentlab.com/learn/snippets/#shell-count-ai-crawlers",
   "group": "Measurement",
   "title": "Count visits from each AI crawler",
   "use": "Use on a combined format access log to see which AI agents visit; add any agent names you care about.",
   "language": "Shell",
   "code": "awk -F'\"' '{print $6}' access.log \\\n  | grep -oiE 'GPTBot|OAI-SearchBot|ChatGPT-User|ClaudeBot|Claude-SearchBot|Claude-User|PerplexityBot|Perplexity-User|Applebot|Amazonbot|meta-external[a-z]+|Bytespider|CCBot' \\\n  | sort | uniq -c | sort -rn",
   "guide": "https://ghostagentlab.com/articles/measure-ai-agent-traffic/"
  },
  {
   "id": "regex-ai-referrers",
   "url": "https://ghostagentlab.com/learn/snippets/#regex-ai-referrers",
   "group": "Measurement",
   "title": "Regex for AI assistant referral traffic",
   "use": "Use in your analytics to group visits referred by AI assistants; add new assistant domains as they appear.",
   "language": "Text",
   "code": "(^|\\.)(chatgpt\\.com|chat\\.openai\\.com|perplexity\\.ai|gemini\\.google\\.com|copilot\\.microsoft\\.com|claude\\.ai)$",
   "guide": "https://ghostagentlab.com/articles/ai-referral-traffic/"
  }
 ]
}
