Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(web-analytics): add bing, apple, openai, perplexity, ahrefs crawler ip ranges (#68660)

Lucas Ricoy56e89d89bcc9
diff --git a/posthog/hogql/functions/test/test_traffic_type_real_ua.py b/posthog/hogql/functions/test/test_traffic_type_real_ua.py
index b626324529d0..0a05f95b43e4 100644
--- a/posthog/hogql/functions/test/test_traffic_type_real_ua.py
+++ b/posthog/hogql/functions/test/test_traffic_type_real_ua.py
@@ -12,15 +12,15 @@ from products.web_analytics.backend.hogql_queries.bot_ip_definitions import BOT_
from products.web_analytics.backend.hogql_queries.bot_ua_fixtures import BOT_USER_AGENTS, CATEGORY_TO_TRAFFIC_CATEGORY
-def _expected_ip_bot_name(ip: str) -> str:
+def _expected_ip_definition(ip: str):
"""Mirror the query-time multiIf: first BOT_IP_DEFINITIONS entry whose ranges contain the ip."""
address = ip_address(ip)
for ip_def in BOT_IP_DEFINITIONS.values():
for cidr in ip_def.networks:
network = ip_network(cidr)
if network.version == address.version and address in network:
- return ip_def.name
- return ""
+ return ip_def
+ return None
def _find_matching_pattern(ua: str) -> str | None:
@@ -259,11 +259,13 @@ class TestTrafficTypeIntegration(BaseTest):
for cidr in ip_def.networks
if ":" in cidr
)
+ chatgpt_user_v4 = str(ip_network(BOT_IP_DEFINITIONS["openai-chatgpt-user"].networks[0]).network_address)
cases = [
# (case_id, properties, expected_is_bot, expected_traffic_type, expected_bot_name)
("google-v4", {"$raw_user_agent": renderer_ua, "$ip": "66.249.84.5"}, 1, "Bot", None),
("google-special-v4", {"$raw_user_agent": renderer_ua, "$ip": "74.125.150.10"}, 1, "Bot", None),
("google-v6", {"$raw_user_agent": renderer_ua, "$ip": google_v6}, 1, "Bot", None),
+ ("openai-chatgpt-user", {"$raw_user_agent": renderer_ua, "$ip": chatgpt_user_v4}, 1, "AI Agent", None),
("residential", {"$raw_user_agent": renderer_ua, "$ip": "203.0.113.7"}, 0, "Regular", ""),
("garbage-ip", {"$raw_user_agent": renderer_ua, "$ip": "not-an-ip"}, 0, "Regular", ""),
("missing-ip", {"$raw_user_agent": renderer_ua}, 0, "Regular", ""),
@@ -299,13 +301,17 @@ class TestTrafficTypeIntegration(BaseTest):
_case, is_bot, traffic_type, bot_name, bot_operator = row
assert is_bot == expected_is_bot, f"is_bot mismatch for {case_id}: got {is_bot}"
assert traffic_type == expected_traffic_type, f"traffic_type mismatch for {case_id}: got {traffic_type}"
+ expected_operator = None
if expected_bot_name is None:
- # IP-classified: which Google list an IP sits in shifts across upstream
- # refreshes, so derive the expected label from the data instead of pinning it
- expected_bot_name = _expected_ip_bot_name(properties["$ip"])
+ # IP-classified: which operator list an IP sits in shifts across upstream
+ # refreshes, so derive the expected labels from the data instead of pinning them
+ ip_def = _expected_ip_definition(properties["$ip"])
+ assert ip_def is not None, f"case {case_id} ip no longer in any range — update the test ip"
+ expected_bot_name = ip_def.name
+ expected_operator = ip_def.operator
assert bot_name == expected_bot_name, f"bot_name mismatch for {case_id}: got {bot_name}"
- if expected_is_bot:
- assert bot_operator == "Google", f"bot_operator mismatch for {case_id}: got {bot_operator}"
+ if expected_operator is not None:
+ assert bot_operator == expected_operator, f"bot_operator mismatch for {case_id}: got {bot_operator}"
def test_virt_properties_empty_user_agent(self):
tag = uuid4().hex
diff --git a/products/web_analytics/backend/hogql_queries/bot_ip_definitions.py b/products/web_analytics/backend/hogql_queries/bot_ip_definitions.py
index 7056673bce54..78de65db8e84 100644
--- a/products/web_analytics/backend/hogql_queries/bot_ip_definitions.py
+++ b/products/web_analytics/backend/hogql_queries/bot_ip_definitions.py
@@ -3,9 +3,17 @@ from functools import cache
from ipaddress import IPv6Address, collapse_addresses, ip_network
from products.web_analytics.backend.hogql_queries.bot_ip_networks import (
+ AHREFSBOT_NETWORKS,
+ APPLEBOT_NETWORKS,
+ BINGBOT_NETWORKS,
GOOGLE_COMMON_CRAWLER_NETWORKS,
GOOGLE_SPECIAL_CRAWLER_NETWORKS,
GOOGLE_USER_TRIGGERED_FETCHER_NETWORKS,
+ OPENAI_CHATGPT_USER_NETWORKS,
+ OPENAI_GPTBOT_NETWORKS,
+ OPENAI_SEARCHBOT_NETWORKS,
+ PERPLEXITY_USER_NETWORKS,
+ PERPLEXITYBOT_NETWORKS,
)
@@ -48,6 +56,73 @@ BOT_IP_DEFINITIONS: dict[str, BotIPDefinition] = {
networks=GOOGLE_USER_TRIGGERED_FETCHER_NETWORKS,
documentation_url="https://developers.google.com/crawling/docs/verifying-google-crawlers",
),
+ # Labels below mirror the corresponding UA definitions in BOT_DEFINITIONS so a bot
+ # classifies identically whichever signal catches it. Where one operator's lists
+ # overlap (OpenAI shares some ranges across lists), earlier entries win the label.
+ "openai-chatgpt-user": BotIPDefinition(
+ "ChatGPT",
+ "ai_assistant",
+ "AI Agent",
+ "OpenAI",
+ networks=OPENAI_CHATGPT_USER_NETWORKS,
+ documentation_url="https://openai.com/chatgpt-user.json",
+ ),
+ "openai-searchbot": BotIPDefinition(
+ "OpenAI Search",
+ "ai_search",
+ "AI Agent",
+ "OpenAI",
+ networks=OPENAI_SEARCHBOT_NETWORKS,
+ documentation_url="https://openai.com/searchbot.json",
+ ),
+ "openai-gptbot": BotIPDefinition(
+ "GPTBot",
+ "ai_crawler",
+ "AI Agent",
+ "OpenAI",
+ networks=OPENAI_GPTBOT_NETWORKS,
+ documentation_url="https://openai.com/gptbot.json",
+ ),
+ "perplexity-user": BotIPDefinition(
+ "Perplexity User",
+ "ai_assistant",
+ "AI Agent",
+ "Perplexity",
+ networks=PERPLEXITY_USER_NETWORKS,
+ documentation_url="https://www.perplexity.com/perplexity-user.json",
+ ),
+ "perplexitybot": BotIPDefinition(
+ "Perplexity",
+ "ai_search",
+ "AI Agent",
+ "Perplexity",
+ networks=PERPLEXITYBOT_NETWORKS,
+ documentation_url="https://www.perplexity.com/perplexitybot.json",
+ ),
+ "bingbot": BotIPDefinition(
+ "Bingbot",
+ "search_crawler",
+ "Bot",
+ "Microsoft",
+ networks=BINGBOT_NETWORKS,
+ documentation_url="https://www.bing.com/webmasters/help/verifying-that-bingbot-is-bingbot-3905dc26",
+ ),
+ "applebot": BotIPDefinition(
+ "Applebot",
+ "ai_search",
+ "AI Agent",
+ "Apple",
+ networks=APPLEBOT_NETWORKS,
+ documentation_url="https://support.apple.com/en-us/119829",
+ ),
+ "ahrefsbot": BotIPDefinition(
+ "Ahrefs",
+ "seo_crawler",
+ "Bot",
+ "Ahrefs",
+ networks=AHREFSBOT_NETWORKS,
+ documentation_url="https://ahrefs.com/robot",
+ ),
}
# The query-time matcher normalizes every address to IPv6 (IPv4 maps to ::ffff:a.b.c.d),
diff --git a/products/web_analytics/backend/hogql_queries/bot_ip_networks.py b/products/web_analytics/backend/hogql_queries/bot_ip_networks.py
index bb272c642f6b..15253fb78e41 100644
--- a/products/web_analytics/backend/hogql_queries/bot_ip_networks.py
+++ b/products/web_analytics/backend/hogql_queries/bot_ip_networks.py
@@ -1,6 +1,6 @@
# Generated by products/web_analytics/scripts/refresh_bot_ip_ranges.py — do not edit by hand.
-# Collapsed CIDR ranges of Google-published crawler/fetcher IPs; see that script for
-# the source URLs and for why user-triggered-fetchers.json (GCP egress) is excluded.
+# Collapsed CIDR ranges of operator-published crawler IPs; see that script for the
+# source URLs and for why general cloud/datacenter egress is deliberately excluded.
# https://developers.google.com/static/crawling/ipranges/common-crawlers.json
GOOGLE_COMMON_CRAWLER_NETWORKS: tuple[str, ...] = (
@@ -203,3 +203,408 @@ GOOGLE_USER_TRIGGERED_FETCHER_NETWORKS: tuple[str, ...] = (
"2001:4860:4801:4164::/63",
"2001:4860:4801:4166::/64",
)
+
+# https://www.bing.com/toolbox/bingbot.json
+BINGBOT_NETWORKS: tuple[str, ...] = (
+ "13.66.139.0/24",
+ "13.66.144.0/24",
+ "13.67.10.16/28",
+ "13.69.66.240/28",
+ "13.71.172.224/28",
+ "20.15.133.160/27",
+ "20.36.108.32/28",
+ "20.43.120.16/28",
+ "20.74.197.0/28",
+ "20.79.107.240/28",
+ "20.125.163.80/28",
+ "40.77.139.0/25",
+ "40.77.167.0/24",
+ "40.77.177.0/24",
+ "40.77.178.0/23",
+ "40.77.188.0/22",
+ "40.77.202.0/24",
+ "40.79.131.208/28",
+ "40.79.186.176/28",
+ "51.105.67.0/28",
+ "52.167.144.0/24",
+ "52.231.148.0/28",
+ "65.55.210.0/24",
+ "139.217.52.0/28",
+ "157.55.39.0/24",
+ "191.233.204.224/28",
+ "199.30.24.0/23",
+ "207.46.13.0/24",
+)
+
+# https://search.developer.apple.com/applebot.json
+APPLEBOT_NETWORKS: tuple[str, ...] = (
+ "17.22.237.0/24",
+ "17.22.245.0/24",
+ "17.22.253.0/24",
+ "17.241.75.0/24",
+ "17.241.193.160/27",
+ "17.241.200.160/27",
+ "17.241.208.160/27",
+ "17.241.219.0/24",
+ "17.241.227.0/24",
+ "17.246.15.0/24",
+ "17.246.19.0/24",
+ "17.246.23.0/24",
+)
+
+# https://openai.com/gptbot.json
+OPENAI_GPTBOT_NETWORKS: tuple[str, ...] = (
+ "4.227.36.0/25",
+ "20.125.66.80/28",
+ "20.171.206.0/23",
+ "52.230.152.0/24",
+ "74.7.175.128/25",
+ "74.7.227.0/24",
+ "74.7.228.0/25",
+ "74.7.230.0/25",
+ "74.7.241.0/24",
+ "74.7.242.0/25",
+ "74.7.243.128/25",
+ "74.7.244.0/25",
+ "132.196.86.0/24",
+ "172.182.202.0/25",
+ "172.182.204.0/24",
+ "172.182.207.0/25",
+ "172.182.214.0/23",
+)
+
+# https://openai.com/chatgpt-user.json
+OPENAI_CHATGPT_USER_NETWORKS: tuple[str, ...] = (
+ "4.151.71.176/28",
+ "4.151.119.48/28",
+ "4.151.241.240/28",
+ "4.189.118.208/28",
+ "4.189.119.48/28",
+ "4.196.118.112/28",
+ "4.196.198.80/28",
+ "4.197.19.176/28",
+ "4.197.22.112/28",
+ "4.197.64.0/27",
+ "4.197.64.48/28",
+ "4.197.64.64/28",
+ "4.197.115.112/28",
+ "4.198.72.16/28",
+ "4.205.128.176/28",
+ "4.226.226.32/28",
+ "9.129.0.0/17",
+ "9.160.163.224/28",
+ "9.160.164.128/28",
+ "9.234.96.192/28",
+ "13.65.138.96/27",
+ "13.67.72.16/28",
+ "13.70.107.160/28",
+ "13.71.2.208/28",
+ "13.76.32.208/28",
+ "13.76.115.224/27",
+ "13.76.116.80/28",
+ "13.83.167.128/28",
+ "13.83.237.176/28",
+ "20.0.53.96/28",
+ "20.17.108.96/28",
+ "20.27.94.128/28",
+ "20.42.250.32/28",
+ "20.45.178.144/28",
+ "20.52.125.160/28",
+ "20.55.129.0/28",
+ "20.55.229.144/28",
+ "20.57.199.192/28",
+ "20.63.221.64/28",
+ "20.79.59.112/28",
+ "20.97.189.96/28",
+ "20.102.212.144/28",
+ "20.113.225.112/28",
+ "20.125.112.224/28",
+ "20.125.144.144/28",
+ "20.161.75.208/28",
+ "20.168.7.192/28",
+ "20.168.7.240/28",
+ "20.169.72.96/27",
+ "20.169.73.32/28",
+ "20.169.73.64/28",
+ "20.169.73.176/28",
+ "20.169.78.48/28",
+ "20.169.78.64/26",
+ "20.169.78.128/26",
+ "20.169.78.192/27",
+ "20.169.86.224/27",
+ "20.169.87.112/28",
+ "20.170.184.16/28",
+ "20.172.29.32/28",
+ "20.193.50.32/28",
+ "20.193.233.240/28",
+ "20.194.0.208/28",
+ "20.194.1.0/28",
+ "20.194.157.176/28",
+ "20.198.67.96/28",
+ "20.199.211.160/28",
+ "20.203.245.32/28",
+ "20.204.24.240/28",
+ "20.206.107.192/28",
+ "20.210.154.128/28",
+ "20.210.174.208/28",
+ "20.210.211.192/28",
+ "20.215.187.208/28",
+ "20.215.188.192/28",
+ "20.215.214.16/28",
+ "20.215.219.128/28",
+ "20.215.219.160/28",
+ "20.215.219.208/28",
+ "20.215.220.64/26",
+ "20.215.220.128/26",
+ "20.215.220.192/27",
+ "20.226.32.80/28",
+ "20.227.140.32/28",
+ "20.228.106.176/28",
+ "20.235.75.208/28",
+ "20.235.87.224/28",
+ "20.249.63.208/28",
+ "23.97.109.224/28",
+ "23.98.142.176/28",
+ "23.98.179.16/28",
+ "23.98.186.64/28",
+ "23.98.186.96/28",
+ "23.98.186.176/28",
+ "23.98.186.192/28",
+ "23.102.140.144/28",
+ "23.102.141.32/28",
+ "40.67.183.160/27",
+ "40.75.14.224/28",
+ "40.81.134.128/27",
+ "40.81.234.144/28",
+ "40.84.181.32/28",
+ "40.84.221.208/28",
+ "40.84.221.224/28",
+ "40.116.73.208/28",
+ "40.122.235.112/28",
+ "48.193.44.32/28",
+ "51.8.155.48/28",
+ "51.8.155.64/27",
+ "51.107.70.192/28",
+ "51.116.2.64/27",
+ "52.148.129.32/28",
+ "52.153.130.48/28",
+ "52.153.130.64/28",
+ "52.154.22.48/28",
+ "52.156.77.144/28",
+ "52.159.227.32/28",
+ "52.159.249.96/28",
+ "52.161.49.96/28",
+ "52.161.49.224/28",
+ "52.165.212.16/28",
+ "52.165.212.32/27",
+ "52.172.129.160/28",
+ "52.172.251.112/28",
+ "52.173.123.0/28",
+ "52.173.219.96/27",
+ "52.173.221.16/28",
+ "52.173.221.176/28",
+ "52.173.221.208/28",
+ "52.173.234.16/28",
+ "52.173.234.80/28",
+ "52.173.235.80/28",
+ "52.176.139.176/28",
+ "52.187.246.128/28",
+ "52.190.137.16/28",
+ "52.190.137.144/28",
+ "52.190.139.48/28",
+ "52.190.142.64/28",
+ "52.190.190.16/28",
+ "52.225.75.208/28",
+ "52.230.163.32/28",
+ "52.230.164.176/28",
+ "52.231.30.48/28",
+ "52.231.34.176/28",
+ "52.231.39.144/28",
+ "52.231.39.192/28",
+ "52.231.49.48/28",
+ "52.231.50.64/28",
+ "52.236.94.144/28",
+ "52.241.146.208/28",
+ "52.242.132.224/27",
+ "52.242.245.208/28",
+ "52.252.113.240/28",
+ "52.255.109.80/28",
+ "52.255.109.96/27",
+ "52.255.109.128/27",
+ "52.255.111.0/26",
+ "52.255.111.80/28",
+ "52.255.111.112/28",
+ "57.151.131.224/28",
+ "57.154.174.112/28",
+ "57.154.175.0/28",
+ "57.154.187.32/28",
+ "68.154.28.96/28",
+ "68.218.30.112/28",
+ "68.220.57.64/28",
+ "68.221.67.160/28",
+ "68.221.67.192/28",
+ "68.221.67.224/27",
+ "68.221.75.16/28",
+ "70.153.76.16/28",
+ "74.7.35.48/28",
+ "74.7.35.112/28",
+ "74.7.36.64/27",
+ "74.7.36.96/28",
+ "74.226.253.160/28",
+ "74.249.86.176/28",
+ "85.211.241.128/28",
+ "104.210.139.192/28",
+ "104.210.139.224/28",
+ "132.196.82.48/28",
+ "135.119.134.128/28",
+ "135.119.134.192/28",
+ "135.220.73.208/28",
+ "135.220.73.240/28",
+ "135.237.131.208/28",
+ "135.237.133.48/28",
+ "137.135.191.176/28",
+ "138.91.30.48/28",
+ "138.91.46.96/28",
+ "168.63.252.240/28",
+ "172.170.8.208/28",
+ "172.171.4.176/28",
+ "172.178.140.144/28",
+ "172.178.141.112/28",
+ "172.178.141.128/28",
+ "172.183.143.224/28",
+ "172.183.222.128/28",
+ "172.196.40.208/28",
+ "172.202.102.112/28",
+ "172.204.16.64/28",
+ "172.204.27.16/28",
+ "172.212.159.64/28",
+ "172.212.172.160/28",
+ "172.213.11.144/28",
+ "172.213.21.16/28",
+ "172.215.215.32/28",
+ "172.215.218.96/28",
+ "191.233.1.112/28",
+ "191.233.1.128/28",
+ "191.233.1.224/28",
+ "191.233.2.0/28",
+ "191.233.194.32/28",
+ "191.233.196.112/28",
+ "191.233.199.160/28",
+ "191.234.167.128/28",
+ "191.235.66.16/28",
+ "191.235.98.144/28",
+ "191.235.99.80/28",
+ "191.237.249.64/28",
+ "191.239.245.16/28",
+)
+
+# https://openai.com/searchbot.json
+OPENAI_SEARCHBOT_NETWORKS: tuple[str, ...] = (
+ "4.227.36.0/25",
+ "20.14.99.96/28",
+ "20.25.151.224/28",
+ "20.42.10.176/28",
+ "20.168.18.32/28",
+ "20.169.6.224/28",
+ "20.169.7.48/28",
+ "20.169.77.0/25",
+ "20.171.53.224/28",
+ "20.171.123.64/28",
+ "40.67.175.0/25",
+ "40.90.214.16/28",
+ "51.8.102.0/24",
+ "74.7.175.128/25",
+ "74.7.228.0/23",
+ "74.7.230.0/25",
+ "74.7.241.128/25",
+ "74.7.242.128/25",
+ "74.7.243.0/25",
+ "74.7.244.0/25",
+ "104.210.140.128/28",
+ "135.234.64.0/24",
+ "172.182.193.80/28",
+ "172.182.193.224/28",
+ "172.182.194.32/28",
+ "172.182.194.144/28",
+ "172.182.195.48/28",
+ "172.182.209.208/28",
+ "172.182.211.192/28",
+ "172.182.213.192/28",
+ "172.182.224.0/28",
+ "172.203.190.128/28",
+)
+
+# https://www.perplexity.com/perplexitybot.json
+PERPLEXITYBOT_NETWORKS: tuple[str, ...] = (
+ "3.211.124.183/32",
+ "3.222.232.239/32",
+ "3.224.62.45/32",
+ "3.231.139.107/32",
+ "18.97.1.228/30",
+ "18.97.9.96/29",
+ "18.210.92.235/32",
+ "107.20.236.150/32",
+)
+
+# https://www.perplexity.com/perplexity-user.json
+PERPLEXITY_USER_NETWORKS: tuple[str, ...] = (
+ "18.97.21.0/30",
+ "18.97.43.80/29",
+ "34.193.163.52/32",
+ "44.208.221.197/32",
+)
+
+# https://api.ahrefs.com/v3/public/crawler-ip-ranges
+AHREFSBOT_NETWORKS: tuple[str, ...] = (
+ "5.39.1.224/27",
+ "5.39.109.160/27",
+ "15.235.27.0/24",
+ "15.235.96.0/24",
+ "15.235.98.0/24",
+ "37.59.204.128/27",
+ "51.68.247.192/27",
+ "51.75.236.128/27",
+ "51.89.129.0/24",
+ "51.161.37.0/24",
+ "51.161.65.0/24",
+ "51.195.183.0/24",
+ "51.195.215.0/24",
+ "51.195.244.0/24",
+ "51.222.95.0/24",
+ "51.222.168.0/24",
+ "51.222.253.0/26",
+ "54.36.148.0/23",
+ "54.37.118.64/27",
+ "54.38.147.0/24",
+ "54.39.0.0/24",
+ "54.39.6.0/24",
+ "54.39.89.0/24",
+ "54.39.136.0/24",
+ "54.39.203.0/24",
+ "54.39.210.0/24",
+ "92.222.104.192/27",
+ "92.222.108.96/27",
+ "94.23.188.192/27",
+ "142.44.220.0/24",
+ "142.44.225.0/24",
+ "142.44.228.0/24",
+ "142.44.233.0/24",
+ "148.113.128.0/24",
+ "148.113.130.0/24",
+ "167.114.139.0/24",
+ "168.100.149.0/24",
+ "176.31.139.0/27",
+ "198.244.168.0/24",
+ "198.244.183.0/24",
+ "198.244.186.193/32",
+ "198.244.186.194/31",
+ "198.244.186.196/30",
+ "198.244.186.200/31",
+ "198.244.186.202/32",
+ "198.244.226.0/24",
+ "198.244.240.0/24",
+ "198.244.242.0/24",
+ "202.8.40.0/22",
+ "202.94.84.110/31",
+ "202.94.84.112/31",
+)
diff --git a/products/web_analytics/scripts/refresh_bot_ip_ranges.py b/products/web_analytics/scripts/refresh_bot_ip_ranges.py
index 4823ff00828c..b415a53efe90 100644
--- a/products/web_analytics/scripts/refresh_bot_ip_ranges.py
+++ b/products/web_analytics/scripts/refresh_bot_ip_ranges.py
@@ -1,17 +1,23 @@
#!/usr/bin/env python3
"""Refresh the bot IP ranges vendored in bot_ip_networks.py.
-Google publishes the IP ranges its crawlers and fetchers operate from as
-machine-readable JSON. Some of that traffic (notably the mobile rendering
-service) uses real browser user agents with no bot token, so IP ranges are
-the only reliable classification signal. This script fetches the published
-lists, collapses adjacent CIDRs, and rewrites
+Crawler operators publish the IP ranges their bots run from as machine-readable
+JSON (all use Google's `prefixes` format). Some of that traffic (notably
+Google's mobile rendering service and ChatGPT's browsing) uses real browser
+user agents with no bot token, so IP ranges are the only reliable
+classification signal. This script fetches the published lists, collapses
+adjacent CIDRs, and rewrites
products/web_analytics/backend/hogql_queries/bot_ip_networks.py.
-We intentionally do NOT vendor user-triggered-fetchers.json: those ranges are
-Google Cloud egress that third parties can run arbitrary workloads (including
-VPNs and proxies serving real users) behind, so matching them would
-misclassify human traffic.
+Only operator-published, crawler-dedicated ranges belong here — never general
+datacenter/cloud egress (AWS, Cloudflare, GCP run countless real applications
+and residential-facing services). That is also why we do NOT vendor Google's
+user-triggered-fetchers.json: those ranges are Google Cloud egress that third
+parties can run arbitrary workloads (including VPNs and proxies serving real
+users) behind, so matching them would misclassify human traffic.
+
+Anthropic publishes no crawler IP list (only API egress IPs) — its crawlers
+are covered by UA patterns and Web Bot Auth signature agents instead.
Usage, from the repo root:
python products/web_analytics/scripts/refresh_bot_ip_ranges.py
@@ -35,6 +41,14 @@ PROVIDERS: dict[str, str] = {
"GOOGLE_COMMON_CRAWLER_NETWORKS": "https://developers.google.com/static/crawling/ipranges/common-crawlers.json",
"GOOGLE_SPECIAL_CRAWLER_NETWORKS": "https://developers.google.com/static/crawling/ipranges/special-crawlers.json",
"GOOGLE_USER_TRIGGERED_FETCHER_NETWORKS": "https://developers.google.com/static/crawling/ipranges/user-triggered-fetchers-google.json",
+ "BINGBOT_NETWORKS": "https://www.bing.com/toolbox/bingbot.json",
+ "APPLEBOT_NETWORKS": "https://search.developer.apple.com/applebot.json",
+ "OPENAI_GPTBOT_NETWORKS": "https://openai.com/gptbot.json",
+ "OPENAI_CHATGPT_USER_NETWORKS": "https://openai.com/chatgpt-user.json",
+ "OPENAI_SEARCHBOT_NETWORKS": "https://openai.com/searchbot.json",
+ "PERPLEXITYBOT_NETWORKS": "https://www.perplexity.com/perplexitybot.json",
+ "PERPLEXITY_USER_NETWORKS": "https://www.perplexity.com/perplexity-user.json",
+ "AHREFSBOT_NETWORKS": "https://api.ahrefs.com/v3/public/crawler-ip-ranges",
}
OUTPUT_PATH = Path(__file__).resolve().parents[1] / "backend" / "hogql_queries" / "bot_ip_networks.py"
@@ -80,8 +94,8 @@ def main() -> int:
body = "\n\n".join(sections)
OUTPUT_PATH.write_text(
"# Generated by products/web_analytics/scripts/refresh_bot_ip_ranges.py — do not edit by hand.\n"
- "# Collapsed CIDR ranges of Google-published crawler/fetcher IPs; see that script for\n"
- "# the source URLs and for why user-triggered-fetchers.json (GCP egress) is excluded.\n\n"
+ "# Collapsed CIDR ranges of operator-published crawler IPs; see that script for the\n"
+ "# source URLs and for why general cloud/datacenter egress is deliberately excluded.\n\n"
f"{body}\n"
)
print(f"wrote {OUTPUT_PATH}") # noqa: T201