@shware/analytics 16.3.1 → 16.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -216,9 +216,24 @@ const GENERIC_BOT_PATTERNS = [
216
216
  "whatcms/",
217
217
  "xtate/"
218
218
  ];
219
- /** One case-insensitive expression; the parts use lookbehind, which every supported runtime has. */
220
- const GENERIC_BOT = new RegExp(GENERIC_BOT_PATTERNS.join("|"), "i");
221
- exports.GENERIC_BOT = GENERIC_BOT;
219
+ let compiled;
220
+ /**
221
+ * The patterns as one case-insensitive expression, compiled on first use rather than at import:
222
+ * this module is bundled into browser code, and a few patterns use lookbehind, which Safari before
223
+ * 16.4 cannot compile. Compiled at import, the SyntaxError failed the whole chunk that imported
224
+ * it. Where lookbehind is missing, those patterns are left out and the rest still apply.
225
+ */
226
+ function genericBot() {
227
+ if (compiled) return compiled;
228
+ try {
229
+ compiled = new RegExp(GENERIC_BOT_PATTERNS.join("|"), "i");
230
+ } catch {
231
+ const supported = GENERIC_BOT_PATTERNS.filter((pattern) => !pattern.includes("(?<"));
232
+ compiled = new RegExp(supported.join("|"), "i");
233
+ }
234
+ return compiled;
235
+ }
222
236
  exports.GENERIC_BOT_PATTERNS = GENERIC_BOT_PATTERNS;
237
+ exports.genericBot = genericBot;
223
238
 
224
239
  //# sourceMappingURL=generic.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"generic.cjs","names":[],"sources":["../../src/bot/generic.ts"],"sourcesContent":["/**\n * The generic bot pattern of isbot 5.2.2 (https://github.com/omrilotan/isbot, released into the\n * public domain under the Unlicense), vendored so that `botOf` has no dependency. It says whether a\n * user agent looks automated, not which bot it is: `botOf` tries its named table first and falls\n * back to this for the long tail. Refresh it by copying `list` from a newer isbot release, keeping\n * the local changes marked below.\n */\nexport const GENERIC_BOT_PATTERNS: readonly string[] = [\n ' daum[ /]',\n ' deusu/',\n '(?:^|[^g])news(?!sapphire)',\n '(?<! channel/|google/)google(?!(?:wv|app|/google| pixel))',\n '(?<! cu)bots?(?:\\\\b|_)',\n '(?<!cam)scan',\n '(?<!lib)http',\n '24x7',\n ';\\\\s\\\\w+;$',\n '@[a-z][\\\\w-]+\\\\.',\n '\\\\(\\\\)',\n '\\\\.com\\\\b',\n '\\\\b\\\\w+/1\\\\.0;',\n '\\\\bbw/',\n '\\\\bdlc\\\\b',\n '\\\\bort/',\n '\\\\bperl\\\\b',\n '\\\\btime/',\n '\\\\|',\n '^[<\\\\(;]',\n '^[\\\\w \\\\.\\\\-\\\\(?:\\\\):%]+(?:/v?\\\\d+(?:\\\\.\\\\d+)?(?:\\\\.\\\\d{1,10})*?)?(?:,|$)',\n '^[\\\\w\\\\-]+/[\\\\w]+$',\n '^[^ ]{50,}$',\n '^\\\\d+\\\\b',\n '^\\\\w*search\\\\b',\n '^\\\\w+/[\\\\w\\\\(\\\\)]*$',\n '^\\\\w+/\\\\d\\\\.\\\\d\\\\s\\\\([\\\\w@]+\\\\)$',\n '^active',\n '^ad muncher',\n '^amaya',\n '^apache/',\n '^avsdevicesdk/',\n '^azure',\n '^biglotron',\n '^blackbox exporter',\n '^bot',\n '^clamav[ /]',\n '^claude-code/',\n '^client/',\n '^cobweb/',\n '^custom',\n '^ddg[_-]android',\n '^discourse',\n '^dispatch/\\\\d',\n '^downcast/',\n '^duckduckgo',\n '^email',\n '^exodusmovement',\n '^facebook',\n '^getright/',\n '^gozilla/',\n '^hobbit',\n '^hotzonu',\n '^hwcdn/',\n '^igetter/',\n '^jeode/',\n '^jetty/',\n '^jigsaw',\n '^microsoft bits',\n '^movabletype',\n '^mozilla/\\\\d\\\\.\\\\d\\\\s[\\\\w\\\\.-]+$',\n '^mozilla/\\\\d\\\\.\\\\d\\\\s\\\\((?:compatible;)?(?:\\\\s?[\\\\w\\\\d-.]+\\\\/\\\\d+\\\\.\\\\d+)?\\\\)$',\n '^navermailapp',\n '^netsurf',\n '^offline',\n '^openai/',\n '^owler',\n '^php',\n '^postman',\n '^ps_daily/',\n '^python',\n '^rank',\n '^read',\n '^reed',\n '^remove\\\\.bg/',\n '^rest',\n '^rss',\n '^snapchat',\n '^sora ',\n '^space bison',\n '^stape/',\n '^svn',\n '^swcd ',\n '^taringa',\n '^thumbor/',\n '^track',\n '^w3c',\n '^webbandit/',\n '^webcopier',\n '^wget',\n '^whatsapp',\n '^wordpress',\n '^xenu link sleuth',\n '^yahoo',\n '^yandex',\n '^zdm/\\\\d',\n '^zoom marketplace/',\n 'abuse',\n 'advisor',\n 'agent\\\\b',\n 'analyzer',\n 'archive',\n 'ask jeeves/teoma',\n 'attracta',\n 'audit',\n 'bluecoat drtr',\n 'browsex',\n 'burpcollaborator',\n 'capture',\n 'catch',\n 'check\\\\b',\n 'checker',\n 'chrome-lighthouse',\n 'chromeframe',\n 'classifier',\n 'cloudflare',\n 'collapsify\\\\b',\n 'convertify',\n 'cookiehubverify/',\n 'crawl',\n 'cursor/',\n 'cypress/',\n 'dareboost',\n 'datanyze',\n 'dejaclick',\n 'detect',\n 'discovery',\n 'dmbrowser',\n 'download',\n 'exaleadcloudview',\n 'feed',\n 'firephp',\n 'foregenix',\n 'functionize',\n 'grab',\n 'hardenize\\\\b',\n 'headless',\n 'hotjar',\n 'httrack',\n 'hubspot marketing grader',\n 'ibisbrowser',\n 'infrawatch',\n 'insight',\n 'inspect',\n 'iplabel',\n 'java(?!;)',\n 'library',\n 'linkcheck',\n 'linktiger',\n 'mail\\\\.ru/',\n 'manager',\n 'manus-user/',\n 'marketgoo/',\n 'measure',\n 'monitor\\\\b',\n 'neustar wpm',\n 'node\\\\b',\n 'nutch',\n 'offbyone',\n 'openvas',\n 'optimize',\n 'pageburst',\n 'pagespeed',\n 'parser',\n 'phantomjs',\n 'pingdom',\n 'playwright',\n 'powermarks',\n 'preview',\n 'productfinder',\n 'prospectingstudio',\n 'proxy',\n 'ptst[ /]\\\\d',\n 'radar',\n 'readable/',\n 'retriever',\n 'rexx;',\n 'rigor',\n 'rss\\\\b',\n 'scrape',\n 'securityheaders',\n 'selenium',\n 'server',\n 'silktide',\n 'sindup/',\n // isbot has `sogou`, which also takes Sogou's own browser (SogouMobileBrowser) for a bot\n 'sogou[\\\\w\\\\s-]*spider',\n 'sparkler/',\n 'speedcurve',\n 'spider',\n 'splash',\n 'statuscake',\n 'supercleaner',\n 'synapse',\n 'synthetic',\n 'testlocally',\n 'tools',\n 'torrent',\n 'transcoder',\n 'url',\n 'validator',\n 'virtuoso',\n 'wappalyzer',\n 'watchtowr',\n 'webglance',\n 'webkit2png',\n 'whatcms/',\n 'xtate/',\n];\n\n/** One case-insensitive expression; the parts use lookbehind, which every supported runtime has. */\nexport const GENERIC_BOT = new RegExp(GENERIC_BOT_PATTERNS.join('|'), 'i');\n"],"mappings":";;;;;;;;;AAOA,MAAa,uBAA0C;CACrD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;AAGA,MAAa,cAAc,IAAI,OAAO,qBAAqB,KAAK,GAAG,GAAG,GAAG"}
1
+ {"version":3,"file":"generic.cjs","names":[],"sources":["../../src/bot/generic.ts"],"sourcesContent":["/**\n * The generic bot pattern of isbot 5.2.2 (https://github.com/omrilotan/isbot, released into the\n * public domain under the Unlicense), vendored so that `botOf` has no dependency. It says whether a\n * user agent looks automated, not which bot it is: `botOf` tries its named table first and falls\n * back to this for the long tail. Refresh it by copying `list` from a newer isbot release, keeping\n * the local changes marked below.\n */\nexport const GENERIC_BOT_PATTERNS: readonly string[] = [\n ' daum[ /]',\n ' deusu/',\n '(?:^|[^g])news(?!sapphire)',\n '(?<! channel/|google/)google(?!(?:wv|app|/google| pixel))',\n '(?<! cu)bots?(?:\\\\b|_)',\n '(?<!cam)scan',\n '(?<!lib)http',\n '24x7',\n ';\\\\s\\\\w+;$',\n '@[a-z][\\\\w-]+\\\\.',\n '\\\\(\\\\)',\n '\\\\.com\\\\b',\n '\\\\b\\\\w+/1\\\\.0;',\n '\\\\bbw/',\n '\\\\bdlc\\\\b',\n '\\\\bort/',\n '\\\\bperl\\\\b',\n '\\\\btime/',\n '\\\\|',\n '^[<\\\\(;]',\n '^[\\\\w \\\\.\\\\-\\\\(?:\\\\):%]+(?:/v?\\\\d+(?:\\\\.\\\\d+)?(?:\\\\.\\\\d{1,10})*?)?(?:,|$)',\n '^[\\\\w\\\\-]+/[\\\\w]+$',\n '^[^ ]{50,}$',\n '^\\\\d+\\\\b',\n '^\\\\w*search\\\\b',\n '^\\\\w+/[\\\\w\\\\(\\\\)]*$',\n '^\\\\w+/\\\\d\\\\.\\\\d\\\\s\\\\([\\\\w@]+\\\\)$',\n '^active',\n '^ad muncher',\n '^amaya',\n '^apache/',\n '^avsdevicesdk/',\n '^azure',\n '^biglotron',\n '^blackbox exporter',\n '^bot',\n '^clamav[ /]',\n '^claude-code/',\n '^client/',\n '^cobweb/',\n '^custom',\n '^ddg[_-]android',\n '^discourse',\n '^dispatch/\\\\d',\n '^downcast/',\n '^duckduckgo',\n '^email',\n '^exodusmovement',\n '^facebook',\n '^getright/',\n '^gozilla/',\n '^hobbit',\n '^hotzonu',\n '^hwcdn/',\n '^igetter/',\n '^jeode/',\n '^jetty/',\n '^jigsaw',\n '^microsoft bits',\n '^movabletype',\n '^mozilla/\\\\d\\\\.\\\\d\\\\s[\\\\w\\\\.-]+$',\n '^mozilla/\\\\d\\\\.\\\\d\\\\s\\\\((?:compatible;)?(?:\\\\s?[\\\\w\\\\d-.]+\\\\/\\\\d+\\\\.\\\\d+)?\\\\)$',\n '^navermailapp',\n '^netsurf',\n '^offline',\n '^openai/',\n '^owler',\n '^php',\n '^postman',\n '^ps_daily/',\n '^python',\n '^rank',\n '^read',\n '^reed',\n '^remove\\\\.bg/',\n '^rest',\n '^rss',\n '^snapchat',\n '^sora ',\n '^space bison',\n '^stape/',\n '^svn',\n '^swcd ',\n '^taringa',\n '^thumbor/',\n '^track',\n '^w3c',\n '^webbandit/',\n '^webcopier',\n '^wget',\n '^whatsapp',\n '^wordpress',\n '^xenu link sleuth',\n '^yahoo',\n '^yandex',\n '^zdm/\\\\d',\n '^zoom marketplace/',\n 'abuse',\n 'advisor',\n 'agent\\\\b',\n 'analyzer',\n 'archive',\n 'ask jeeves/teoma',\n 'attracta',\n 'audit',\n 'bluecoat drtr',\n 'browsex',\n 'burpcollaborator',\n 'capture',\n 'catch',\n 'check\\\\b',\n 'checker',\n 'chrome-lighthouse',\n 'chromeframe',\n 'classifier',\n 'cloudflare',\n 'collapsify\\\\b',\n 'convertify',\n 'cookiehubverify/',\n 'crawl',\n 'cursor/',\n 'cypress/',\n 'dareboost',\n 'datanyze',\n 'dejaclick',\n 'detect',\n 'discovery',\n 'dmbrowser',\n 'download',\n 'exaleadcloudview',\n 'feed',\n 'firephp',\n 'foregenix',\n 'functionize',\n 'grab',\n 'hardenize\\\\b',\n 'headless',\n 'hotjar',\n 'httrack',\n 'hubspot marketing grader',\n 'ibisbrowser',\n 'infrawatch',\n 'insight',\n 'inspect',\n 'iplabel',\n 'java(?!;)',\n 'library',\n 'linkcheck',\n 'linktiger',\n 'mail\\\\.ru/',\n 'manager',\n 'manus-user/',\n 'marketgoo/',\n 'measure',\n 'monitor\\\\b',\n 'neustar wpm',\n 'node\\\\b',\n 'nutch',\n 'offbyone',\n 'openvas',\n 'optimize',\n 'pageburst',\n 'pagespeed',\n 'parser',\n 'phantomjs',\n 'pingdom',\n 'playwright',\n 'powermarks',\n 'preview',\n 'productfinder',\n 'prospectingstudio',\n 'proxy',\n 'ptst[ /]\\\\d',\n 'radar',\n 'readable/',\n 'retriever',\n 'rexx;',\n 'rigor',\n 'rss\\\\b',\n 'scrape',\n 'securityheaders',\n 'selenium',\n 'server',\n 'silktide',\n 'sindup/',\n // isbot has `sogou`, which also takes Sogou's own browser (SogouMobileBrowser) for a bot\n 'sogou[\\\\w\\\\s-]*spider',\n 'sparkler/',\n 'speedcurve',\n 'spider',\n 'splash',\n 'statuscake',\n 'supercleaner',\n 'synapse',\n 'synthetic',\n 'testlocally',\n 'tools',\n 'torrent',\n 'transcoder',\n 'url',\n 'validator',\n 'virtuoso',\n 'wappalyzer',\n 'watchtowr',\n 'webglance',\n 'webkit2png',\n 'whatcms/',\n 'xtate/',\n];\n\nlet compiled: RegExp | undefined;\n\n/**\n * The patterns as one case-insensitive expression, compiled on first use rather than at import:\n * this module is bundled into browser code, and a few patterns use lookbehind, which Safari before\n * 16.4 cannot compile. Compiled at import, the SyntaxError failed the whole chunk that imported\n * it. Where lookbehind is missing, those patterns are left out and the rest still apply.\n */\nexport function genericBot(): RegExp {\n if (compiled) return compiled;\n try {\n compiled = new RegExp(GENERIC_BOT_PATTERNS.join('|'), 'i');\n } catch {\n const supported = GENERIC_BOT_PATTERNS.filter((pattern) => !pattern.includes('(?<'));\n compiled = new RegExp(supported.join('|'), 'i');\n }\n return compiled;\n}\n"],"mappings":";;;;;;;;;AAOA,MAAa,uBAA0C;CACrD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,IAAI;;;;;;;AAQJ,SAAgB,aAAqB;CACnC,IAAI,UAAU,OAAO;CACrB,IAAI;EACF,WAAW,IAAI,OAAO,qBAAqB,KAAK,GAAG,GAAG,GAAG;CAC3D,QAAQ;EACN,MAAM,YAAY,qBAAqB,QAAQ,YAAY,CAAC,QAAQ,SAAS,KAAK,CAAC;EACnF,WAAW,IAAI,OAAO,UAAU,KAAK,GAAG,GAAG,GAAG;CAChD;CACA,OAAO;AACT"}
@@ -6,6 +6,11 @@
6
6
  * the local changes marked below.
7
7
  */
8
8
  export declare const GENERIC_BOT_PATTERNS: readonly string[];
9
- /** One case-insensitive expression; the parts use lookbehind, which every supported runtime has. */
10
- export declare const GENERIC_BOT: RegExp;
9
+ /**
10
+ * The patterns as one case-insensitive expression, compiled on first use rather than at import:
11
+ * this module is bundled into browser code, and a few patterns use lookbehind, which Safari before
12
+ * 16.4 cannot compile. Compiled at import, the SyntaxError failed the whole chunk that imported
13
+ * it. Where lookbehind is missing, those patterns are left out and the rest still apply.
14
+ */
15
+ export declare function genericBot(): RegExp;
11
16
  //# sourceMappingURL=generic.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generic.d.cts","names":[],"sources":["../../src/bot/generic.ts"],"mappings":";;;;;;;qBAOa;;qBAoNA,aAAW"}
1
+ {"version":3,"file":"generic.d.cts","names":[],"sources":["../../src/bot/generic.ts"],"mappings":";;;;;;;qBAOa;;;;;;;wBA2NG,cAAc"}
@@ -6,6 +6,11 @@
6
6
  * the local changes marked below.
7
7
  */
8
8
  export declare const GENERIC_BOT_PATTERNS: readonly string[];
9
- /** One case-insensitive expression; the parts use lookbehind, which every supported runtime has. */
10
- export declare const GENERIC_BOT: RegExp;
9
+ /**
10
+ * The patterns as one case-insensitive expression, compiled on first use rather than at import:
11
+ * this module is bundled into browser code, and a few patterns use lookbehind, which Safari before
12
+ * 16.4 cannot compile. Compiled at import, the SyntaxError failed the whole chunk that imported
13
+ * it. Where lookbehind is missing, those patterns are left out and the rest still apply.
14
+ */
15
+ export declare function genericBot(): RegExp;
11
16
  //# sourceMappingURL=generic.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generic.d.mts","names":[],"sources":["../../src/bot/generic.ts"],"mappings":";;;;;;;qBAOa;;qBAoNA,aAAW"}
1
+ {"version":3,"file":"generic.d.mts","names":[],"sources":["../../src/bot/generic.ts"],"mappings":";;;;;;;qBAOa;;;;;;;wBA2NG,cAAc"}
@@ -215,8 +215,23 @@ const GENERIC_BOT_PATTERNS = [
215
215
  "whatcms/",
216
216
  "xtate/"
217
217
  ];
218
- /** One case-insensitive expression; the parts use lookbehind, which every supported runtime has. */
219
- const GENERIC_BOT = new RegExp(GENERIC_BOT_PATTERNS.join("|"), "i");
220
- export { GENERIC_BOT, GENERIC_BOT_PATTERNS };
218
+ let compiled;
219
+ /**
220
+ * The patterns as one case-insensitive expression, compiled on first use rather than at import:
221
+ * this module is bundled into browser code, and a few patterns use lookbehind, which Safari before
222
+ * 16.4 cannot compile. Compiled at import, the SyntaxError failed the whole chunk that imported
223
+ * it. Where lookbehind is missing, those patterns are left out and the rest still apply.
224
+ */
225
+ function genericBot() {
226
+ if (compiled) return compiled;
227
+ try {
228
+ compiled = new RegExp(GENERIC_BOT_PATTERNS.join("|"), "i");
229
+ } catch {
230
+ const supported = GENERIC_BOT_PATTERNS.filter((pattern) => !pattern.includes("(?<"));
231
+ compiled = new RegExp(supported.join("|"), "i");
232
+ }
233
+ return compiled;
234
+ }
235
+ export { GENERIC_BOT_PATTERNS, genericBot };
221
236
 
222
237
  //# sourceMappingURL=generic.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"generic.mjs","names":[],"sources":["../../src/bot/generic.ts"],"sourcesContent":["/**\n * The generic bot pattern of isbot 5.2.2 (https://github.com/omrilotan/isbot, released into the\n * public domain under the Unlicense), vendored so that `botOf` has no dependency. It says whether a\n * user agent looks automated, not which bot it is: `botOf` tries its named table first and falls\n * back to this for the long tail. Refresh it by copying `list` from a newer isbot release, keeping\n * the local changes marked below.\n */\nexport const GENERIC_BOT_PATTERNS: readonly string[] = [\n ' daum[ /]',\n ' deusu/',\n '(?:^|[^g])news(?!sapphire)',\n '(?<! channel/|google/)google(?!(?:wv|app|/google| pixel))',\n '(?<! cu)bots?(?:\\\\b|_)',\n '(?<!cam)scan',\n '(?<!lib)http',\n '24x7',\n ';\\\\s\\\\w+;$',\n '@[a-z][\\\\w-]+\\\\.',\n '\\\\(\\\\)',\n '\\\\.com\\\\b',\n '\\\\b\\\\w+/1\\\\.0;',\n '\\\\bbw/',\n '\\\\bdlc\\\\b',\n '\\\\bort/',\n '\\\\bperl\\\\b',\n '\\\\btime/',\n '\\\\|',\n '^[<\\\\(;]',\n '^[\\\\w \\\\.\\\\-\\\\(?:\\\\):%]+(?:/v?\\\\d+(?:\\\\.\\\\d+)?(?:\\\\.\\\\d{1,10})*?)?(?:,|$)',\n '^[\\\\w\\\\-]+/[\\\\w]+$',\n '^[^ ]{50,}$',\n '^\\\\d+\\\\b',\n '^\\\\w*search\\\\b',\n '^\\\\w+/[\\\\w\\\\(\\\\)]*$',\n '^\\\\w+/\\\\d\\\\.\\\\d\\\\s\\\\([\\\\w@]+\\\\)$',\n '^active',\n '^ad muncher',\n '^amaya',\n '^apache/',\n '^avsdevicesdk/',\n '^azure',\n '^biglotron',\n '^blackbox exporter',\n '^bot',\n '^clamav[ /]',\n '^claude-code/',\n '^client/',\n '^cobweb/',\n '^custom',\n '^ddg[_-]android',\n '^discourse',\n '^dispatch/\\\\d',\n '^downcast/',\n '^duckduckgo',\n '^email',\n '^exodusmovement',\n '^facebook',\n '^getright/',\n '^gozilla/',\n '^hobbit',\n '^hotzonu',\n '^hwcdn/',\n '^igetter/',\n '^jeode/',\n '^jetty/',\n '^jigsaw',\n '^microsoft bits',\n '^movabletype',\n '^mozilla/\\\\d\\\\.\\\\d\\\\s[\\\\w\\\\.-]+$',\n '^mozilla/\\\\d\\\\.\\\\d\\\\s\\\\((?:compatible;)?(?:\\\\s?[\\\\w\\\\d-.]+\\\\/\\\\d+\\\\.\\\\d+)?\\\\)$',\n '^navermailapp',\n '^netsurf',\n '^offline',\n '^openai/',\n '^owler',\n '^php',\n '^postman',\n '^ps_daily/',\n '^python',\n '^rank',\n '^read',\n '^reed',\n '^remove\\\\.bg/',\n '^rest',\n '^rss',\n '^snapchat',\n '^sora ',\n '^space bison',\n '^stape/',\n '^svn',\n '^swcd ',\n '^taringa',\n '^thumbor/',\n '^track',\n '^w3c',\n '^webbandit/',\n '^webcopier',\n '^wget',\n '^whatsapp',\n '^wordpress',\n '^xenu link sleuth',\n '^yahoo',\n '^yandex',\n '^zdm/\\\\d',\n '^zoom marketplace/',\n 'abuse',\n 'advisor',\n 'agent\\\\b',\n 'analyzer',\n 'archive',\n 'ask jeeves/teoma',\n 'attracta',\n 'audit',\n 'bluecoat drtr',\n 'browsex',\n 'burpcollaborator',\n 'capture',\n 'catch',\n 'check\\\\b',\n 'checker',\n 'chrome-lighthouse',\n 'chromeframe',\n 'classifier',\n 'cloudflare',\n 'collapsify\\\\b',\n 'convertify',\n 'cookiehubverify/',\n 'crawl',\n 'cursor/',\n 'cypress/',\n 'dareboost',\n 'datanyze',\n 'dejaclick',\n 'detect',\n 'discovery',\n 'dmbrowser',\n 'download',\n 'exaleadcloudview',\n 'feed',\n 'firephp',\n 'foregenix',\n 'functionize',\n 'grab',\n 'hardenize\\\\b',\n 'headless',\n 'hotjar',\n 'httrack',\n 'hubspot marketing grader',\n 'ibisbrowser',\n 'infrawatch',\n 'insight',\n 'inspect',\n 'iplabel',\n 'java(?!;)',\n 'library',\n 'linkcheck',\n 'linktiger',\n 'mail\\\\.ru/',\n 'manager',\n 'manus-user/',\n 'marketgoo/',\n 'measure',\n 'monitor\\\\b',\n 'neustar wpm',\n 'node\\\\b',\n 'nutch',\n 'offbyone',\n 'openvas',\n 'optimize',\n 'pageburst',\n 'pagespeed',\n 'parser',\n 'phantomjs',\n 'pingdom',\n 'playwright',\n 'powermarks',\n 'preview',\n 'productfinder',\n 'prospectingstudio',\n 'proxy',\n 'ptst[ /]\\\\d',\n 'radar',\n 'readable/',\n 'retriever',\n 'rexx;',\n 'rigor',\n 'rss\\\\b',\n 'scrape',\n 'securityheaders',\n 'selenium',\n 'server',\n 'silktide',\n 'sindup/',\n // isbot has `sogou`, which also takes Sogou's own browser (SogouMobileBrowser) for a bot\n 'sogou[\\\\w\\\\s-]*spider',\n 'sparkler/',\n 'speedcurve',\n 'spider',\n 'splash',\n 'statuscake',\n 'supercleaner',\n 'synapse',\n 'synthetic',\n 'testlocally',\n 'tools',\n 'torrent',\n 'transcoder',\n 'url',\n 'validator',\n 'virtuoso',\n 'wappalyzer',\n 'watchtowr',\n 'webglance',\n 'webkit2png',\n 'whatcms/',\n 'xtate/',\n];\n\n/** One case-insensitive expression; the parts use lookbehind, which every supported runtime has. */\nexport const GENERIC_BOT = new RegExp(GENERIC_BOT_PATTERNS.join('|'), 'i');\n"],"mappings":";;;;;;;;AAOA,MAAa,uBAA0C;CACrD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;AAGA,MAAa,cAAc,IAAI,OAAO,qBAAqB,KAAK,GAAG,GAAG,GAAG"}
1
+ {"version":3,"file":"generic.mjs","names":[],"sources":["../../src/bot/generic.ts"],"sourcesContent":["/**\n * The generic bot pattern of isbot 5.2.2 (https://github.com/omrilotan/isbot, released into the\n * public domain under the Unlicense), vendored so that `botOf` has no dependency. It says whether a\n * user agent looks automated, not which bot it is: `botOf` tries its named table first and falls\n * back to this for the long tail. Refresh it by copying `list` from a newer isbot release, keeping\n * the local changes marked below.\n */\nexport const GENERIC_BOT_PATTERNS: readonly string[] = [\n ' daum[ /]',\n ' deusu/',\n '(?:^|[^g])news(?!sapphire)',\n '(?<! channel/|google/)google(?!(?:wv|app|/google| pixel))',\n '(?<! cu)bots?(?:\\\\b|_)',\n '(?<!cam)scan',\n '(?<!lib)http',\n '24x7',\n ';\\\\s\\\\w+;$',\n '@[a-z][\\\\w-]+\\\\.',\n '\\\\(\\\\)',\n '\\\\.com\\\\b',\n '\\\\b\\\\w+/1\\\\.0;',\n '\\\\bbw/',\n '\\\\bdlc\\\\b',\n '\\\\bort/',\n '\\\\bperl\\\\b',\n '\\\\btime/',\n '\\\\|',\n '^[<\\\\(;]',\n '^[\\\\w \\\\.\\\\-\\\\(?:\\\\):%]+(?:/v?\\\\d+(?:\\\\.\\\\d+)?(?:\\\\.\\\\d{1,10})*?)?(?:,|$)',\n '^[\\\\w\\\\-]+/[\\\\w]+$',\n '^[^ ]{50,}$',\n '^\\\\d+\\\\b',\n '^\\\\w*search\\\\b',\n '^\\\\w+/[\\\\w\\\\(\\\\)]*$',\n '^\\\\w+/\\\\d\\\\.\\\\d\\\\s\\\\([\\\\w@]+\\\\)$',\n '^active',\n '^ad muncher',\n '^amaya',\n '^apache/',\n '^avsdevicesdk/',\n '^azure',\n '^biglotron',\n '^blackbox exporter',\n '^bot',\n '^clamav[ /]',\n '^claude-code/',\n '^client/',\n '^cobweb/',\n '^custom',\n '^ddg[_-]android',\n '^discourse',\n '^dispatch/\\\\d',\n '^downcast/',\n '^duckduckgo',\n '^email',\n '^exodusmovement',\n '^facebook',\n '^getright/',\n '^gozilla/',\n '^hobbit',\n '^hotzonu',\n '^hwcdn/',\n '^igetter/',\n '^jeode/',\n '^jetty/',\n '^jigsaw',\n '^microsoft bits',\n '^movabletype',\n '^mozilla/\\\\d\\\\.\\\\d\\\\s[\\\\w\\\\.-]+$',\n '^mozilla/\\\\d\\\\.\\\\d\\\\s\\\\((?:compatible;)?(?:\\\\s?[\\\\w\\\\d-.]+\\\\/\\\\d+\\\\.\\\\d+)?\\\\)$',\n '^navermailapp',\n '^netsurf',\n '^offline',\n '^openai/',\n '^owler',\n '^php',\n '^postman',\n '^ps_daily/',\n '^python',\n '^rank',\n '^read',\n '^reed',\n '^remove\\\\.bg/',\n '^rest',\n '^rss',\n '^snapchat',\n '^sora ',\n '^space bison',\n '^stape/',\n '^svn',\n '^swcd ',\n '^taringa',\n '^thumbor/',\n '^track',\n '^w3c',\n '^webbandit/',\n '^webcopier',\n '^wget',\n '^whatsapp',\n '^wordpress',\n '^xenu link sleuth',\n '^yahoo',\n '^yandex',\n '^zdm/\\\\d',\n '^zoom marketplace/',\n 'abuse',\n 'advisor',\n 'agent\\\\b',\n 'analyzer',\n 'archive',\n 'ask jeeves/teoma',\n 'attracta',\n 'audit',\n 'bluecoat drtr',\n 'browsex',\n 'burpcollaborator',\n 'capture',\n 'catch',\n 'check\\\\b',\n 'checker',\n 'chrome-lighthouse',\n 'chromeframe',\n 'classifier',\n 'cloudflare',\n 'collapsify\\\\b',\n 'convertify',\n 'cookiehubverify/',\n 'crawl',\n 'cursor/',\n 'cypress/',\n 'dareboost',\n 'datanyze',\n 'dejaclick',\n 'detect',\n 'discovery',\n 'dmbrowser',\n 'download',\n 'exaleadcloudview',\n 'feed',\n 'firephp',\n 'foregenix',\n 'functionize',\n 'grab',\n 'hardenize\\\\b',\n 'headless',\n 'hotjar',\n 'httrack',\n 'hubspot marketing grader',\n 'ibisbrowser',\n 'infrawatch',\n 'insight',\n 'inspect',\n 'iplabel',\n 'java(?!;)',\n 'library',\n 'linkcheck',\n 'linktiger',\n 'mail\\\\.ru/',\n 'manager',\n 'manus-user/',\n 'marketgoo/',\n 'measure',\n 'monitor\\\\b',\n 'neustar wpm',\n 'node\\\\b',\n 'nutch',\n 'offbyone',\n 'openvas',\n 'optimize',\n 'pageburst',\n 'pagespeed',\n 'parser',\n 'phantomjs',\n 'pingdom',\n 'playwright',\n 'powermarks',\n 'preview',\n 'productfinder',\n 'prospectingstudio',\n 'proxy',\n 'ptst[ /]\\\\d',\n 'radar',\n 'readable/',\n 'retriever',\n 'rexx;',\n 'rigor',\n 'rss\\\\b',\n 'scrape',\n 'securityheaders',\n 'selenium',\n 'server',\n 'silktide',\n 'sindup/',\n // isbot has `sogou`, which also takes Sogou's own browser (SogouMobileBrowser) for a bot\n 'sogou[\\\\w\\\\s-]*spider',\n 'sparkler/',\n 'speedcurve',\n 'spider',\n 'splash',\n 'statuscake',\n 'supercleaner',\n 'synapse',\n 'synthetic',\n 'testlocally',\n 'tools',\n 'torrent',\n 'transcoder',\n 'url',\n 'validator',\n 'virtuoso',\n 'wappalyzer',\n 'watchtowr',\n 'webglance',\n 'webkit2png',\n 'whatcms/',\n 'xtate/',\n];\n\nlet compiled: RegExp | undefined;\n\n/**\n * The patterns as one case-insensitive expression, compiled on first use rather than at import:\n * this module is bundled into browser code, and a few patterns use lookbehind, which Safari before\n * 16.4 cannot compile. Compiled at import, the SyntaxError failed the whole chunk that imported\n * it. Where lookbehind is missing, those patterns are left out and the rest still apply.\n */\nexport function genericBot(): RegExp {\n if (compiled) return compiled;\n try {\n compiled = new RegExp(GENERIC_BOT_PATTERNS.join('|'), 'i');\n } catch {\n const supported = GENERIC_BOT_PATTERNS.filter((pattern) => !pattern.includes('(?<'));\n compiled = new RegExp(supported.join('|'), 'i');\n }\n return compiled;\n}\n"],"mappings":";;;;;;;;AAOA,MAAa,uBAA0C;CACrD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,IAAI;;;;;;;AAQJ,SAAgB,aAAqB;CACnC,IAAI,UAAU,OAAO;CACrB,IAAI;EACF,WAAW,IAAI,OAAO,qBAAqB,KAAK,GAAG,GAAG,GAAG;CAC3D,QAAQ;EACN,MAAM,YAAY,qBAAqB,QAAQ,YAAY,CAAC,QAAQ,SAAS,KAAK,CAAC;EACnF,WAAW,IAAI,OAAO,UAAU,KAAK,GAAG,GAAG,GAAG;CAChD;CACA,OAAO;AACT"}
@@ -1159,7 +1159,7 @@ function botOf(tags) {
1159
1159
  bot_name: name,
1160
1160
  bot_category: category
1161
1161
  };
1162
- const generic = userAgent ? require_bot_generic.GENERIC_BOT.exec(userAgent) : null;
1162
+ const generic = userAgent ? require_bot_generic.genericBot().exec(userAgent) : null;
1163
1163
  const unknownName = generic ? nameOfUnknownBot(userAgent, generic[0]) : null;
1164
1164
  if (tags.webdriver === true) return {
1165
1165
  is_bot: true,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["GENERIC_BOT"],"sources":["../../src/bot/index.ts"],"sourcesContent":["import type { TrackTags } from '../track/types';\nimport { GENERIC_BOT } from './generic';\n\n/**\n * What kind of automated visitor a bot is, as the analytics tools that report bots separately\n * group them (PostHog's traffic categories, Cloudflare's verified bot categories, Matomo's\n * DeviceDetector). Stored next to the name so dashboards can group without re-deriving:\n *\n * - search_crawler: indexes pages for a search engine (Googlebot, Bingbot, Baiduspider)\n * - ai_crawler: collects content to train models (GPTBot, ClaudeBot, Meta-ExternalAgent)\n * - ai_search: indexes pages for an AI search product (OAI-SearchBot, PerplexityBot)\n * - ai_assistant: fetches a page because a person asked an assistant to (ChatGPT-User)\n * - advertising: works for an ad system — reviews landing pages, targets or verifies ads\n * (Meta-ExternalAds, AdsBot-Google, Mediapartners-Google)\n * - link_preview: renders the card of a link shared in a feed or a chat (facebookexternalhit)\n * - seo_tool: SEO, marketing and page-speed tools (AhrefsBot, Lighthouse, HubSpot)\n * - monitoring: uptime checks, synthetics and service callers (Pingdom, Stripe)\n * - headless_browser: a scripted browser (HeadlessChrome, Playwright, a WebDriver session)\n * - http_client: a library or command-line client (curl, python-requests)\n * - no_user_agent: a request without a user agent, which no browser sends\n * - other: automated by every sign, but none of the above\n */\nexport const BOT_CATEGORIES = [\n 'search_crawler',\n 'ai_crawler',\n 'ai_search',\n 'ai_assistant',\n 'advertising',\n 'link_preview',\n 'seo_tool',\n 'monitoring',\n 'headless_browser',\n 'http_client',\n 'no_user_agent',\n 'other',\n] as const;\n\nexport type BotCategory = (typeof BOT_CATEGORIES)[number];\n\n/**\n * The verdict, shaped like the columns a product stores it in (`is_bot`, `bot_name`,\n * `bot_category`). A person is `{ is_bot: false, bot_name: null, bot_category: null }`.\n */\nexport type Bot =\n | { is_bot: true; bot_name: string; bot_category: BotCategory }\n | { is_bot: false; bot_name: null; bot_category: null };\n\nexport const NOT_A_BOT: Bot = { is_bot: false, bot_name: null, bot_category: null };\n\n/**\n * Bots we can name, as `[name, category, pattern]`, tried in order; the first match wins.\n *\n * Where the list comes from (checked 2026-09-30):\n * - bowser's bot parsers (the ~25 named bots its `platform.type === 'bot'` reports), which this\n * replaces.\n * - PostHog's `bot_definitions.py` (web analytics traffic classification), for the bots and\n * categories an analytics product sees most.\n * - ai.robots.txt (`robots.json`), for AI crawlers, search bots, assistants and agents.\n * - The operators' own docs for the big ones: Google's crawler list, OpenAI's and Anthropic's\n * bot pages, Meta's web crawlers, Perplexity, Bing, Apple.\n * - Bots seen in production (Meta-ExternalAds, HubSpot, Bytespider).\n * Every entry was run against the real user agents in crawler-user-agents and PostHog's\n * fixtures, and bowser's browser fixtures were run to check no browser is taken for a bot\n * (Sogou's browser against its spider, Pinterest's in-app browser against its bot); see\n * `index.test.ts` for where to get them.\n *\n * The link above each entry is the operator's page about the bot, else its product page, else\n * its Known Agents profile (knownagents.com, formerly Dark Visitors) when the operator has none.\n *\n * Names are the operators' spelling of their user agent token. Order matters where one token\n * contains another or borrows a name: advertising and SEO tools come before the search engines\n * whose names they carry, and the more specific of Meta's, Anthropic's and Perplexity's tokens\n * come first. The long tail is left to the generic pattern, filed as `other` and named by\n * `nameOfUnknownBot`; add a bot here when it is worth its own category or name in a dashboard.\n */\nexport const NAMED_BOTS = [\n // advertising: before the search crawlers, AdsBot and Mediapartners carry Google's name\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['Meta-ExternalAds', 'advertising', /meta-externalads/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['facebookcatalog', 'advertising', /facebookcatalog/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-special-case-crawlers\n ['AdsBot-Google', 'advertising', /adsbot-google/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-special-case-crawlers\n ['Mediapartners-Google', 'advertising', /mediapartners-google/i],\n // https://www.bing.com/webmasters/help/which-crawlers-does-bing-use-8c184ec0\n ['AdIdxBot', 'advertising', /adidxbot/i],\n // https://support.google.com/adwords/answer/2404197\n ['Google-AdWords', 'advertising', /google-adwords/i],\n // https://support.google.com/google-ads/answer/6095821\n ['Google-Ads-Conversions', 'advertising', /google-ads-conversions/i],\n // https://developers.openai.com/api/docs/bots\n ['OAI-AdsBot', 'advertising', /oai-adsbot/i],\n // https://businesshelp.snapchat.com/s/article/adsbot-crawler\n ['SnapchatAds', 'advertising', /snapchatads/i],\n // https://www.taboola.com\n ['Taboolabot', 'advertising', /taboolabot/i],\n\n // AI assistants and agents: a person asked for this page\n // https://developers.openai.com/api/docs/bots\n ['ChatGPT-User', 'ai_assistant', /chatgpt-user/i],\n // https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler\n ['Claude-User', 'ai_assistant', /claude-user/i],\n // https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler\n ['Claude-Web', 'ai_assistant', /claude-web/i],\n // https://docs.perplexity.ai/guides/bots\n ['Perplexity-User', 'ai_assistant', /perplexity-user/i],\n // https://duckduckgo.com/duckduckgo-help-pages/results/duckassistbot\n ['DuckAssistBot', 'ai_assistant', /duckassistbot/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['Meta-ExternalFetcher', 'ai_assistant', /meta-externalfetcher/i],\n // https://docs.mistral.ai/robots\n ['MistralAI-User', 'ai_assistant', /mistralai-user/i],\n // https://knownagents.com/agents/manus-user\n ['Manus-User', 'ai_assistant', /manus-user/i],\n // https://knownagents.com/agents/shap-user\n ['Shap-User', 'ai_assistant', /shap-user/i],\n // https://quillbot.com\n ['QuillBot', 'ai_assistant', /quillbot/i],\n // https://developer.amazon.com/amazonbot\n ['Amzn-User', 'ai_assistant', /amzn-user/i],\n // https://knownagents.com/agents/amazon-qbusiness\n ['amazon-QBusiness', 'ai_assistant', /amazon-qbusiness/i],\n // https://docs.aws.amazon.com/bedrock-agentcore/\n ['Amazon-Bedrock-AgentCore-Browser', 'ai_assistant', /amazon-bedrock-agentcore/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-user-triggered-fetchers\n ['Google-Agent', 'ai_assistant', /google-?agent/i],\n // https://gemini.google/overview/deep-research/\n ['Gemini-Deep-Research', 'ai_assistant', /gemini-deep-research/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-user-triggered-fetchers\n ['Google-NotebookLM', 'ai_assistant', /google-notebooklm/i],\n // https://www.kimi.ai/policies/kimi-crawlers\n ['Kimi-User', 'ai_assistant', /kimi-(?:user|agent)/i],\n // https://knownagents.com/agents/tongyibot\n ['TongyiBot', 'ai_assistant', /tongyibot/i],\n // https://knownagents.com/agents/yiyanbot\n ['YiyanBot', 'ai_assistant', /yiyanbot/i],\n // https://help.kagi.com/kagi/ai/kagi-ai.html\n ['kagi-fetcher', 'ai_assistant', /kagi-fetcher/i],\n // https://devin.ai\n ['Devin', 'ai_assistant', /\\bdevin\\/\\d/i],\n // https://knownagents.com/agents/novaact\n ['NovaAct', 'ai_assistant', /novaact/i],\n\n // AI search\n // https://developers.openai.com/api/docs/bots\n ['OAI-SearchBot', 'ai_search', /oai-searchbot/i],\n // https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler\n ['Claude-SearchBot', 'ai_search', /claude-searchbot/i],\n // https://docs.perplexity.ai/guides/bots\n ['PerplexityBot', 'ai_search', /perplexitybot/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['Meta-WebIndexer', 'ai_search', /meta-webindexer/i],\n // https://developer.amazon.com/amazonbot\n ['Amazonbot', 'ai_search', /amazonbot/i],\n // https://knownagents.com/agents/youbot\n ['YouBot', 'ai_search', /youbot/i],\n // https://knownagents.com/agents/phindbot\n ['PhindBot', 'ai_search', /phindbot/i],\n // https://developer.amazon.com/amazonbot\n ['Amzn-SearchBot', 'ai_search', /amzn-searchbot/i],\n // https://knownagents.com/agents/azureai-searchbot\n ['AzureAI-SearchBot', 'ai_search', /azureai-searchbot/i],\n // https://www.kimi.ai/policies/kimi-crawlers\n ['Kimi-SearchBot', 'ai_search', /kimi-searchbot/i],\n // https://docs.mistral.ai/robots\n ['MistralAI-Index', 'ai_search', /mistralai-index/i],\n // https://knownagents.com/agents/exasearchbot\n ['ExaSearchBot', 'ai_search', /exasearchbot|\\bexabot/i],\n // https://knownagents.com/agents/tavilybot\n ['TavilyBot', 'ai_search', /tavilybot/i],\n // https://linkup.so/bot\n ['LinkupBot', 'ai_search', /linkupbot/i],\n // https://knownagents.com/agents/iaskspider\n ['iAskBot', 'ai_search', /iask(?:bot|spider)/i],\n ['Andibot', 'ai_search', /andibot/i],\n // https://developers.cloudflare.com/autorag\n ['Cloudflare-AutoRAG', 'ai_search', /cloudflare-autorag/i],\n // https://docs.parallel.ai/resources/crawler\n ['ShapBot', 'ai_search', /shapbot/i],\n\n // AI training\n // https://developers.openai.com/api/docs/bots\n ['GPTBot', 'ai_crawler', /gptbot/i],\n // https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler\n ['ClaudeBot', 'ai_crawler', /claudebot/i],\n // https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler\n ['anthropic-ai', 'ai_crawler', /anthropic-ai/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['Meta-ExternalAgent', 'ai_crawler', /meta-externalagent/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['FacebookBot', 'ai_crawler', /facebookbot/i],\n // https://knownagents.com/agents/bytespider\n ['Bytespider', 'ai_crawler', /bytespider/i],\n // https://commoncrawl.org/ccbot\n ['CCBot', 'ai_crawler', /ccbot/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['Google-CloudVertexBot', 'ai_crawler', /google-cloudvertexbot/i],\n // https://knownagents.com/agents/cohere-training-data-crawler\n ['cohere-ai', 'ai_crawler', /cohere-(?:ai|training-data-crawler)/i],\n // https://www.diffbot.com/docs/crawl/faq/robots-txt\n ['Diffbot', 'ai_crawler', /diffbot/i],\n // https://knownagents.com/agents/webzio-extended\n ['Omgili', 'ai_crawler', /omgili|webzio-extended/i],\n // https://imagesift.com/about\n ['ImagesiftBot', 'ai_crawler', /imagesiftbot/i],\n // https://www.timpi.io\n ['Timpibot', 'ai_crawler', /timpibot/i],\n // https://knownagents.com/agents/ai2bot\n ['AI2Bot', 'ai_crawler', /ai2bot/i],\n // https://knownagents.com/agents/pangubot\n ['PanguBot', 'ai_crawler', /pangubot/i],\n // https://knownagents.com/agents/promptingbot\n ['PromptingBot', 'ai_crawler', /promptingbot/i],\n // https://knownagents.com/agents/reflectionbot\n ['Reflectionbot', 'ai_crawler', /reflectionbot/i],\n // https://knownagents.com/agents/tiktokspider\n ['TikTokSpider', 'ai_crawler', /tiktokspider/i],\n // https://knownagents.com/agents/deepseekbot\n ['DeepSeekBot', 'ai_crawler', /deepseekbot/i],\n // https://knownagents.com/agents/doubaobot\n ['DoubaoBot', 'ai_crawler', /doubaobot/i],\n // https://knownagents.com/agents/erniebot\n ['ERNIEBot', 'ai_crawler', /erniebot/i],\n // https://knownagents.com/agents/qwenbot\n ['QwenBot', 'ai_crawler', /qwenbot/i],\n // https://www.kimi.ai/policies/kimi-crawlers\n ['KimiBot', 'ai_crawler', /kimibot/i],\n // https://knownagents.com/agents/chatglm-spider\n ['ChatGLM-Spider', 'ai_crawler', /chatglm-spider/i],\n // https://docs.mistral.ai/robots\n ['MistralAI-Training', 'ai_crawler', /mistralai-training/i],\n // https://knownagents.com/agents/yandexadditional\n ['YandexAdditional', 'ai_crawler', /yandexadditional/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['Google-Extended', 'ai_crawler', /google-extended/i],\n // https://docs.aws.amazon.com/kendra/latest/dg/what-is-kendra.html\n ['Amazon Kendra', 'ai_crawler', /amazon-kendra|kendrabot/i],\n // https://knownagents.com/agents/bedrockbot\n ['bedrockbot', 'ai_crawler', /bedrockbot/i],\n // https://brightdata.com/brightbot\n ['Brightbot', 'ai_crawler', /brightbot/i],\n // https://firecrawl.dev\n ['FirecrawlAgent', 'ai_crawler', /firecrawl/i],\n // https://github.com/unclecode/crawl4ai\n ['Crawl4AI', 'ai_crawler', /crawl4ai/i],\n // https://apify.com/apify/website-content-crawler\n ['ApifyBot', 'ai_crawler', /apify/i],\n // https://github.com/rom1504/img2dataset\n ['img2dataset', 'ai_crawler', /img2dataset/i],\n // https://knownagents.com/agents/laion-huggingface-processor\n ['LAION', 'ai_crawler', /laion/i],\n // https://developers.cloudflare.com/browser-rendering/\n ['Cloudflare Browser Rendering', 'ai_crawler', /cloudflarebrowserrendering/i],\n\n // link previews\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['facebookexternalhit', 'link_preview', /facebookexternalhit/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['Facebot', 'link_preview', /facebot/i],\n // https://developer.x.com/en/docs/x-for-websites/cards/guides/getting-started\n ['Twitterbot', 'link_preview', /twitterbot/i],\n // https://www.linkedin.com/help/linkedin/answer/a521928\n ['LinkedInBot', 'link_preview', /linkedinbot/i],\n // https://api.slack.com/robots\n ['Slackbot', 'link_preview', /slackbot|slack-imgproxy/i],\n // https://discord.com\n ['Discordbot', 'link_preview', /discordbot/i],\n // https://core.telegram.org/bots\n ['TelegramBot', 'link_preview', /telegrambot/i],\n // https://www.whatsapp.com\n ['WhatsApp', 'link_preview', /^whatsapp\\//i],\n // https://www.pinterest.com/bot.html\n ['Pinterestbot', 'link_preview', /pinterestbot|^pinterest\\/0\\./i],\n // https://www.reddit.com\n ['redditbot', 'link_preview', /redditbot/i],\n // https://developers.snap.com/robots\n ['Snap URL Preview', 'link_preview', /snap url preview/i],\n // https://knownagents.com/agents/skypeuripreview\n ['SkypeUriPreview', 'link_preview', /skypeuripreview/i],\n // https://www.bing.com/webmasters/help/which-crawlers-does-bing-use-8c184ec0\n ['BingPreview', 'link_preview', /bingpreview|microsoftpreview/i],\n // https://iframely.com/docs/about\n ['Iframely', 'link_preview', /iframely/i],\n // https://embed.ly\n ['Embedly', 'link_preview', /embedly/i],\n // https://devtalk.kakao.com/t/scrap/33984\n ['KakaoTalk-scrap', 'link_preview', /kakaotalk-scrap/i],\n // https://vk.com/dev/Share\n ['vkShare', 'link_preview', /vkshare/i],\n // https://www.viber.com\n ['Viber', 'link_preview', /^viber\\b|viber-crawler/i],\n // https://github.com/bluesky-social/indigo\n ['Bluesky Cardyb', 'link_preview', /cardyb/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-user-triggered-fetchers\n ['Google-PageRenderer', 'link_preview', /google-pagerenderer/i],\n // https://vercel.com\n ['vercel-screenshot', 'link_preview', /vercel-screenshot/i],\n\n // SEO, marketing and page-speed tools; before the search crawlers, Lighthouse and the\n // Search Console tester borrow Google's name\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['Google-InspectionTool', 'seo_tool', /google-inspectiontool/i],\n // https://developer.chrome.com/docs/lighthouse\n ['Lighthouse', 'seo_tool', /chrome-lighthouse|google page speed insights/i],\n // https://gtmetrix.com\n ['GTmetrix', 'seo_tool', /gtmetrix/i],\n // https://ahrefs.com/robot\n ['AhrefsBot', 'seo_tool', /ahrefs(?:bot|siteaudit)/i],\n // https://www.semrush.com/bot/\n ['SemrushBot', 'seo_tool', /semrush/i],\n // https://mj12bot.com\n ['MJ12bot', 'seo_tool', /mj12bot/i],\n // https://moz.com/help/moz-procedures/crawlers/dotbot\n ['DotBot', 'seo_tool', /dotbot/i],\n // https://moz.com/help/moz-procedures/crawlers/rogerbot\n ['rogerbot', 'seo_tool', /rogerbot/i],\n // https://www.screamingfrog.co.uk/seo-spider/\n ['Screaming Frog', 'seo_tool', /screaming frog/i],\n // https://serpstatbot.com\n ['SerpstatBot', 'seo_tool', /serpstatbot/i],\n // https://webmeup-crawler.com\n ['BLEXBot', 'seo_tool', /blexbot/i],\n // https://dataforseo.com/dataforseo-bot\n ['DataForSeoBot', 'seo_tool', /dataforseobot/i],\n // https://knownagents.com/agents/hubspot-crawler\n ['HubSpot', 'seo_tool', /hubspot/i],\n // https://search.google.com/structured-data/testing-tool\n ['Google-Structured-Data-Testing-Tool', 'seo_tool', /google-structured-data-testing-tool/i],\n // https://www.webpagetest.org\n ['WebPageTest', 'seo_tool', /\\bptst\\/\\d/i],\n // https://www.dareboost.com\n ['DareBoost', 'seo_tool', /dareboost/i],\n // https://www.exensa.com/crawl\n ['Barkrowler', 'seo_tool', /barkrowler/i],\n // https://seranking.com/backlinks-crawler\n ['SE Ranking', 'seo_tool', /seranking|sebot-wa/i],\n // https://www.brightedge.com\n ['BrightEdge', 'seo_tool', /brightedge/i],\n // https://searchatlas.com\n ['SearchAtlas', 'seo_tool', /searchatlas/i],\n // https://www.siteimprove.com\n ['Siteimprove', 'seo_tool', /siteimprove/i],\n // https://www.dataprovider.com\n ['Dataprovider', 'seo_tool', /dataprovider\\.com/i],\n // https://www.meltwater.com\n ['Meltwater', 'seo_tool', /meltwater/i],\n // https://awario.com/bots.html\n ['Awario', 'seo_tool', /awario/i],\n\n // search engines\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['Googlebot', 'search_crawler', /googlebot/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['Storebot-Google', 'search_crawler', /storebot-google/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['GoogleOther', 'search_crawler', /googleother/i],\n // https://www.bing.com/webmasters/help/which-crawlers-does-bing-use-8c184ec0\n ['Bingbot', 'search_crawler', /bingbot/i],\n // https://support.apple.com/en-us/119829\n ['Applebot', 'search_crawler', /applebot/i],\n // https://www.baidu.com/search/spider.html\n ['Baiduspider', 'search_crawler', /baiduspider/i],\n // https://yandex.com/support/webmaster/robot-workings/check-yandex-robots.html\n ['YandexBot', 'search_crawler', /yandex(?:\\w*bot|images|metrika)/i],\n // https://duckduckgo.com/duckduckgo-help-pages/results/duckduckbot\n ['DuckDuckBot', 'search_crawler', /duckduckbot/i],\n // https://help.yahoo.com/kb/SLN22600.html\n ['Yahoo Slurp', 'search_crawler', /yahoo!?[\\s/]*slurp/i],\n // https://www.sogou.com/docs/help/webmasters.htm#07\n ['Sogou', 'search_crawler', /sogou[\\w\\s-]*spider/i],\n // https://www.so.com/help/help_3_2.html\n ['360Spider', 'search_crawler', /360spider|haosouspider/i],\n // https://knownagents.com/agents/yisouspider\n ['YisouSpider', 'search_crawler', /yisouspider/i],\n // https://webmaster.petalsearch.com/site/petalbot\n ['PetalBot', 'search_crawler', /petalbot/i],\n // https://napoveda.seznam.cz/en/seznambot-intro/\n ['SeznamBot', 'search_crawler', /seznambot/i],\n // https://knownagents.com/agents/yeti\n ['Yeti', 'search_crawler', /\\byeti\\//i],\n // https://help2.line.me/linesearchbot/web/?contentId=50006055&lang=en\n ['Linespider', 'search_crawler', /linespider/i],\n // https://help.qwant.com/bot/\n ['Qwantbot', 'search_crawler', /qwant(?:bot|ify)/i],\n // https://help.coccoc.com/searchengine\n ['coccocbot', 'search_crawler', /coccocbot/i],\n // https://www.mojeek.com/bot.html\n ['MojeekBot', 'search_crawler', /mojeekbot/i],\n // https://search.brave.com/help/brave-search-crawler\n ['Bravebot', 'search_crawler', /bravebot/i],\n // https://bot.seekport.com\n ['SeekportBot', 'search_crawler', /seekport/i],\n // https://mwmbl.org\n ['mwmbl', 'search_crawler', /mwmbl/i],\n // https://archive.org/details/archive.org_bot\n ['Internet Archive', 'search_crawler', /archive\\.org_bot|ia_archiver|archive-it|archiveteam/i],\n\n // monitoring, synthetics, security and consent scanners, service callers\n // https://www.pingdom.com\n ['Pingdom', 'monitoring', /pingdom/i],\n // https://uptimerobot.com\n ['UptimeRobot', 'monitoring', /uptimerobot/i],\n // https://www.statuscake.com\n ['StatusCake', 'monitoring', /statuscake/i],\n // https://www.site24x7.com\n ['Site24x7', 'monitoring', /site24x7/i],\n // https://betterstack.com/docs/uptime/\n ['Better Stack', 'monitoring', /better ?uptime|betterstack/i],\n // https://docs.datadoghq.com/synthetics/\n ['Datadog', 'monitoring', /datadog/i],\n // https://www.checklyhq.com/docs/\n ['Checkly', 'monitoring', /checkly/i],\n // https://docs.newrelic.com/docs/synthetics/\n ['NewRelicPinger', 'monitoring', /newrelicpinger/i],\n // https://github.com/louislam/uptime-kuma\n ['Uptime-Kuma', 'monitoring', /uptime-kuma/i],\n // https://grafana.com/docs/grafana-cloud/testing/synthetic-monitoring/\n ['Grafana Synthetic Monitoring', 'monitoring', /grafanasyntheticmonitoring/i],\n // https://docs.dynatrace.com/docs/observe/digital-experience/synthetic-monitoring\n ['Dynatrace', 'monitoring', /ruxitsynthetic|dynatrace/i],\n // https://docs.splunk.com/observability/en/synthetics/intro-synthetics.html\n ['Splunk', 'monitoring', /splunk/i],\n // https://www.catchpoint.com\n ['Catchpoint', 'monitoring', /catchpoint/i],\n // https://ghostinspector.com\n ['Ghost Inspector', 'monitoring', /ghost inspector/i],\n // https://docs.digitalocean.com/products/uptime/\n ['DigitalOcean Uptime', 'monitoring', /digitalocean uptime/i],\n // https://ohdear.app/docs/faq/what-is-the-oh-dear-checker\n ['OhDear', 'monitoring', /ohdear/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-special-case-crawlers\n ['Google-Safety', 'monitoring', /google-safety/i],\n // https://www.cookiebot.com\n ['Cookiebot', 'monitoring', /cookiebot/i],\n // https://knownagents.com/agents/onetrust-cmp-scanner\n ['OneTrust', 'monitoring', /onetrust/i],\n // https://www.cookiehub.com\n ['CookieHub', 'monitoring', /cookiehub/i],\n // https://detectify.com/bot/\n ['Detectify', 'monitoring', /detectify/i],\n // https://about.censys.io\n ['CensysInspect', 'monitoring', /censysinspect/i],\n // https://www.bitsight.com\n ['BitSightBot', 'monitoring', /bitsightbot/i],\n // https://github.com/zmap/zgrab2\n ['zgrab', 'monitoring', /zgrab/i],\n // https://nmap.org/book/nse.html\n ['Nmap', 'monitoring', /nmap scripting engine/i],\n // https://docs.stripe.com/webhooks\n ['Stripe', 'monitoring', /stripe\\/1\\.0|stripebot|merchantsecurityscanner/i],\n\n // scripted browsers\n // https://developer.chrome.com/docs/chromium/headless\n ['HeadlessChrome', 'headless_browser', /headlesschrome/i],\n // https://phantomjs.org\n ['PhantomJS', 'headless_browser', /phantomjs/i],\n // https://slimerjs.org\n ['SlimerJS', 'headless_browser', /slimerjs/i],\n // https://playwright.dev\n ['Playwright', 'headless_browser', /playwright/i],\n // https://pptr.dev\n ['Puppeteer', 'headless_browser', /puppeteer/i],\n // https://www.selenium.dev\n ['Selenium', 'headless_browser', /selenium/i],\n // https://www.cypress.io\n ['Cypress', 'headless_browser', /cypress/i],\n // https://lightpanda.io\n ['Lightpanda', 'headless_browser', /lightpanda/i],\n // https://wkhtmltopdf.org\n ['wkhtmltopdf', 'headless_browser', /wkhtmltopdf/i],\n\n // libraries and command-line clients\n // https://curl.se\n ['curl', 'http_client', /^curl\\//i],\n // https://www.gnu.org/software/wget/\n ['Wget', 'http_client', /^wget\\//i],\n // https://requests.readthedocs.io\n ['python-requests', 'http_client', /python-requests/i],\n // https://docs.python.org/3/library/urllib.request.html\n ['python-urllib', 'http_client', /python-urllib/i],\n // https://docs.aiohttp.org\n ['aiohttp', 'http_client', /aiohttp/i],\n // https://www.python-httpx.org\n ['httpx', 'http_client', /python-httpx|^httpx\\//i],\n // https://scrapy.org\n ['Scrapy', 'http_client', /scrapy/i],\n // https://pkg.go.dev/net/http\n ['Go-http-client', 'http_client', /go-http-client/i],\n // https://github.com/square/okhttp\n ['okhttp', 'http_client', /^okhttp\\//i],\n // https://hc.apache.org/httpcomponents-client-5.5.x/\n ['Java', 'http_client', /^java\\/|apache-httpclient/i],\n // https://axios-http.com\n ['axios', 'http_client', /^axios\\//i],\n // https://github.com/node-fetch/node-fetch\n ['node-fetch', 'http_client', /node-fetch/i],\n // https://undici.nodejs.org\n ['undici', 'http_client', /^undici/i],\n // https://www.postman.com\n ['PostmanRuntime', 'http_client', /postmanruntime/i],\n // https://insomnia.rest\n ['insomnia', 'http_client', /^insomnia\\//i],\n // https://metacpan.org/pod/LWP\n ['libwww-perl', 'http_client', /libwww-perl/i],\n // https://docs.guzzlephp.org\n ['Guzzle', 'http_client', /guzzlehttp/i],\n // https://developers.google.com/apps-script/reference/url-fetch\n ['Google-Apps-Script', 'http_client', /google-apps-script/i],\n // https://support.google.com/docs/answer/3093339\n ['GoogleDocs', 'http_client', /googledocs/i],\n] as const satisfies readonly (readonly [string, BotCategory, RegExp])[];\n\nconst botishToken =\n /\\b([\\w.-]*?(?:bot|crawler|spider|scraper|fetcher|agent|preview|checker|monitor)[\\w-]*)\\b/i;\nconst botishWord = /^(?:bot|crawler|spider|scraper|fetcher|agent|preview|checker|monitor)$/i;\nconst compatibleToken = /compatible;\\s*([a-z][\\w.-]*(?: [a-z][\\w.-]*)?)/i;\nconst productTokens = /([a-z][\\w.-]*)\\/\\d/gi;\nconst browserToken =\n /^(?:mozilla|applewebkit|khtml|gecko|chrome|chromium|safari|version|mobile|firefox|edg|edge|opr|msie|trident)$/i;\n\n/**\n * A name for a bot that is not in the named table, from the first of: a token that sounds like\n * one (`Bytespider`, `ABEvalBot`), the name after `compatible;` (`Google-Read-Aloud`), a product\n * token that is not a browser's (`Barkrowler/0.5`), what the generic pattern matched. URLs and\n * email addresses are dropped first, as nearly every crawler links its docs.\n */\nexport function nameOfUnknownBot(userAgent: string, matched: string): string {\n const text = userAgent\n .replace(/\\+?https?:\\/\\/\\S+/gi, ' ')\n .replace(/[\\w.+-]+@[\\w-]+(?:\\.[\\w-]+)+/g, ' ');\n\n const botish = botishToken.exec(text)?.[1];\n if (botish && !botishWord.test(botish)) return botish.slice(0, 64);\n\n const compatible = compatibleToken.exec(text)?.[1];\n if (compatible && !browserToken.test(compatible)) return compatible.slice(0, 64);\n\n for (const [, product] of text.matchAll(productTokens)) {\n if (!browserToken.test(product)) return product.slice(0, 64);\n }\n\n return matched.replace(/^\\W+|\\W+$/g, '').slice(0, 64) || 'unknown';\n}\n\n/**\n * The request user agent of a page opened in Facebook's or Instagram's in-app browser when the\n * app sends the page's requests through its own network stack: `[FBAN/FB4A;FBAV/…]`,\n * `Instagram 445.0.0.34.44 (iPhone18,1; iOS 26_6_1; …) AppleWebKit/420+`. The page itself still\n * reads a browser's `navigator.userAgent`, which is why PostHog, GA4 and Matomo see a person.\n * isbot's generic pattern takes both for bots (a long token with no space, a product token that is\n * no browser's), so they are people here before it runs. Meta's ad prefetch loads only the HTML,\n * which runs no script and creates no visitor. The in-app browser's own user agent starts with\n * `Mozilla/5.0`, so the anchors leave it alone.\n */\nconst META_APP = /^\\[FBAN\\/|^Instagram \\d+(?:\\.\\d+)+ \\(/;\n\n/**\n * Whether a web visitor is a bot, which one, and what kind. Run on the server when the visitor\n * is created, with the tags it was created with: the user agent is the request's header\n * (`tags.user_agent`, which the server writes), not anything the client says about itself, so\n * the verdict can be recomputed from stored tags when the rules change.\n *\n * Call it for web visitors only: a native app's requests carry an HTTP library's user agent\n * (CFNetwork, okhttp) that would read as a bot, and no crawler runs the app.\n *\n * In order: a bot we can name; a browser driven by WebDriver (`tags.webdriver`, which the SDK\n * sets from `navigator.webdriver`, the one sign a scripted browser with a normal user agent\n * gives); a person in a Meta app (`META_APP`); anything the generic pattern calls automated; no\n * user agent at all.\n */\nexport function botOf(tags: TrackTags): Bot {\n const userAgent = typeof tags.user_agent === 'string' ? tags.user_agent.trim() : '';\n\n for (const [name, category, pattern] of NAMED_BOTS) {\n if (pattern.test(userAgent)) return { is_bot: true, bot_name: name, bot_category: category };\n }\n\n const generic = userAgent ? GENERIC_BOT.exec(userAgent) : null;\n const unknownName = generic ? nameOfUnknownBot(userAgent, generic[0]) : null;\n\n // A scripted browser that says so in its user agent takes that name, else it is just WebDriver.\n if (tags.webdriver === true) {\n return { is_bot: true, bot_name: unknownName ?? 'WebDriver', bot_category: 'headless_browser' };\n }\n\n if (META_APP.test(userAgent)) return NOT_A_BOT;\n\n if (unknownName) return { is_bot: true, bot_name: unknownName, bot_category: 'other' };\n\n if (!userAgent)\n return { is_bot: true, bot_name: '(no user agent)', bot_category: 'no_user_agent' };\n\n return NOT_A_BOT;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAYA,MAAa,YAAiB;CAAE,QAAQ;CAAO,UAAU;CAAM,cAAc;AAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BlF,MAAa,aAAa;CAGxB;EAAC;EAAoB;EAAe;CAAmB;CAEvD;EAAC;EAAmB;EAAe;CAAkB;CAErD;EAAC;EAAiB;EAAe;CAAgB;CAEjD;EAAC;EAAwB;EAAe;CAAuB;CAE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AK,eAAe,WAAW,KAAK,WAAW,KAAK,IAAI;CAEjF,KAAK,MAAM,CAAC,MAAM,UAAU,YAAY,YACtC,IAAI,QAAQ,KAAK,SAAS,GAAG,OAAO;EAAE,QAAQ;EAAM,UAAU;EAAM,cAAc;CAAS;CAG7F,MAAM,UAAU,YAAYA,oBAAAA,YAAY,KAAK,SAAS,IAAI;CAC1D,MAAM,cAAc,UAAU,iBAAiB,WAAW,QAAQ,EAAE,IAAI;CAGxE,IAAI,KAAK,cAAc,MACrB,OAAO;EAAE,QAAQ;EAAM,UAAU,eAAe;EAAa,cAAc;CAAmB;CAGhG,IAAI,SAAS,KAAK,SAAS,GAAG,OAAO;CAErC,IAAI,aAAa,OAAO;EAAE,QAAQ;EAAM,UAAU;EAAa,cAAc;CAAQ;CAErF,IAAI,CAAC,WACH,OAAO;EAAE,QAAQ;EAAM,UAAU;EAAmB,cAAc;CAAgB;CAEpF,OAAO;AACT"}
1
+ {"version":3,"file":"index.cjs","names":["genericBot"],"sources":["../../src/bot/index.ts"],"sourcesContent":["import type { TrackTags } from '../track/types';\nimport { genericBot } from './generic';\n\n/**\n * What kind of automated visitor a bot is, as the analytics tools that report bots separately\n * group them (PostHog's traffic categories, Cloudflare's verified bot categories, Matomo's\n * DeviceDetector). Stored next to the name so dashboards can group without re-deriving:\n *\n * - search_crawler: indexes pages for a search engine (Googlebot, Bingbot, Baiduspider)\n * - ai_crawler: collects content to train models (GPTBot, ClaudeBot, Meta-ExternalAgent)\n * - ai_search: indexes pages for an AI search product (OAI-SearchBot, PerplexityBot)\n * - ai_assistant: fetches a page because a person asked an assistant to (ChatGPT-User)\n * - advertising: works for an ad system — reviews landing pages, targets or verifies ads\n * (Meta-ExternalAds, AdsBot-Google, Mediapartners-Google)\n * - link_preview: renders the card of a link shared in a feed or a chat (facebookexternalhit)\n * - seo_tool: SEO, marketing and page-speed tools (AhrefsBot, Lighthouse, HubSpot)\n * - monitoring: uptime checks, synthetics and service callers (Pingdom, Stripe)\n * - headless_browser: a scripted browser (HeadlessChrome, Playwright, a WebDriver session)\n * - http_client: a library or command-line client (curl, python-requests)\n * - no_user_agent: a request without a user agent, which no browser sends\n * - other: automated by every sign, but none of the above\n */\nexport const BOT_CATEGORIES = [\n 'search_crawler',\n 'ai_crawler',\n 'ai_search',\n 'ai_assistant',\n 'advertising',\n 'link_preview',\n 'seo_tool',\n 'monitoring',\n 'headless_browser',\n 'http_client',\n 'no_user_agent',\n 'other',\n] as const;\n\nexport type BotCategory = (typeof BOT_CATEGORIES)[number];\n\n/**\n * The verdict, shaped like the columns a product stores it in (`is_bot`, `bot_name`,\n * `bot_category`). A person is `{ is_bot: false, bot_name: null, bot_category: null }`.\n */\nexport type Bot =\n | { is_bot: true; bot_name: string; bot_category: BotCategory }\n | { is_bot: false; bot_name: null; bot_category: null };\n\nexport const NOT_A_BOT: Bot = { is_bot: false, bot_name: null, bot_category: null };\n\n/**\n * Bots we can name, as `[name, category, pattern]`, tried in order; the first match wins.\n *\n * Where the list comes from (checked 2026-09-30):\n * - bowser's bot parsers (the ~25 named bots its `platform.type === 'bot'` reports), which this\n * replaces.\n * - PostHog's `bot_definitions.py` (web analytics traffic classification), for the bots and\n * categories an analytics product sees most.\n * - ai.robots.txt (`robots.json`), for AI crawlers, search bots, assistants and agents.\n * - The operators' own docs for the big ones: Google's crawler list, OpenAI's and Anthropic's\n * bot pages, Meta's web crawlers, Perplexity, Bing, Apple.\n * - Bots seen in production (Meta-ExternalAds, HubSpot, Bytespider).\n * Every entry was run against the real user agents in crawler-user-agents and PostHog's\n * fixtures, and bowser's browser fixtures were run to check no browser is taken for a bot\n * (Sogou's browser against its spider, Pinterest's in-app browser against its bot); see\n * `index.test.ts` for where to get them.\n *\n * The link above each entry is the operator's page about the bot, else its product page, else\n * its Known Agents profile (knownagents.com, formerly Dark Visitors) when the operator has none.\n *\n * Names are the operators' spelling of their user agent token. Order matters where one token\n * contains another or borrows a name: advertising and SEO tools come before the search engines\n * whose names they carry, and the more specific of Meta's, Anthropic's and Perplexity's tokens\n * come first. The long tail is left to the generic pattern, filed as `other` and named by\n * `nameOfUnknownBot`; add a bot here when it is worth its own category or name in a dashboard.\n */\nexport const NAMED_BOTS = [\n // advertising: before the search crawlers, AdsBot and Mediapartners carry Google's name\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['Meta-ExternalAds', 'advertising', /meta-externalads/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['facebookcatalog', 'advertising', /facebookcatalog/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-special-case-crawlers\n ['AdsBot-Google', 'advertising', /adsbot-google/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-special-case-crawlers\n ['Mediapartners-Google', 'advertising', /mediapartners-google/i],\n // https://www.bing.com/webmasters/help/which-crawlers-does-bing-use-8c184ec0\n ['AdIdxBot', 'advertising', /adidxbot/i],\n // https://support.google.com/adwords/answer/2404197\n ['Google-AdWords', 'advertising', /google-adwords/i],\n // https://support.google.com/google-ads/answer/6095821\n ['Google-Ads-Conversions', 'advertising', /google-ads-conversions/i],\n // https://developers.openai.com/api/docs/bots\n ['OAI-AdsBot', 'advertising', /oai-adsbot/i],\n // https://businesshelp.snapchat.com/s/article/adsbot-crawler\n ['SnapchatAds', 'advertising', /snapchatads/i],\n // https://www.taboola.com\n ['Taboolabot', 'advertising', /taboolabot/i],\n\n // AI assistants and agents: a person asked for this page\n // https://developers.openai.com/api/docs/bots\n ['ChatGPT-User', 'ai_assistant', /chatgpt-user/i],\n // https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler\n ['Claude-User', 'ai_assistant', /claude-user/i],\n // https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler\n ['Claude-Web', 'ai_assistant', /claude-web/i],\n // https://docs.perplexity.ai/guides/bots\n ['Perplexity-User', 'ai_assistant', /perplexity-user/i],\n // https://duckduckgo.com/duckduckgo-help-pages/results/duckassistbot\n ['DuckAssistBot', 'ai_assistant', /duckassistbot/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['Meta-ExternalFetcher', 'ai_assistant', /meta-externalfetcher/i],\n // https://docs.mistral.ai/robots\n ['MistralAI-User', 'ai_assistant', /mistralai-user/i],\n // https://knownagents.com/agents/manus-user\n ['Manus-User', 'ai_assistant', /manus-user/i],\n // https://knownagents.com/agents/shap-user\n ['Shap-User', 'ai_assistant', /shap-user/i],\n // https://quillbot.com\n ['QuillBot', 'ai_assistant', /quillbot/i],\n // https://developer.amazon.com/amazonbot\n ['Amzn-User', 'ai_assistant', /amzn-user/i],\n // https://knownagents.com/agents/amazon-qbusiness\n ['amazon-QBusiness', 'ai_assistant', /amazon-qbusiness/i],\n // https://docs.aws.amazon.com/bedrock-agentcore/\n ['Amazon-Bedrock-AgentCore-Browser', 'ai_assistant', /amazon-bedrock-agentcore/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-user-triggered-fetchers\n ['Google-Agent', 'ai_assistant', /google-?agent/i],\n // https://gemini.google/overview/deep-research/\n ['Gemini-Deep-Research', 'ai_assistant', /gemini-deep-research/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-user-triggered-fetchers\n ['Google-NotebookLM', 'ai_assistant', /google-notebooklm/i],\n // https://www.kimi.ai/policies/kimi-crawlers\n ['Kimi-User', 'ai_assistant', /kimi-(?:user|agent)/i],\n // https://knownagents.com/agents/tongyibot\n ['TongyiBot', 'ai_assistant', /tongyibot/i],\n // https://knownagents.com/agents/yiyanbot\n ['YiyanBot', 'ai_assistant', /yiyanbot/i],\n // https://help.kagi.com/kagi/ai/kagi-ai.html\n ['kagi-fetcher', 'ai_assistant', /kagi-fetcher/i],\n // https://devin.ai\n ['Devin', 'ai_assistant', /\\bdevin\\/\\d/i],\n // https://knownagents.com/agents/novaact\n ['NovaAct', 'ai_assistant', /novaact/i],\n\n // AI search\n // https://developers.openai.com/api/docs/bots\n ['OAI-SearchBot', 'ai_search', /oai-searchbot/i],\n // https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler\n ['Claude-SearchBot', 'ai_search', /claude-searchbot/i],\n // https://docs.perplexity.ai/guides/bots\n ['PerplexityBot', 'ai_search', /perplexitybot/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['Meta-WebIndexer', 'ai_search', /meta-webindexer/i],\n // https://developer.amazon.com/amazonbot\n ['Amazonbot', 'ai_search', /amazonbot/i],\n // https://knownagents.com/agents/youbot\n ['YouBot', 'ai_search', /youbot/i],\n // https://knownagents.com/agents/phindbot\n ['PhindBot', 'ai_search', /phindbot/i],\n // https://developer.amazon.com/amazonbot\n ['Amzn-SearchBot', 'ai_search', /amzn-searchbot/i],\n // https://knownagents.com/agents/azureai-searchbot\n ['AzureAI-SearchBot', 'ai_search', /azureai-searchbot/i],\n // https://www.kimi.ai/policies/kimi-crawlers\n ['Kimi-SearchBot', 'ai_search', /kimi-searchbot/i],\n // https://docs.mistral.ai/robots\n ['MistralAI-Index', 'ai_search', /mistralai-index/i],\n // https://knownagents.com/agents/exasearchbot\n ['ExaSearchBot', 'ai_search', /exasearchbot|\\bexabot/i],\n // https://knownagents.com/agents/tavilybot\n ['TavilyBot', 'ai_search', /tavilybot/i],\n // https://linkup.so/bot\n ['LinkupBot', 'ai_search', /linkupbot/i],\n // https://knownagents.com/agents/iaskspider\n ['iAskBot', 'ai_search', /iask(?:bot|spider)/i],\n ['Andibot', 'ai_search', /andibot/i],\n // https://developers.cloudflare.com/autorag\n ['Cloudflare-AutoRAG', 'ai_search', /cloudflare-autorag/i],\n // https://docs.parallel.ai/resources/crawler\n ['ShapBot', 'ai_search', /shapbot/i],\n\n // AI training\n // https://developers.openai.com/api/docs/bots\n ['GPTBot', 'ai_crawler', /gptbot/i],\n // https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler\n ['ClaudeBot', 'ai_crawler', /claudebot/i],\n // https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler\n ['anthropic-ai', 'ai_crawler', /anthropic-ai/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['Meta-ExternalAgent', 'ai_crawler', /meta-externalagent/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['FacebookBot', 'ai_crawler', /facebookbot/i],\n // https://knownagents.com/agents/bytespider\n ['Bytespider', 'ai_crawler', /bytespider/i],\n // https://commoncrawl.org/ccbot\n ['CCBot', 'ai_crawler', /ccbot/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['Google-CloudVertexBot', 'ai_crawler', /google-cloudvertexbot/i],\n // https://knownagents.com/agents/cohere-training-data-crawler\n ['cohere-ai', 'ai_crawler', /cohere-(?:ai|training-data-crawler)/i],\n // https://www.diffbot.com/docs/crawl/faq/robots-txt\n ['Diffbot', 'ai_crawler', /diffbot/i],\n // https://knownagents.com/agents/webzio-extended\n ['Omgili', 'ai_crawler', /omgili|webzio-extended/i],\n // https://imagesift.com/about\n ['ImagesiftBot', 'ai_crawler', /imagesiftbot/i],\n // https://www.timpi.io\n ['Timpibot', 'ai_crawler', /timpibot/i],\n // https://knownagents.com/agents/ai2bot\n ['AI2Bot', 'ai_crawler', /ai2bot/i],\n // https://knownagents.com/agents/pangubot\n ['PanguBot', 'ai_crawler', /pangubot/i],\n // https://knownagents.com/agents/promptingbot\n ['PromptingBot', 'ai_crawler', /promptingbot/i],\n // https://knownagents.com/agents/reflectionbot\n ['Reflectionbot', 'ai_crawler', /reflectionbot/i],\n // https://knownagents.com/agents/tiktokspider\n ['TikTokSpider', 'ai_crawler', /tiktokspider/i],\n // https://knownagents.com/agents/deepseekbot\n ['DeepSeekBot', 'ai_crawler', /deepseekbot/i],\n // https://knownagents.com/agents/doubaobot\n ['DoubaoBot', 'ai_crawler', /doubaobot/i],\n // https://knownagents.com/agents/erniebot\n ['ERNIEBot', 'ai_crawler', /erniebot/i],\n // https://knownagents.com/agents/qwenbot\n ['QwenBot', 'ai_crawler', /qwenbot/i],\n // https://www.kimi.ai/policies/kimi-crawlers\n ['KimiBot', 'ai_crawler', /kimibot/i],\n // https://knownagents.com/agents/chatglm-spider\n ['ChatGLM-Spider', 'ai_crawler', /chatglm-spider/i],\n // https://docs.mistral.ai/robots\n ['MistralAI-Training', 'ai_crawler', /mistralai-training/i],\n // https://knownagents.com/agents/yandexadditional\n ['YandexAdditional', 'ai_crawler', /yandexadditional/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['Google-Extended', 'ai_crawler', /google-extended/i],\n // https://docs.aws.amazon.com/kendra/latest/dg/what-is-kendra.html\n ['Amazon Kendra', 'ai_crawler', /amazon-kendra|kendrabot/i],\n // https://knownagents.com/agents/bedrockbot\n ['bedrockbot', 'ai_crawler', /bedrockbot/i],\n // https://brightdata.com/brightbot\n ['Brightbot', 'ai_crawler', /brightbot/i],\n // https://firecrawl.dev\n ['FirecrawlAgent', 'ai_crawler', /firecrawl/i],\n // https://github.com/unclecode/crawl4ai\n ['Crawl4AI', 'ai_crawler', /crawl4ai/i],\n // https://apify.com/apify/website-content-crawler\n ['ApifyBot', 'ai_crawler', /apify/i],\n // https://github.com/rom1504/img2dataset\n ['img2dataset', 'ai_crawler', /img2dataset/i],\n // https://knownagents.com/agents/laion-huggingface-processor\n ['LAION', 'ai_crawler', /laion/i],\n // https://developers.cloudflare.com/browser-rendering/\n ['Cloudflare Browser Rendering', 'ai_crawler', /cloudflarebrowserrendering/i],\n\n // link previews\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['facebookexternalhit', 'link_preview', /facebookexternalhit/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['Facebot', 'link_preview', /facebot/i],\n // https://developer.x.com/en/docs/x-for-websites/cards/guides/getting-started\n ['Twitterbot', 'link_preview', /twitterbot/i],\n // https://www.linkedin.com/help/linkedin/answer/a521928\n ['LinkedInBot', 'link_preview', /linkedinbot/i],\n // https://api.slack.com/robots\n ['Slackbot', 'link_preview', /slackbot|slack-imgproxy/i],\n // https://discord.com\n ['Discordbot', 'link_preview', /discordbot/i],\n // https://core.telegram.org/bots\n ['TelegramBot', 'link_preview', /telegrambot/i],\n // https://www.whatsapp.com\n ['WhatsApp', 'link_preview', /^whatsapp\\//i],\n // https://www.pinterest.com/bot.html\n ['Pinterestbot', 'link_preview', /pinterestbot|^pinterest\\/0\\./i],\n // https://www.reddit.com\n ['redditbot', 'link_preview', /redditbot/i],\n // https://developers.snap.com/robots\n ['Snap URL Preview', 'link_preview', /snap url preview/i],\n // https://knownagents.com/agents/skypeuripreview\n ['SkypeUriPreview', 'link_preview', /skypeuripreview/i],\n // https://www.bing.com/webmasters/help/which-crawlers-does-bing-use-8c184ec0\n ['BingPreview', 'link_preview', /bingpreview|microsoftpreview/i],\n // https://iframely.com/docs/about\n ['Iframely', 'link_preview', /iframely/i],\n // https://embed.ly\n ['Embedly', 'link_preview', /embedly/i],\n // https://devtalk.kakao.com/t/scrap/33984\n ['KakaoTalk-scrap', 'link_preview', /kakaotalk-scrap/i],\n // https://vk.com/dev/Share\n ['vkShare', 'link_preview', /vkshare/i],\n // https://www.viber.com\n ['Viber', 'link_preview', /^viber\\b|viber-crawler/i],\n // https://github.com/bluesky-social/indigo\n ['Bluesky Cardyb', 'link_preview', /cardyb/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-user-triggered-fetchers\n ['Google-PageRenderer', 'link_preview', /google-pagerenderer/i],\n // https://vercel.com\n ['vercel-screenshot', 'link_preview', /vercel-screenshot/i],\n\n // SEO, marketing and page-speed tools; before the search crawlers, Lighthouse and the\n // Search Console tester borrow Google's name\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['Google-InspectionTool', 'seo_tool', /google-inspectiontool/i],\n // https://developer.chrome.com/docs/lighthouse\n ['Lighthouse', 'seo_tool', /chrome-lighthouse|google page speed insights/i],\n // https://gtmetrix.com\n ['GTmetrix', 'seo_tool', /gtmetrix/i],\n // https://ahrefs.com/robot\n ['AhrefsBot', 'seo_tool', /ahrefs(?:bot|siteaudit)/i],\n // https://www.semrush.com/bot/\n ['SemrushBot', 'seo_tool', /semrush/i],\n // https://mj12bot.com\n ['MJ12bot', 'seo_tool', /mj12bot/i],\n // https://moz.com/help/moz-procedures/crawlers/dotbot\n ['DotBot', 'seo_tool', /dotbot/i],\n // https://moz.com/help/moz-procedures/crawlers/rogerbot\n ['rogerbot', 'seo_tool', /rogerbot/i],\n // https://www.screamingfrog.co.uk/seo-spider/\n ['Screaming Frog', 'seo_tool', /screaming frog/i],\n // https://serpstatbot.com\n ['SerpstatBot', 'seo_tool', /serpstatbot/i],\n // https://webmeup-crawler.com\n ['BLEXBot', 'seo_tool', /blexbot/i],\n // https://dataforseo.com/dataforseo-bot\n ['DataForSeoBot', 'seo_tool', /dataforseobot/i],\n // https://knownagents.com/agents/hubspot-crawler\n ['HubSpot', 'seo_tool', /hubspot/i],\n // https://search.google.com/structured-data/testing-tool\n ['Google-Structured-Data-Testing-Tool', 'seo_tool', /google-structured-data-testing-tool/i],\n // https://www.webpagetest.org\n ['WebPageTest', 'seo_tool', /\\bptst\\/\\d/i],\n // https://www.dareboost.com\n ['DareBoost', 'seo_tool', /dareboost/i],\n // https://www.exensa.com/crawl\n ['Barkrowler', 'seo_tool', /barkrowler/i],\n // https://seranking.com/backlinks-crawler\n ['SE Ranking', 'seo_tool', /seranking|sebot-wa/i],\n // https://www.brightedge.com\n ['BrightEdge', 'seo_tool', /brightedge/i],\n // https://searchatlas.com\n ['SearchAtlas', 'seo_tool', /searchatlas/i],\n // https://www.siteimprove.com\n ['Siteimprove', 'seo_tool', /siteimprove/i],\n // https://www.dataprovider.com\n ['Dataprovider', 'seo_tool', /dataprovider\\.com/i],\n // https://www.meltwater.com\n ['Meltwater', 'seo_tool', /meltwater/i],\n // https://awario.com/bots.html\n ['Awario', 'seo_tool', /awario/i],\n\n // search engines\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['Googlebot', 'search_crawler', /googlebot/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['Storebot-Google', 'search_crawler', /storebot-google/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['GoogleOther', 'search_crawler', /googleother/i],\n // https://www.bing.com/webmasters/help/which-crawlers-does-bing-use-8c184ec0\n ['Bingbot', 'search_crawler', /bingbot/i],\n // https://support.apple.com/en-us/119829\n ['Applebot', 'search_crawler', /applebot/i],\n // https://www.baidu.com/search/spider.html\n ['Baiduspider', 'search_crawler', /baiduspider/i],\n // https://yandex.com/support/webmaster/robot-workings/check-yandex-robots.html\n ['YandexBot', 'search_crawler', /yandex(?:\\w*bot|images|metrika)/i],\n // https://duckduckgo.com/duckduckgo-help-pages/results/duckduckbot\n ['DuckDuckBot', 'search_crawler', /duckduckbot/i],\n // https://help.yahoo.com/kb/SLN22600.html\n ['Yahoo Slurp', 'search_crawler', /yahoo!?[\\s/]*slurp/i],\n // https://www.sogou.com/docs/help/webmasters.htm#07\n ['Sogou', 'search_crawler', /sogou[\\w\\s-]*spider/i],\n // https://www.so.com/help/help_3_2.html\n ['360Spider', 'search_crawler', /360spider|haosouspider/i],\n // https://knownagents.com/agents/yisouspider\n ['YisouSpider', 'search_crawler', /yisouspider/i],\n // https://webmaster.petalsearch.com/site/petalbot\n ['PetalBot', 'search_crawler', /petalbot/i],\n // https://napoveda.seznam.cz/en/seznambot-intro/\n ['SeznamBot', 'search_crawler', /seznambot/i],\n // https://knownagents.com/agents/yeti\n ['Yeti', 'search_crawler', /\\byeti\\//i],\n // https://help2.line.me/linesearchbot/web/?contentId=50006055&lang=en\n ['Linespider', 'search_crawler', /linespider/i],\n // https://help.qwant.com/bot/\n ['Qwantbot', 'search_crawler', /qwant(?:bot|ify)/i],\n // https://help.coccoc.com/searchengine\n ['coccocbot', 'search_crawler', /coccocbot/i],\n // https://www.mojeek.com/bot.html\n ['MojeekBot', 'search_crawler', /mojeekbot/i],\n // https://search.brave.com/help/brave-search-crawler\n ['Bravebot', 'search_crawler', /bravebot/i],\n // https://bot.seekport.com\n ['SeekportBot', 'search_crawler', /seekport/i],\n // https://mwmbl.org\n ['mwmbl', 'search_crawler', /mwmbl/i],\n // https://archive.org/details/archive.org_bot\n ['Internet Archive', 'search_crawler', /archive\\.org_bot|ia_archiver|archive-it|archiveteam/i],\n\n // monitoring, synthetics, security and consent scanners, service callers\n // https://www.pingdom.com\n ['Pingdom', 'monitoring', /pingdom/i],\n // https://uptimerobot.com\n ['UptimeRobot', 'monitoring', /uptimerobot/i],\n // https://www.statuscake.com\n ['StatusCake', 'monitoring', /statuscake/i],\n // https://www.site24x7.com\n ['Site24x7', 'monitoring', /site24x7/i],\n // https://betterstack.com/docs/uptime/\n ['Better Stack', 'monitoring', /better ?uptime|betterstack/i],\n // https://docs.datadoghq.com/synthetics/\n ['Datadog', 'monitoring', /datadog/i],\n // https://www.checklyhq.com/docs/\n ['Checkly', 'monitoring', /checkly/i],\n // https://docs.newrelic.com/docs/synthetics/\n ['NewRelicPinger', 'monitoring', /newrelicpinger/i],\n // https://github.com/louislam/uptime-kuma\n ['Uptime-Kuma', 'monitoring', /uptime-kuma/i],\n // https://grafana.com/docs/grafana-cloud/testing/synthetic-monitoring/\n ['Grafana Synthetic Monitoring', 'monitoring', /grafanasyntheticmonitoring/i],\n // https://docs.dynatrace.com/docs/observe/digital-experience/synthetic-monitoring\n ['Dynatrace', 'monitoring', /ruxitsynthetic|dynatrace/i],\n // https://docs.splunk.com/observability/en/synthetics/intro-synthetics.html\n ['Splunk', 'monitoring', /splunk/i],\n // https://www.catchpoint.com\n ['Catchpoint', 'monitoring', /catchpoint/i],\n // https://ghostinspector.com\n ['Ghost Inspector', 'monitoring', /ghost inspector/i],\n // https://docs.digitalocean.com/products/uptime/\n ['DigitalOcean Uptime', 'monitoring', /digitalocean uptime/i],\n // https://ohdear.app/docs/faq/what-is-the-oh-dear-checker\n ['OhDear', 'monitoring', /ohdear/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-special-case-crawlers\n ['Google-Safety', 'monitoring', /google-safety/i],\n // https://www.cookiebot.com\n ['Cookiebot', 'monitoring', /cookiebot/i],\n // https://knownagents.com/agents/onetrust-cmp-scanner\n ['OneTrust', 'monitoring', /onetrust/i],\n // https://www.cookiehub.com\n ['CookieHub', 'monitoring', /cookiehub/i],\n // https://detectify.com/bot/\n ['Detectify', 'monitoring', /detectify/i],\n // https://about.censys.io\n ['CensysInspect', 'monitoring', /censysinspect/i],\n // https://www.bitsight.com\n ['BitSightBot', 'monitoring', /bitsightbot/i],\n // https://github.com/zmap/zgrab2\n ['zgrab', 'monitoring', /zgrab/i],\n // https://nmap.org/book/nse.html\n ['Nmap', 'monitoring', /nmap scripting engine/i],\n // https://docs.stripe.com/webhooks\n ['Stripe', 'monitoring', /stripe\\/1\\.0|stripebot|merchantsecurityscanner/i],\n\n // scripted browsers\n // https://developer.chrome.com/docs/chromium/headless\n ['HeadlessChrome', 'headless_browser', /headlesschrome/i],\n // https://phantomjs.org\n ['PhantomJS', 'headless_browser', /phantomjs/i],\n // https://slimerjs.org\n ['SlimerJS', 'headless_browser', /slimerjs/i],\n // https://playwright.dev\n ['Playwright', 'headless_browser', /playwright/i],\n // https://pptr.dev\n ['Puppeteer', 'headless_browser', /puppeteer/i],\n // https://www.selenium.dev\n ['Selenium', 'headless_browser', /selenium/i],\n // https://www.cypress.io\n ['Cypress', 'headless_browser', /cypress/i],\n // https://lightpanda.io\n ['Lightpanda', 'headless_browser', /lightpanda/i],\n // https://wkhtmltopdf.org\n ['wkhtmltopdf', 'headless_browser', /wkhtmltopdf/i],\n\n // libraries and command-line clients\n // https://curl.se\n ['curl', 'http_client', /^curl\\//i],\n // https://www.gnu.org/software/wget/\n ['Wget', 'http_client', /^wget\\//i],\n // https://requests.readthedocs.io\n ['python-requests', 'http_client', /python-requests/i],\n // https://docs.python.org/3/library/urllib.request.html\n ['python-urllib', 'http_client', /python-urllib/i],\n // https://docs.aiohttp.org\n ['aiohttp', 'http_client', /aiohttp/i],\n // https://www.python-httpx.org\n ['httpx', 'http_client', /python-httpx|^httpx\\//i],\n // https://scrapy.org\n ['Scrapy', 'http_client', /scrapy/i],\n // https://pkg.go.dev/net/http\n ['Go-http-client', 'http_client', /go-http-client/i],\n // https://github.com/square/okhttp\n ['okhttp', 'http_client', /^okhttp\\//i],\n // https://hc.apache.org/httpcomponents-client-5.5.x/\n ['Java', 'http_client', /^java\\/|apache-httpclient/i],\n // https://axios-http.com\n ['axios', 'http_client', /^axios\\//i],\n // https://github.com/node-fetch/node-fetch\n ['node-fetch', 'http_client', /node-fetch/i],\n // https://undici.nodejs.org\n ['undici', 'http_client', /^undici/i],\n // https://www.postman.com\n ['PostmanRuntime', 'http_client', /postmanruntime/i],\n // https://insomnia.rest\n ['insomnia', 'http_client', /^insomnia\\//i],\n // https://metacpan.org/pod/LWP\n ['libwww-perl', 'http_client', /libwww-perl/i],\n // https://docs.guzzlephp.org\n ['Guzzle', 'http_client', /guzzlehttp/i],\n // https://developers.google.com/apps-script/reference/url-fetch\n ['Google-Apps-Script', 'http_client', /google-apps-script/i],\n // https://support.google.com/docs/answer/3093339\n ['GoogleDocs', 'http_client', /googledocs/i],\n] as const satisfies readonly (readonly [string, BotCategory, RegExp])[];\n\nconst botishToken =\n /\\b([\\w.-]*?(?:bot|crawler|spider|scraper|fetcher|agent|preview|checker|monitor)[\\w-]*)\\b/i;\nconst botishWord = /^(?:bot|crawler|spider|scraper|fetcher|agent|preview|checker|monitor)$/i;\nconst compatibleToken = /compatible;\\s*([a-z][\\w.-]*(?: [a-z][\\w.-]*)?)/i;\nconst productTokens = /([a-z][\\w.-]*)\\/\\d/gi;\nconst browserToken =\n /^(?:mozilla|applewebkit|khtml|gecko|chrome|chromium|safari|version|mobile|firefox|edg|edge|opr|msie|trident)$/i;\n\n/**\n * A name for a bot that is not in the named table, from the first of: a token that sounds like\n * one (`Bytespider`, `ABEvalBot`), the name after `compatible;` (`Google-Read-Aloud`), a product\n * token that is not a browser's (`Barkrowler/0.5`), what the generic pattern matched. URLs and\n * email addresses are dropped first, as nearly every crawler links its docs.\n */\nexport function nameOfUnknownBot(userAgent: string, matched: string): string {\n const text = userAgent\n .replace(/\\+?https?:\\/\\/\\S+/gi, ' ')\n .replace(/[\\w.+-]+@[\\w-]+(?:\\.[\\w-]+)+/g, ' ');\n\n const botish = botishToken.exec(text)?.[1];\n if (botish && !botishWord.test(botish)) return botish.slice(0, 64);\n\n const compatible = compatibleToken.exec(text)?.[1];\n if (compatible && !browserToken.test(compatible)) return compatible.slice(0, 64);\n\n for (const [, product] of text.matchAll(productTokens)) {\n if (!browserToken.test(product)) return product.slice(0, 64);\n }\n\n return matched.replace(/^\\W+|\\W+$/g, '').slice(0, 64) || 'unknown';\n}\n\n/**\n * The request user agent of a page opened in Facebook's or Instagram's in-app browser when the\n * app sends the page's requests through its own network stack: `[FBAN/FB4A;FBAV/…]`,\n * `Instagram 445.0.0.34.44 (iPhone18,1; iOS 26_6_1; …) AppleWebKit/420+`. The page itself still\n * reads a browser's `navigator.userAgent`, which is why PostHog, GA4 and Matomo see a person.\n * isbot's generic pattern takes both for bots (a long token with no space, a product token that is\n * no browser's), so they are people here before it runs. Meta's ad prefetch loads only the HTML,\n * which runs no script and creates no visitor. The in-app browser's own user agent starts with\n * `Mozilla/5.0`, so the anchors leave it alone.\n */\nconst META_APP = /^\\[FBAN\\/|^Instagram \\d+(?:\\.\\d+)+ \\(/;\n\n/**\n * Whether a web visitor is a bot, which one, and what kind. Run on the server when the visitor\n * is created, with the tags it was created with: the user agent is the request's header\n * (`tags.user_agent`, which the server writes), not anything the client says about itself, so\n * the verdict can be recomputed from stored tags when the rules change.\n *\n * Call it for web visitors only: a native app's requests carry an HTTP library's user agent\n * (CFNetwork, okhttp) that would read as a bot, and no crawler runs the app.\n *\n * In order: a bot we can name; a browser driven by WebDriver (`tags.webdriver`, which the SDK\n * sets from `navigator.webdriver`, the one sign a scripted browser with a normal user agent\n * gives); a person in a Meta app (`META_APP`); anything the generic pattern calls automated; no\n * user agent at all.\n */\nexport function botOf(tags: TrackTags): Bot {\n const userAgent = typeof tags.user_agent === 'string' ? tags.user_agent.trim() : '';\n\n for (const [name, category, pattern] of NAMED_BOTS) {\n if (pattern.test(userAgent)) return { is_bot: true, bot_name: name, bot_category: category };\n }\n\n const generic = userAgent ? genericBot().exec(userAgent) : null;\n const unknownName = generic ? nameOfUnknownBot(userAgent, generic[0]) : null;\n\n // A scripted browser that says so in its user agent takes that name, else it is just WebDriver.\n if (tags.webdriver === true) {\n return { is_bot: true, bot_name: unknownName ?? 'WebDriver', bot_category: 'headless_browser' };\n }\n\n if (META_APP.test(userAgent)) return NOT_A_BOT;\n\n if (unknownName) return { is_bot: true, bot_name: unknownName, bot_category: 'other' };\n\n if (!userAgent)\n return { is_bot: true, bot_name: '(no user agent)', bot_category: 'no_user_agent' };\n\n return NOT_A_BOT;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAYA,MAAa,YAAiB;CAAE,QAAQ;CAAO,UAAU;CAAM,cAAc;AAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BlF,MAAa,aAAa;CAGxB;EAAC;EAAoB;EAAe;CAAmB;CAEvD;EAAC;EAAmB;EAAe;CAAkB;CAErD;EAAC;EAAiB;EAAe;CAAgB;CAEjD;EAAC;EAAwB;EAAe;CAAuB;CAE/D;EAAC;EAAY;EAAe;CAAW;CAEvC;EAAC;EAAkB;EAAe;CAAiB;CAEnD;EAAC;EAA0B;EAAe;CAAyB;CAEnE;EAAC;EAAc;EAAe;CAAa;CAE3C;EAAC;EAAe;EAAe;CAAc;CAE7C;EAAC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CAG7F,MAAM,UAAU,YAAYA,oBAAAA,WAAW,CAAC,CAAC,KAAK,SAAS,IAAI;CAC3D,MAAM,cAAc,UAAU,iBAAiB,WAAW,QAAQ,EAAE,IAAI;CAGxE,IAAI,KAAK,cAAc,MACrB,OAAO;EAAE,QAAQ;EAAM,UAAU,eAAe;EAAa,cAAc;CAAmB;CAGhG,IAAI,SAAS,KAAK,SAAS,GAAG,OAAO;CAErC,IAAI,aAAa,OAAO;EAAE,QAAQ;EAAM,UAAU;EAAa,cAAc;CAAQ;CAErF,IAAI,CAAC,WACH,OAAO;EAAE,QAAQ;EAAM,UAAU;EAAmB,cAAc;CAAgB;CAEpF,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- import { GENERIC_BOT } from "./generic.mjs";
1
+ import { genericBot } from "./generic.mjs";
2
2
  // src/bot/index.ts
3
3
  /**
4
4
  * What kind of automated visitor a bot is, as the analytics tools that report bots separately
@@ -1158,7 +1158,7 @@ function botOf(tags) {
1158
1158
  bot_name: name,
1159
1159
  bot_category: category
1160
1160
  };
1161
- const generic = userAgent ? GENERIC_BOT.exec(userAgent) : null;
1161
+ const generic = userAgent ? genericBot().exec(userAgent) : null;
1162
1162
  const unknownName = generic ? nameOfUnknownBot(userAgent, generic[0]) : null;
1163
1163
  if (tags.webdriver === true) return {
1164
1164
  is_bot: true,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/bot/index.ts"],"sourcesContent":["import type { TrackTags } from '../track/types';\nimport { GENERIC_BOT } from './generic';\n\n/**\n * What kind of automated visitor a bot is, as the analytics tools that report bots separately\n * group them (PostHog's traffic categories, Cloudflare's verified bot categories, Matomo's\n * DeviceDetector). Stored next to the name so dashboards can group without re-deriving:\n *\n * - search_crawler: indexes pages for a search engine (Googlebot, Bingbot, Baiduspider)\n * - ai_crawler: collects content to train models (GPTBot, ClaudeBot, Meta-ExternalAgent)\n * - ai_search: indexes pages for an AI search product (OAI-SearchBot, PerplexityBot)\n * - ai_assistant: fetches a page because a person asked an assistant to (ChatGPT-User)\n * - advertising: works for an ad system — reviews landing pages, targets or verifies ads\n * (Meta-ExternalAds, AdsBot-Google, Mediapartners-Google)\n * - link_preview: renders the card of a link shared in a feed or a chat (facebookexternalhit)\n * - seo_tool: SEO, marketing and page-speed tools (AhrefsBot, Lighthouse, HubSpot)\n * - monitoring: uptime checks, synthetics and service callers (Pingdom, Stripe)\n * - headless_browser: a scripted browser (HeadlessChrome, Playwright, a WebDriver session)\n * - http_client: a library or command-line client (curl, python-requests)\n * - no_user_agent: a request without a user agent, which no browser sends\n * - other: automated by every sign, but none of the above\n */\nexport const BOT_CATEGORIES = [\n 'search_crawler',\n 'ai_crawler',\n 'ai_search',\n 'ai_assistant',\n 'advertising',\n 'link_preview',\n 'seo_tool',\n 'monitoring',\n 'headless_browser',\n 'http_client',\n 'no_user_agent',\n 'other',\n] as const;\n\nexport type BotCategory = (typeof BOT_CATEGORIES)[number];\n\n/**\n * The verdict, shaped like the columns a product stores it in (`is_bot`, `bot_name`,\n * `bot_category`). A person is `{ is_bot: false, bot_name: null, bot_category: null }`.\n */\nexport type Bot =\n | { is_bot: true; bot_name: string; bot_category: BotCategory }\n | { is_bot: false; bot_name: null; bot_category: null };\n\nexport const NOT_A_BOT: Bot = { is_bot: false, bot_name: null, bot_category: null };\n\n/**\n * Bots we can name, as `[name, category, pattern]`, tried in order; the first match wins.\n *\n * Where the list comes from (checked 2026-09-30):\n * - bowser's bot parsers (the ~25 named bots its `platform.type === 'bot'` reports), which this\n * replaces.\n * - PostHog's `bot_definitions.py` (web analytics traffic classification), for the bots and\n * categories an analytics product sees most.\n * - ai.robots.txt (`robots.json`), for AI crawlers, search bots, assistants and agents.\n * - The operators' own docs for the big ones: Google's crawler list, OpenAI's and Anthropic's\n * bot pages, Meta's web crawlers, Perplexity, Bing, Apple.\n * - Bots seen in production (Meta-ExternalAds, HubSpot, Bytespider).\n * Every entry was run against the real user agents in crawler-user-agents and PostHog's\n * fixtures, and bowser's browser fixtures were run to check no browser is taken for a bot\n * (Sogou's browser against its spider, Pinterest's in-app browser against its bot); see\n * `index.test.ts` for where to get them.\n *\n * The link above each entry is the operator's page about the bot, else its product page, else\n * its Known Agents profile (knownagents.com, formerly Dark Visitors) when the operator has none.\n *\n * Names are the operators' spelling of their user agent token. Order matters where one token\n * contains another or borrows a name: advertising and SEO tools come before the search engines\n * whose names they carry, and the more specific of Meta's, Anthropic's and Perplexity's tokens\n * come first. The long tail is left to the generic pattern, filed as `other` and named by\n * `nameOfUnknownBot`; add a bot here when it is worth its own category or name in a dashboard.\n */\nexport const NAMED_BOTS = [\n // advertising: before the search crawlers, AdsBot and Mediapartners carry Google's name\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['Meta-ExternalAds', 'advertising', /meta-externalads/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['facebookcatalog', 'advertising', /facebookcatalog/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-special-case-crawlers\n ['AdsBot-Google', 'advertising', /adsbot-google/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-special-case-crawlers\n ['Mediapartners-Google', 'advertising', /mediapartners-google/i],\n // https://www.bing.com/webmasters/help/which-crawlers-does-bing-use-8c184ec0\n ['AdIdxBot', 'advertising', /adidxbot/i],\n // https://support.google.com/adwords/answer/2404197\n ['Google-AdWords', 'advertising', /google-adwords/i],\n // https://support.google.com/google-ads/answer/6095821\n ['Google-Ads-Conversions', 'advertising', /google-ads-conversions/i],\n // https://developers.openai.com/api/docs/bots\n ['OAI-AdsBot', 'advertising', /oai-adsbot/i],\n // https://businesshelp.snapchat.com/s/article/adsbot-crawler\n ['SnapchatAds', 'advertising', /snapchatads/i],\n // https://www.taboola.com\n ['Taboolabot', 'advertising', /taboolabot/i],\n\n // AI assistants and agents: a person asked for this page\n // https://developers.openai.com/api/docs/bots\n ['ChatGPT-User', 'ai_assistant', /chatgpt-user/i],\n // https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler\n ['Claude-User', 'ai_assistant', /claude-user/i],\n // https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler\n ['Claude-Web', 'ai_assistant', /claude-web/i],\n // https://docs.perplexity.ai/guides/bots\n ['Perplexity-User', 'ai_assistant', /perplexity-user/i],\n // https://duckduckgo.com/duckduckgo-help-pages/results/duckassistbot\n ['DuckAssistBot', 'ai_assistant', /duckassistbot/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['Meta-ExternalFetcher', 'ai_assistant', /meta-externalfetcher/i],\n // https://docs.mistral.ai/robots\n ['MistralAI-User', 'ai_assistant', /mistralai-user/i],\n // https://knownagents.com/agents/manus-user\n ['Manus-User', 'ai_assistant', /manus-user/i],\n // https://knownagents.com/agents/shap-user\n ['Shap-User', 'ai_assistant', /shap-user/i],\n // https://quillbot.com\n ['QuillBot', 'ai_assistant', /quillbot/i],\n // https://developer.amazon.com/amazonbot\n ['Amzn-User', 'ai_assistant', /amzn-user/i],\n // https://knownagents.com/agents/amazon-qbusiness\n ['amazon-QBusiness', 'ai_assistant', /amazon-qbusiness/i],\n // https://docs.aws.amazon.com/bedrock-agentcore/\n ['Amazon-Bedrock-AgentCore-Browser', 'ai_assistant', /amazon-bedrock-agentcore/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-user-triggered-fetchers\n ['Google-Agent', 'ai_assistant', /google-?agent/i],\n // https://gemini.google/overview/deep-research/\n ['Gemini-Deep-Research', 'ai_assistant', /gemini-deep-research/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-user-triggered-fetchers\n ['Google-NotebookLM', 'ai_assistant', /google-notebooklm/i],\n // https://www.kimi.ai/policies/kimi-crawlers\n ['Kimi-User', 'ai_assistant', /kimi-(?:user|agent)/i],\n // https://knownagents.com/agents/tongyibot\n ['TongyiBot', 'ai_assistant', /tongyibot/i],\n // https://knownagents.com/agents/yiyanbot\n ['YiyanBot', 'ai_assistant', /yiyanbot/i],\n // https://help.kagi.com/kagi/ai/kagi-ai.html\n ['kagi-fetcher', 'ai_assistant', /kagi-fetcher/i],\n // https://devin.ai\n ['Devin', 'ai_assistant', /\\bdevin\\/\\d/i],\n // https://knownagents.com/agents/novaact\n ['NovaAct', 'ai_assistant', /novaact/i],\n\n // AI search\n // https://developers.openai.com/api/docs/bots\n ['OAI-SearchBot', 'ai_search', /oai-searchbot/i],\n // https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler\n ['Claude-SearchBot', 'ai_search', /claude-searchbot/i],\n // https://docs.perplexity.ai/guides/bots\n ['PerplexityBot', 'ai_search', /perplexitybot/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['Meta-WebIndexer', 'ai_search', /meta-webindexer/i],\n // https://developer.amazon.com/amazonbot\n ['Amazonbot', 'ai_search', /amazonbot/i],\n // https://knownagents.com/agents/youbot\n ['YouBot', 'ai_search', /youbot/i],\n // https://knownagents.com/agents/phindbot\n ['PhindBot', 'ai_search', /phindbot/i],\n // https://developer.amazon.com/amazonbot\n ['Amzn-SearchBot', 'ai_search', /amzn-searchbot/i],\n // https://knownagents.com/agents/azureai-searchbot\n ['AzureAI-SearchBot', 'ai_search', /azureai-searchbot/i],\n // https://www.kimi.ai/policies/kimi-crawlers\n ['Kimi-SearchBot', 'ai_search', /kimi-searchbot/i],\n // https://docs.mistral.ai/robots\n ['MistralAI-Index', 'ai_search', /mistralai-index/i],\n // https://knownagents.com/agents/exasearchbot\n ['ExaSearchBot', 'ai_search', /exasearchbot|\\bexabot/i],\n // https://knownagents.com/agents/tavilybot\n ['TavilyBot', 'ai_search', /tavilybot/i],\n // https://linkup.so/bot\n ['LinkupBot', 'ai_search', /linkupbot/i],\n // https://knownagents.com/agents/iaskspider\n ['iAskBot', 'ai_search', /iask(?:bot|spider)/i],\n ['Andibot', 'ai_search', /andibot/i],\n // https://developers.cloudflare.com/autorag\n ['Cloudflare-AutoRAG', 'ai_search', /cloudflare-autorag/i],\n // https://docs.parallel.ai/resources/crawler\n ['ShapBot', 'ai_search', /shapbot/i],\n\n // AI training\n // https://developers.openai.com/api/docs/bots\n ['GPTBot', 'ai_crawler', /gptbot/i],\n // https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler\n ['ClaudeBot', 'ai_crawler', /claudebot/i],\n // https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler\n ['anthropic-ai', 'ai_crawler', /anthropic-ai/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['Meta-ExternalAgent', 'ai_crawler', /meta-externalagent/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['FacebookBot', 'ai_crawler', /facebookbot/i],\n // https://knownagents.com/agents/bytespider\n ['Bytespider', 'ai_crawler', /bytespider/i],\n // https://commoncrawl.org/ccbot\n ['CCBot', 'ai_crawler', /ccbot/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['Google-CloudVertexBot', 'ai_crawler', /google-cloudvertexbot/i],\n // https://knownagents.com/agents/cohere-training-data-crawler\n ['cohere-ai', 'ai_crawler', /cohere-(?:ai|training-data-crawler)/i],\n // https://www.diffbot.com/docs/crawl/faq/robots-txt\n ['Diffbot', 'ai_crawler', /diffbot/i],\n // https://knownagents.com/agents/webzio-extended\n ['Omgili', 'ai_crawler', /omgili|webzio-extended/i],\n // https://imagesift.com/about\n ['ImagesiftBot', 'ai_crawler', /imagesiftbot/i],\n // https://www.timpi.io\n ['Timpibot', 'ai_crawler', /timpibot/i],\n // https://knownagents.com/agents/ai2bot\n ['AI2Bot', 'ai_crawler', /ai2bot/i],\n // https://knownagents.com/agents/pangubot\n ['PanguBot', 'ai_crawler', /pangubot/i],\n // https://knownagents.com/agents/promptingbot\n ['PromptingBot', 'ai_crawler', /promptingbot/i],\n // https://knownagents.com/agents/reflectionbot\n ['Reflectionbot', 'ai_crawler', /reflectionbot/i],\n // https://knownagents.com/agents/tiktokspider\n ['TikTokSpider', 'ai_crawler', /tiktokspider/i],\n // https://knownagents.com/agents/deepseekbot\n ['DeepSeekBot', 'ai_crawler', /deepseekbot/i],\n // https://knownagents.com/agents/doubaobot\n ['DoubaoBot', 'ai_crawler', /doubaobot/i],\n // https://knownagents.com/agents/erniebot\n ['ERNIEBot', 'ai_crawler', /erniebot/i],\n // https://knownagents.com/agents/qwenbot\n ['QwenBot', 'ai_crawler', /qwenbot/i],\n // https://www.kimi.ai/policies/kimi-crawlers\n ['KimiBot', 'ai_crawler', /kimibot/i],\n // https://knownagents.com/agents/chatglm-spider\n ['ChatGLM-Spider', 'ai_crawler', /chatglm-spider/i],\n // https://docs.mistral.ai/robots\n ['MistralAI-Training', 'ai_crawler', /mistralai-training/i],\n // https://knownagents.com/agents/yandexadditional\n ['YandexAdditional', 'ai_crawler', /yandexadditional/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['Google-Extended', 'ai_crawler', /google-extended/i],\n // https://docs.aws.amazon.com/kendra/latest/dg/what-is-kendra.html\n ['Amazon Kendra', 'ai_crawler', /amazon-kendra|kendrabot/i],\n // https://knownagents.com/agents/bedrockbot\n ['bedrockbot', 'ai_crawler', /bedrockbot/i],\n // https://brightdata.com/brightbot\n ['Brightbot', 'ai_crawler', /brightbot/i],\n // https://firecrawl.dev\n ['FirecrawlAgent', 'ai_crawler', /firecrawl/i],\n // https://github.com/unclecode/crawl4ai\n ['Crawl4AI', 'ai_crawler', /crawl4ai/i],\n // https://apify.com/apify/website-content-crawler\n ['ApifyBot', 'ai_crawler', /apify/i],\n // https://github.com/rom1504/img2dataset\n ['img2dataset', 'ai_crawler', /img2dataset/i],\n // https://knownagents.com/agents/laion-huggingface-processor\n ['LAION', 'ai_crawler', /laion/i],\n // https://developers.cloudflare.com/browser-rendering/\n ['Cloudflare Browser Rendering', 'ai_crawler', /cloudflarebrowserrendering/i],\n\n // link previews\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['facebookexternalhit', 'link_preview', /facebookexternalhit/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['Facebot', 'link_preview', /facebot/i],\n // https://developer.x.com/en/docs/x-for-websites/cards/guides/getting-started\n ['Twitterbot', 'link_preview', /twitterbot/i],\n // https://www.linkedin.com/help/linkedin/answer/a521928\n ['LinkedInBot', 'link_preview', /linkedinbot/i],\n // https://api.slack.com/robots\n ['Slackbot', 'link_preview', /slackbot|slack-imgproxy/i],\n // https://discord.com\n ['Discordbot', 'link_preview', /discordbot/i],\n // https://core.telegram.org/bots\n ['TelegramBot', 'link_preview', /telegrambot/i],\n // https://www.whatsapp.com\n ['WhatsApp', 'link_preview', /^whatsapp\\//i],\n // https://www.pinterest.com/bot.html\n ['Pinterestbot', 'link_preview', /pinterestbot|^pinterest\\/0\\./i],\n // https://www.reddit.com\n ['redditbot', 'link_preview', /redditbot/i],\n // https://developers.snap.com/robots\n ['Snap URL Preview', 'link_preview', /snap url preview/i],\n // https://knownagents.com/agents/skypeuripreview\n ['SkypeUriPreview', 'link_preview', /skypeuripreview/i],\n // https://www.bing.com/webmasters/help/which-crawlers-does-bing-use-8c184ec0\n ['BingPreview', 'link_preview', /bingpreview|microsoftpreview/i],\n // https://iframely.com/docs/about\n ['Iframely', 'link_preview', /iframely/i],\n // https://embed.ly\n ['Embedly', 'link_preview', /embedly/i],\n // https://devtalk.kakao.com/t/scrap/33984\n ['KakaoTalk-scrap', 'link_preview', /kakaotalk-scrap/i],\n // https://vk.com/dev/Share\n ['vkShare', 'link_preview', /vkshare/i],\n // https://www.viber.com\n ['Viber', 'link_preview', /^viber\\b|viber-crawler/i],\n // https://github.com/bluesky-social/indigo\n ['Bluesky Cardyb', 'link_preview', /cardyb/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-user-triggered-fetchers\n ['Google-PageRenderer', 'link_preview', /google-pagerenderer/i],\n // https://vercel.com\n ['vercel-screenshot', 'link_preview', /vercel-screenshot/i],\n\n // SEO, marketing and page-speed tools; before the search crawlers, Lighthouse and the\n // Search Console tester borrow Google's name\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['Google-InspectionTool', 'seo_tool', /google-inspectiontool/i],\n // https://developer.chrome.com/docs/lighthouse\n ['Lighthouse', 'seo_tool', /chrome-lighthouse|google page speed insights/i],\n // https://gtmetrix.com\n ['GTmetrix', 'seo_tool', /gtmetrix/i],\n // https://ahrefs.com/robot\n ['AhrefsBot', 'seo_tool', /ahrefs(?:bot|siteaudit)/i],\n // https://www.semrush.com/bot/\n ['SemrushBot', 'seo_tool', /semrush/i],\n // https://mj12bot.com\n ['MJ12bot', 'seo_tool', /mj12bot/i],\n // https://moz.com/help/moz-procedures/crawlers/dotbot\n ['DotBot', 'seo_tool', /dotbot/i],\n // https://moz.com/help/moz-procedures/crawlers/rogerbot\n ['rogerbot', 'seo_tool', /rogerbot/i],\n // https://www.screamingfrog.co.uk/seo-spider/\n ['Screaming Frog', 'seo_tool', /screaming frog/i],\n // https://serpstatbot.com\n ['SerpstatBot', 'seo_tool', /serpstatbot/i],\n // https://webmeup-crawler.com\n ['BLEXBot', 'seo_tool', /blexbot/i],\n // https://dataforseo.com/dataforseo-bot\n ['DataForSeoBot', 'seo_tool', /dataforseobot/i],\n // https://knownagents.com/agents/hubspot-crawler\n ['HubSpot', 'seo_tool', /hubspot/i],\n // https://search.google.com/structured-data/testing-tool\n ['Google-Structured-Data-Testing-Tool', 'seo_tool', /google-structured-data-testing-tool/i],\n // https://www.webpagetest.org\n ['WebPageTest', 'seo_tool', /\\bptst\\/\\d/i],\n // https://www.dareboost.com\n ['DareBoost', 'seo_tool', /dareboost/i],\n // https://www.exensa.com/crawl\n ['Barkrowler', 'seo_tool', /barkrowler/i],\n // https://seranking.com/backlinks-crawler\n ['SE Ranking', 'seo_tool', /seranking|sebot-wa/i],\n // https://www.brightedge.com\n ['BrightEdge', 'seo_tool', /brightedge/i],\n // https://searchatlas.com\n ['SearchAtlas', 'seo_tool', /searchatlas/i],\n // https://www.siteimprove.com\n ['Siteimprove', 'seo_tool', /siteimprove/i],\n // https://www.dataprovider.com\n ['Dataprovider', 'seo_tool', /dataprovider\\.com/i],\n // https://www.meltwater.com\n ['Meltwater', 'seo_tool', /meltwater/i],\n // https://awario.com/bots.html\n ['Awario', 'seo_tool', /awario/i],\n\n // search engines\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['Googlebot', 'search_crawler', /googlebot/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['Storebot-Google', 'search_crawler', /storebot-google/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['GoogleOther', 'search_crawler', /googleother/i],\n // https://www.bing.com/webmasters/help/which-crawlers-does-bing-use-8c184ec0\n ['Bingbot', 'search_crawler', /bingbot/i],\n // https://support.apple.com/en-us/119829\n ['Applebot', 'search_crawler', /applebot/i],\n // https://www.baidu.com/search/spider.html\n ['Baiduspider', 'search_crawler', /baiduspider/i],\n // https://yandex.com/support/webmaster/robot-workings/check-yandex-robots.html\n ['YandexBot', 'search_crawler', /yandex(?:\\w*bot|images|metrika)/i],\n // https://duckduckgo.com/duckduckgo-help-pages/results/duckduckbot\n ['DuckDuckBot', 'search_crawler', /duckduckbot/i],\n // https://help.yahoo.com/kb/SLN22600.html\n ['Yahoo Slurp', 'search_crawler', /yahoo!?[\\s/]*slurp/i],\n // https://www.sogou.com/docs/help/webmasters.htm#07\n ['Sogou', 'search_crawler', /sogou[\\w\\s-]*spider/i],\n // https://www.so.com/help/help_3_2.html\n ['360Spider', 'search_crawler', /360spider|haosouspider/i],\n // https://knownagents.com/agents/yisouspider\n ['YisouSpider', 'search_crawler', /yisouspider/i],\n // https://webmaster.petalsearch.com/site/petalbot\n ['PetalBot', 'search_crawler', /petalbot/i],\n // https://napoveda.seznam.cz/en/seznambot-intro/\n ['SeznamBot', 'search_crawler', /seznambot/i],\n // https://knownagents.com/agents/yeti\n ['Yeti', 'search_crawler', /\\byeti\\//i],\n // https://help2.line.me/linesearchbot/web/?contentId=50006055&lang=en\n ['Linespider', 'search_crawler', /linespider/i],\n // https://help.qwant.com/bot/\n ['Qwantbot', 'search_crawler', /qwant(?:bot|ify)/i],\n // https://help.coccoc.com/searchengine\n ['coccocbot', 'search_crawler', /coccocbot/i],\n // https://www.mojeek.com/bot.html\n ['MojeekBot', 'search_crawler', /mojeekbot/i],\n // https://search.brave.com/help/brave-search-crawler\n ['Bravebot', 'search_crawler', /bravebot/i],\n // https://bot.seekport.com\n ['SeekportBot', 'search_crawler', /seekport/i],\n // https://mwmbl.org\n ['mwmbl', 'search_crawler', /mwmbl/i],\n // https://archive.org/details/archive.org_bot\n ['Internet Archive', 'search_crawler', /archive\\.org_bot|ia_archiver|archive-it|archiveteam/i],\n\n // monitoring, synthetics, security and consent scanners, service callers\n // https://www.pingdom.com\n ['Pingdom', 'monitoring', /pingdom/i],\n // https://uptimerobot.com\n ['UptimeRobot', 'monitoring', /uptimerobot/i],\n // https://www.statuscake.com\n ['StatusCake', 'monitoring', /statuscake/i],\n // https://www.site24x7.com\n ['Site24x7', 'monitoring', /site24x7/i],\n // https://betterstack.com/docs/uptime/\n ['Better Stack', 'monitoring', /better ?uptime|betterstack/i],\n // https://docs.datadoghq.com/synthetics/\n ['Datadog', 'monitoring', /datadog/i],\n // https://www.checklyhq.com/docs/\n ['Checkly', 'monitoring', /checkly/i],\n // https://docs.newrelic.com/docs/synthetics/\n ['NewRelicPinger', 'monitoring', /newrelicpinger/i],\n // https://github.com/louislam/uptime-kuma\n ['Uptime-Kuma', 'monitoring', /uptime-kuma/i],\n // https://grafana.com/docs/grafana-cloud/testing/synthetic-monitoring/\n ['Grafana Synthetic Monitoring', 'monitoring', /grafanasyntheticmonitoring/i],\n // https://docs.dynatrace.com/docs/observe/digital-experience/synthetic-monitoring\n ['Dynatrace', 'monitoring', /ruxitsynthetic|dynatrace/i],\n // https://docs.splunk.com/observability/en/synthetics/intro-synthetics.html\n ['Splunk', 'monitoring', /splunk/i],\n // https://www.catchpoint.com\n ['Catchpoint', 'monitoring', /catchpoint/i],\n // https://ghostinspector.com\n ['Ghost Inspector', 'monitoring', /ghost inspector/i],\n // https://docs.digitalocean.com/products/uptime/\n ['DigitalOcean Uptime', 'monitoring', /digitalocean uptime/i],\n // https://ohdear.app/docs/faq/what-is-the-oh-dear-checker\n ['OhDear', 'monitoring', /ohdear/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-special-case-crawlers\n ['Google-Safety', 'monitoring', /google-safety/i],\n // https://www.cookiebot.com\n ['Cookiebot', 'monitoring', /cookiebot/i],\n // https://knownagents.com/agents/onetrust-cmp-scanner\n ['OneTrust', 'monitoring', /onetrust/i],\n // https://www.cookiehub.com\n ['CookieHub', 'monitoring', /cookiehub/i],\n // https://detectify.com/bot/\n ['Detectify', 'monitoring', /detectify/i],\n // https://about.censys.io\n ['CensysInspect', 'monitoring', /censysinspect/i],\n // https://www.bitsight.com\n ['BitSightBot', 'monitoring', /bitsightbot/i],\n // https://github.com/zmap/zgrab2\n ['zgrab', 'monitoring', /zgrab/i],\n // https://nmap.org/book/nse.html\n ['Nmap', 'monitoring', /nmap scripting engine/i],\n // https://docs.stripe.com/webhooks\n ['Stripe', 'monitoring', /stripe\\/1\\.0|stripebot|merchantsecurityscanner/i],\n\n // scripted browsers\n // https://developer.chrome.com/docs/chromium/headless\n ['HeadlessChrome', 'headless_browser', /headlesschrome/i],\n // https://phantomjs.org\n ['PhantomJS', 'headless_browser', /phantomjs/i],\n // https://slimerjs.org\n ['SlimerJS', 'headless_browser', /slimerjs/i],\n // https://playwright.dev\n ['Playwright', 'headless_browser', /playwright/i],\n // https://pptr.dev\n ['Puppeteer', 'headless_browser', /puppeteer/i],\n // https://www.selenium.dev\n ['Selenium', 'headless_browser', /selenium/i],\n // https://www.cypress.io\n ['Cypress', 'headless_browser', /cypress/i],\n // https://lightpanda.io\n ['Lightpanda', 'headless_browser', /lightpanda/i],\n // https://wkhtmltopdf.org\n ['wkhtmltopdf', 'headless_browser', /wkhtmltopdf/i],\n\n // libraries and command-line clients\n // https://curl.se\n ['curl', 'http_client', /^curl\\//i],\n // https://www.gnu.org/software/wget/\n ['Wget', 'http_client', /^wget\\//i],\n // https://requests.readthedocs.io\n ['python-requests', 'http_client', /python-requests/i],\n // https://docs.python.org/3/library/urllib.request.html\n ['python-urllib', 'http_client', /python-urllib/i],\n // https://docs.aiohttp.org\n ['aiohttp', 'http_client', /aiohttp/i],\n // https://www.python-httpx.org\n ['httpx', 'http_client', /python-httpx|^httpx\\//i],\n // https://scrapy.org\n ['Scrapy', 'http_client', /scrapy/i],\n // https://pkg.go.dev/net/http\n ['Go-http-client', 'http_client', /go-http-client/i],\n // https://github.com/square/okhttp\n ['okhttp', 'http_client', /^okhttp\\//i],\n // https://hc.apache.org/httpcomponents-client-5.5.x/\n ['Java', 'http_client', /^java\\/|apache-httpclient/i],\n // https://axios-http.com\n ['axios', 'http_client', /^axios\\//i],\n // https://github.com/node-fetch/node-fetch\n ['node-fetch', 'http_client', /node-fetch/i],\n // https://undici.nodejs.org\n ['undici', 'http_client', /^undici/i],\n // https://www.postman.com\n ['PostmanRuntime', 'http_client', /postmanruntime/i],\n // https://insomnia.rest\n ['insomnia', 'http_client', /^insomnia\\//i],\n // https://metacpan.org/pod/LWP\n ['libwww-perl', 'http_client', /libwww-perl/i],\n // https://docs.guzzlephp.org\n ['Guzzle', 'http_client', /guzzlehttp/i],\n // https://developers.google.com/apps-script/reference/url-fetch\n ['Google-Apps-Script', 'http_client', /google-apps-script/i],\n // https://support.google.com/docs/answer/3093339\n ['GoogleDocs', 'http_client', /googledocs/i],\n] as const satisfies readonly (readonly [string, BotCategory, RegExp])[];\n\nconst botishToken =\n /\\b([\\w.-]*?(?:bot|crawler|spider|scraper|fetcher|agent|preview|checker|monitor)[\\w-]*)\\b/i;\nconst botishWord = /^(?:bot|crawler|spider|scraper|fetcher|agent|preview|checker|monitor)$/i;\nconst compatibleToken = /compatible;\\s*([a-z][\\w.-]*(?: [a-z][\\w.-]*)?)/i;\nconst productTokens = /([a-z][\\w.-]*)\\/\\d/gi;\nconst browserToken =\n /^(?:mozilla|applewebkit|khtml|gecko|chrome|chromium|safari|version|mobile|firefox|edg|edge|opr|msie|trident)$/i;\n\n/**\n * A name for a bot that is not in the named table, from the first of: a token that sounds like\n * one (`Bytespider`, `ABEvalBot`), the name after `compatible;` (`Google-Read-Aloud`), a product\n * token that is not a browser's (`Barkrowler/0.5`), what the generic pattern matched. URLs and\n * email addresses are dropped first, as nearly every crawler links its docs.\n */\nexport function nameOfUnknownBot(userAgent: string, matched: string): string {\n const text = userAgent\n .replace(/\\+?https?:\\/\\/\\S+/gi, ' ')\n .replace(/[\\w.+-]+@[\\w-]+(?:\\.[\\w-]+)+/g, ' ');\n\n const botish = botishToken.exec(text)?.[1];\n if (botish && !botishWord.test(botish)) return botish.slice(0, 64);\n\n const compatible = compatibleToken.exec(text)?.[1];\n if (compatible && !browserToken.test(compatible)) return compatible.slice(0, 64);\n\n for (const [, product] of text.matchAll(productTokens)) {\n if (!browserToken.test(product)) return product.slice(0, 64);\n }\n\n return matched.replace(/^\\W+|\\W+$/g, '').slice(0, 64) || 'unknown';\n}\n\n/**\n * The request user agent of a page opened in Facebook's or Instagram's in-app browser when the\n * app sends the page's requests through its own network stack: `[FBAN/FB4A;FBAV/…]`,\n * `Instagram 445.0.0.34.44 (iPhone18,1; iOS 26_6_1; …) AppleWebKit/420+`. The page itself still\n * reads a browser's `navigator.userAgent`, which is why PostHog, GA4 and Matomo see a person.\n * isbot's generic pattern takes both for bots (a long token with no space, a product token that is\n * no browser's), so they are people here before it runs. Meta's ad prefetch loads only the HTML,\n * which runs no script and creates no visitor. The in-app browser's own user agent starts with\n * `Mozilla/5.0`, so the anchors leave it alone.\n */\nconst META_APP = /^\\[FBAN\\/|^Instagram \\d+(?:\\.\\d+)+ \\(/;\n\n/**\n * Whether a web visitor is a bot, which one, and what kind. Run on the server when the visitor\n * is created, with the tags it was created with: the user agent is the request's header\n * (`tags.user_agent`, which the server writes), not anything the client says about itself, so\n * the verdict can be recomputed from stored tags when the rules change.\n *\n * Call it for web visitors only: a native app's requests carry an HTTP library's user agent\n * (CFNetwork, okhttp) that would read as a bot, and no crawler runs the app.\n *\n * In order: a bot we can name; a browser driven by WebDriver (`tags.webdriver`, which the SDK\n * sets from `navigator.webdriver`, the one sign a scripted browser with a normal user agent\n * gives); a person in a Meta app (`META_APP`); anything the generic pattern calls automated; no\n * user agent at all.\n */\nexport function botOf(tags: TrackTags): Bot {\n const userAgent = typeof tags.user_agent === 'string' ? tags.user_agent.trim() : '';\n\n for (const [name, category, pattern] of NAMED_BOTS) {\n if (pattern.test(userAgent)) return { is_bot: true, bot_name: name, bot_category: category };\n }\n\n const generic = userAgent ? GENERIC_BOT.exec(userAgent) : null;\n const unknownName = generic ? nameOfUnknownBot(userAgent, generic[0]) : null;\n\n // A scripted browser that says so in its user agent takes that name, else it is just WebDriver.\n if (tags.webdriver === true) {\n return { is_bot: true, bot_name: unknownName ?? 'WebDriver', bot_category: 'headless_browser' };\n }\n\n if (META_APP.test(userAgent)) return NOT_A_BOT;\n\n if (unknownName) return { is_bot: true, bot_name: unknownName, bot_category: 'other' };\n\n if (!userAgent)\n return { is_bot: true, bot_name: '(no user agent)', bot_category: 'no_user_agent' };\n\n return NOT_A_BOT;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAYA,MAAa,YAAiB;CAAE,QAAQ;CAAO,UAAU;CAAM,cAAc;AAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BlF,MAAa,aAAa;CAGxB;EAAC;EAAoB;EAAe;CAAmB;CAEvD;E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;;;AAYA,MAAM,WAAW;;;;;;;;;;;;;;;AAgBjB,SAAgB,MAAM,MAAsB;CAC1C,MAAM,YAAY,OAAO,KAAK,eAAe,WAAW,KAAK,WAAW,KAAK,IAAI;CAEjF,KAAK,MAAM,CAAC,MAAM,UAAU,YAAY,YACtC,IAAI,QAAQ,KAAK,SAAS,GAAG,OAAO;EAAE,QAAQ;EAAM,UAAU;EAAM,cAAc;CAAS;CAG7F,MAAM,UAAU,YAAY,YAAY,KAAK,SAAS,IAAI;CAC1D,MAAM,cAAc,UAAU,iBAAiB,WAAW,QAAQ,EAAE,IAAI;CAGxE,IAAI,KAAK,cAAc,MACrB,OAAO;EAAE,QAAQ;EAAM,UAAU,eAAe;EAAa,cAAc;CAAmB;CAGhG,IAAI,SAAS,KAAK,SAAS,GAAG,OAAO;CAErC,IAAI,aAAa,OAAO;EAAE,QAAQ;EAAM,UAAU;EAAa,cAAc;CAAQ;CAErF,IAAI,CAAC,WACH,OAAO;EAAE,QAAQ;EAAM,UAAU;EAAmB,cAAc;CAAgB;CAEpF,OAAO;AACT"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/bot/index.ts"],"sourcesContent":["import type { TrackTags } from '../track/types';\nimport { genericBot } from './generic';\n\n/**\n * What kind of automated visitor a bot is, as the analytics tools that report bots separately\n * group them (PostHog's traffic categories, Cloudflare's verified bot categories, Matomo's\n * DeviceDetector). Stored next to the name so dashboards can group without re-deriving:\n *\n * - search_crawler: indexes pages for a search engine (Googlebot, Bingbot, Baiduspider)\n * - ai_crawler: collects content to train models (GPTBot, ClaudeBot, Meta-ExternalAgent)\n * - ai_search: indexes pages for an AI search product (OAI-SearchBot, PerplexityBot)\n * - ai_assistant: fetches a page because a person asked an assistant to (ChatGPT-User)\n * - advertising: works for an ad system — reviews landing pages, targets or verifies ads\n * (Meta-ExternalAds, AdsBot-Google, Mediapartners-Google)\n * - link_preview: renders the card of a link shared in a feed or a chat (facebookexternalhit)\n * - seo_tool: SEO, marketing and page-speed tools (AhrefsBot, Lighthouse, HubSpot)\n * - monitoring: uptime checks, synthetics and service callers (Pingdom, Stripe)\n * - headless_browser: a scripted browser (HeadlessChrome, Playwright, a WebDriver session)\n * - http_client: a library or command-line client (curl, python-requests)\n * - no_user_agent: a request without a user agent, which no browser sends\n * - other: automated by every sign, but none of the above\n */\nexport const BOT_CATEGORIES = [\n 'search_crawler',\n 'ai_crawler',\n 'ai_search',\n 'ai_assistant',\n 'advertising',\n 'link_preview',\n 'seo_tool',\n 'monitoring',\n 'headless_browser',\n 'http_client',\n 'no_user_agent',\n 'other',\n] as const;\n\nexport type BotCategory = (typeof BOT_CATEGORIES)[number];\n\n/**\n * The verdict, shaped like the columns a product stores it in (`is_bot`, `bot_name`,\n * `bot_category`). A person is `{ is_bot: false, bot_name: null, bot_category: null }`.\n */\nexport type Bot =\n | { is_bot: true; bot_name: string; bot_category: BotCategory }\n | { is_bot: false; bot_name: null; bot_category: null };\n\nexport const NOT_A_BOT: Bot = { is_bot: false, bot_name: null, bot_category: null };\n\n/**\n * Bots we can name, as `[name, category, pattern]`, tried in order; the first match wins.\n *\n * Where the list comes from (checked 2026-09-30):\n * - bowser's bot parsers (the ~25 named bots its `platform.type === 'bot'` reports), which this\n * replaces.\n * - PostHog's `bot_definitions.py` (web analytics traffic classification), for the bots and\n * categories an analytics product sees most.\n * - ai.robots.txt (`robots.json`), for AI crawlers, search bots, assistants and agents.\n * - The operators' own docs for the big ones: Google's crawler list, OpenAI's and Anthropic's\n * bot pages, Meta's web crawlers, Perplexity, Bing, Apple.\n * - Bots seen in production (Meta-ExternalAds, HubSpot, Bytespider).\n * Every entry was run against the real user agents in crawler-user-agents and PostHog's\n * fixtures, and bowser's browser fixtures were run to check no browser is taken for a bot\n * (Sogou's browser against its spider, Pinterest's in-app browser against its bot); see\n * `index.test.ts` for where to get them.\n *\n * The link above each entry is the operator's page about the bot, else its product page, else\n * its Known Agents profile (knownagents.com, formerly Dark Visitors) when the operator has none.\n *\n * Names are the operators' spelling of their user agent token. Order matters where one token\n * contains another or borrows a name: advertising and SEO tools come before the search engines\n * whose names they carry, and the more specific of Meta's, Anthropic's and Perplexity's tokens\n * come first. The long tail is left to the generic pattern, filed as `other` and named by\n * `nameOfUnknownBot`; add a bot here when it is worth its own category or name in a dashboard.\n */\nexport const NAMED_BOTS = [\n // advertising: before the search crawlers, AdsBot and Mediapartners carry Google's name\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['Meta-ExternalAds', 'advertising', /meta-externalads/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['facebookcatalog', 'advertising', /facebookcatalog/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-special-case-crawlers\n ['AdsBot-Google', 'advertising', /adsbot-google/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-special-case-crawlers\n ['Mediapartners-Google', 'advertising', /mediapartners-google/i],\n // https://www.bing.com/webmasters/help/which-crawlers-does-bing-use-8c184ec0\n ['AdIdxBot', 'advertising', /adidxbot/i],\n // https://support.google.com/adwords/answer/2404197\n ['Google-AdWords', 'advertising', /google-adwords/i],\n // https://support.google.com/google-ads/answer/6095821\n ['Google-Ads-Conversions', 'advertising', /google-ads-conversions/i],\n // https://developers.openai.com/api/docs/bots\n ['OAI-AdsBot', 'advertising', /oai-adsbot/i],\n // https://businesshelp.snapchat.com/s/article/adsbot-crawler\n ['SnapchatAds', 'advertising', /snapchatads/i],\n // https://www.taboola.com\n ['Taboolabot', 'advertising', /taboolabot/i],\n\n // AI assistants and agents: a person asked for this page\n // https://developers.openai.com/api/docs/bots\n ['ChatGPT-User', 'ai_assistant', /chatgpt-user/i],\n // https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler\n ['Claude-User', 'ai_assistant', /claude-user/i],\n // https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler\n ['Claude-Web', 'ai_assistant', /claude-web/i],\n // https://docs.perplexity.ai/guides/bots\n ['Perplexity-User', 'ai_assistant', /perplexity-user/i],\n // https://duckduckgo.com/duckduckgo-help-pages/results/duckassistbot\n ['DuckAssistBot', 'ai_assistant', /duckassistbot/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['Meta-ExternalFetcher', 'ai_assistant', /meta-externalfetcher/i],\n // https://docs.mistral.ai/robots\n ['MistralAI-User', 'ai_assistant', /mistralai-user/i],\n // https://knownagents.com/agents/manus-user\n ['Manus-User', 'ai_assistant', /manus-user/i],\n // https://knownagents.com/agents/shap-user\n ['Shap-User', 'ai_assistant', /shap-user/i],\n // https://quillbot.com\n ['QuillBot', 'ai_assistant', /quillbot/i],\n // https://developer.amazon.com/amazonbot\n ['Amzn-User', 'ai_assistant', /amzn-user/i],\n // https://knownagents.com/agents/amazon-qbusiness\n ['amazon-QBusiness', 'ai_assistant', /amazon-qbusiness/i],\n // https://docs.aws.amazon.com/bedrock-agentcore/\n ['Amazon-Bedrock-AgentCore-Browser', 'ai_assistant', /amazon-bedrock-agentcore/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-user-triggered-fetchers\n ['Google-Agent', 'ai_assistant', /google-?agent/i],\n // https://gemini.google/overview/deep-research/\n ['Gemini-Deep-Research', 'ai_assistant', /gemini-deep-research/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-user-triggered-fetchers\n ['Google-NotebookLM', 'ai_assistant', /google-notebooklm/i],\n // https://www.kimi.ai/policies/kimi-crawlers\n ['Kimi-User', 'ai_assistant', /kimi-(?:user|agent)/i],\n // https://knownagents.com/agents/tongyibot\n ['TongyiBot', 'ai_assistant', /tongyibot/i],\n // https://knownagents.com/agents/yiyanbot\n ['YiyanBot', 'ai_assistant', /yiyanbot/i],\n // https://help.kagi.com/kagi/ai/kagi-ai.html\n ['kagi-fetcher', 'ai_assistant', /kagi-fetcher/i],\n // https://devin.ai\n ['Devin', 'ai_assistant', /\\bdevin\\/\\d/i],\n // https://knownagents.com/agents/novaact\n ['NovaAct', 'ai_assistant', /novaact/i],\n\n // AI search\n // https://developers.openai.com/api/docs/bots\n ['OAI-SearchBot', 'ai_search', /oai-searchbot/i],\n // https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler\n ['Claude-SearchBot', 'ai_search', /claude-searchbot/i],\n // https://docs.perplexity.ai/guides/bots\n ['PerplexityBot', 'ai_search', /perplexitybot/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['Meta-WebIndexer', 'ai_search', /meta-webindexer/i],\n // https://developer.amazon.com/amazonbot\n ['Amazonbot', 'ai_search', /amazonbot/i],\n // https://knownagents.com/agents/youbot\n ['YouBot', 'ai_search', /youbot/i],\n // https://knownagents.com/agents/phindbot\n ['PhindBot', 'ai_search', /phindbot/i],\n // https://developer.amazon.com/amazonbot\n ['Amzn-SearchBot', 'ai_search', /amzn-searchbot/i],\n // https://knownagents.com/agents/azureai-searchbot\n ['AzureAI-SearchBot', 'ai_search', /azureai-searchbot/i],\n // https://www.kimi.ai/policies/kimi-crawlers\n ['Kimi-SearchBot', 'ai_search', /kimi-searchbot/i],\n // https://docs.mistral.ai/robots\n ['MistralAI-Index', 'ai_search', /mistralai-index/i],\n // https://knownagents.com/agents/exasearchbot\n ['ExaSearchBot', 'ai_search', /exasearchbot|\\bexabot/i],\n // https://knownagents.com/agents/tavilybot\n ['TavilyBot', 'ai_search', /tavilybot/i],\n // https://linkup.so/bot\n ['LinkupBot', 'ai_search', /linkupbot/i],\n // https://knownagents.com/agents/iaskspider\n ['iAskBot', 'ai_search', /iask(?:bot|spider)/i],\n ['Andibot', 'ai_search', /andibot/i],\n // https://developers.cloudflare.com/autorag\n ['Cloudflare-AutoRAG', 'ai_search', /cloudflare-autorag/i],\n // https://docs.parallel.ai/resources/crawler\n ['ShapBot', 'ai_search', /shapbot/i],\n\n // AI training\n // https://developers.openai.com/api/docs/bots\n ['GPTBot', 'ai_crawler', /gptbot/i],\n // https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler\n ['ClaudeBot', 'ai_crawler', /claudebot/i],\n // https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler\n ['anthropic-ai', 'ai_crawler', /anthropic-ai/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['Meta-ExternalAgent', 'ai_crawler', /meta-externalagent/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['FacebookBot', 'ai_crawler', /facebookbot/i],\n // https://knownagents.com/agents/bytespider\n ['Bytespider', 'ai_crawler', /bytespider/i],\n // https://commoncrawl.org/ccbot\n ['CCBot', 'ai_crawler', /ccbot/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['Google-CloudVertexBot', 'ai_crawler', /google-cloudvertexbot/i],\n // https://knownagents.com/agents/cohere-training-data-crawler\n ['cohere-ai', 'ai_crawler', /cohere-(?:ai|training-data-crawler)/i],\n // https://www.diffbot.com/docs/crawl/faq/robots-txt\n ['Diffbot', 'ai_crawler', /diffbot/i],\n // https://knownagents.com/agents/webzio-extended\n ['Omgili', 'ai_crawler', /omgili|webzio-extended/i],\n // https://imagesift.com/about\n ['ImagesiftBot', 'ai_crawler', /imagesiftbot/i],\n // https://www.timpi.io\n ['Timpibot', 'ai_crawler', /timpibot/i],\n // https://knownagents.com/agents/ai2bot\n ['AI2Bot', 'ai_crawler', /ai2bot/i],\n // https://knownagents.com/agents/pangubot\n ['PanguBot', 'ai_crawler', /pangubot/i],\n // https://knownagents.com/agents/promptingbot\n ['PromptingBot', 'ai_crawler', /promptingbot/i],\n // https://knownagents.com/agents/reflectionbot\n ['Reflectionbot', 'ai_crawler', /reflectionbot/i],\n // https://knownagents.com/agents/tiktokspider\n ['TikTokSpider', 'ai_crawler', /tiktokspider/i],\n // https://knownagents.com/agents/deepseekbot\n ['DeepSeekBot', 'ai_crawler', /deepseekbot/i],\n // https://knownagents.com/agents/doubaobot\n ['DoubaoBot', 'ai_crawler', /doubaobot/i],\n // https://knownagents.com/agents/erniebot\n ['ERNIEBot', 'ai_crawler', /erniebot/i],\n // https://knownagents.com/agents/qwenbot\n ['QwenBot', 'ai_crawler', /qwenbot/i],\n // https://www.kimi.ai/policies/kimi-crawlers\n ['KimiBot', 'ai_crawler', /kimibot/i],\n // https://knownagents.com/agents/chatglm-spider\n ['ChatGLM-Spider', 'ai_crawler', /chatglm-spider/i],\n // https://docs.mistral.ai/robots\n ['MistralAI-Training', 'ai_crawler', /mistralai-training/i],\n // https://knownagents.com/agents/yandexadditional\n ['YandexAdditional', 'ai_crawler', /yandexadditional/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['Google-Extended', 'ai_crawler', /google-extended/i],\n // https://docs.aws.amazon.com/kendra/latest/dg/what-is-kendra.html\n ['Amazon Kendra', 'ai_crawler', /amazon-kendra|kendrabot/i],\n // https://knownagents.com/agents/bedrockbot\n ['bedrockbot', 'ai_crawler', /bedrockbot/i],\n // https://brightdata.com/brightbot\n ['Brightbot', 'ai_crawler', /brightbot/i],\n // https://firecrawl.dev\n ['FirecrawlAgent', 'ai_crawler', /firecrawl/i],\n // https://github.com/unclecode/crawl4ai\n ['Crawl4AI', 'ai_crawler', /crawl4ai/i],\n // https://apify.com/apify/website-content-crawler\n ['ApifyBot', 'ai_crawler', /apify/i],\n // https://github.com/rom1504/img2dataset\n ['img2dataset', 'ai_crawler', /img2dataset/i],\n // https://knownagents.com/agents/laion-huggingface-processor\n ['LAION', 'ai_crawler', /laion/i],\n // https://developers.cloudflare.com/browser-rendering/\n ['Cloudflare Browser Rendering', 'ai_crawler', /cloudflarebrowserrendering/i],\n\n // link previews\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['facebookexternalhit', 'link_preview', /facebookexternalhit/i],\n // https://developers.facebook.com/docs/sharing/webmasters/web-crawlers\n ['Facebot', 'link_preview', /facebot/i],\n // https://developer.x.com/en/docs/x-for-websites/cards/guides/getting-started\n ['Twitterbot', 'link_preview', /twitterbot/i],\n // https://www.linkedin.com/help/linkedin/answer/a521928\n ['LinkedInBot', 'link_preview', /linkedinbot/i],\n // https://api.slack.com/robots\n ['Slackbot', 'link_preview', /slackbot|slack-imgproxy/i],\n // https://discord.com\n ['Discordbot', 'link_preview', /discordbot/i],\n // https://core.telegram.org/bots\n ['TelegramBot', 'link_preview', /telegrambot/i],\n // https://www.whatsapp.com\n ['WhatsApp', 'link_preview', /^whatsapp\\//i],\n // https://www.pinterest.com/bot.html\n ['Pinterestbot', 'link_preview', /pinterestbot|^pinterest\\/0\\./i],\n // https://www.reddit.com\n ['redditbot', 'link_preview', /redditbot/i],\n // https://developers.snap.com/robots\n ['Snap URL Preview', 'link_preview', /snap url preview/i],\n // https://knownagents.com/agents/skypeuripreview\n ['SkypeUriPreview', 'link_preview', /skypeuripreview/i],\n // https://www.bing.com/webmasters/help/which-crawlers-does-bing-use-8c184ec0\n ['BingPreview', 'link_preview', /bingpreview|microsoftpreview/i],\n // https://iframely.com/docs/about\n ['Iframely', 'link_preview', /iframely/i],\n // https://embed.ly\n ['Embedly', 'link_preview', /embedly/i],\n // https://devtalk.kakao.com/t/scrap/33984\n ['KakaoTalk-scrap', 'link_preview', /kakaotalk-scrap/i],\n // https://vk.com/dev/Share\n ['vkShare', 'link_preview', /vkshare/i],\n // https://www.viber.com\n ['Viber', 'link_preview', /^viber\\b|viber-crawler/i],\n // https://github.com/bluesky-social/indigo\n ['Bluesky Cardyb', 'link_preview', /cardyb/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-user-triggered-fetchers\n ['Google-PageRenderer', 'link_preview', /google-pagerenderer/i],\n // https://vercel.com\n ['vercel-screenshot', 'link_preview', /vercel-screenshot/i],\n\n // SEO, marketing and page-speed tools; before the search crawlers, Lighthouse and the\n // Search Console tester borrow Google's name\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['Google-InspectionTool', 'seo_tool', /google-inspectiontool/i],\n // https://developer.chrome.com/docs/lighthouse\n ['Lighthouse', 'seo_tool', /chrome-lighthouse|google page speed insights/i],\n // https://gtmetrix.com\n ['GTmetrix', 'seo_tool', /gtmetrix/i],\n // https://ahrefs.com/robot\n ['AhrefsBot', 'seo_tool', /ahrefs(?:bot|siteaudit)/i],\n // https://www.semrush.com/bot/\n ['SemrushBot', 'seo_tool', /semrush/i],\n // https://mj12bot.com\n ['MJ12bot', 'seo_tool', /mj12bot/i],\n // https://moz.com/help/moz-procedures/crawlers/dotbot\n ['DotBot', 'seo_tool', /dotbot/i],\n // https://moz.com/help/moz-procedures/crawlers/rogerbot\n ['rogerbot', 'seo_tool', /rogerbot/i],\n // https://www.screamingfrog.co.uk/seo-spider/\n ['Screaming Frog', 'seo_tool', /screaming frog/i],\n // https://serpstatbot.com\n ['SerpstatBot', 'seo_tool', /serpstatbot/i],\n // https://webmeup-crawler.com\n ['BLEXBot', 'seo_tool', /blexbot/i],\n // https://dataforseo.com/dataforseo-bot\n ['DataForSeoBot', 'seo_tool', /dataforseobot/i],\n // https://knownagents.com/agents/hubspot-crawler\n ['HubSpot', 'seo_tool', /hubspot/i],\n // https://search.google.com/structured-data/testing-tool\n ['Google-Structured-Data-Testing-Tool', 'seo_tool', /google-structured-data-testing-tool/i],\n // https://www.webpagetest.org\n ['WebPageTest', 'seo_tool', /\\bptst\\/\\d/i],\n // https://www.dareboost.com\n ['DareBoost', 'seo_tool', /dareboost/i],\n // https://www.exensa.com/crawl\n ['Barkrowler', 'seo_tool', /barkrowler/i],\n // https://seranking.com/backlinks-crawler\n ['SE Ranking', 'seo_tool', /seranking|sebot-wa/i],\n // https://www.brightedge.com\n ['BrightEdge', 'seo_tool', /brightedge/i],\n // https://searchatlas.com\n ['SearchAtlas', 'seo_tool', /searchatlas/i],\n // https://www.siteimprove.com\n ['Siteimprove', 'seo_tool', /siteimprove/i],\n // https://www.dataprovider.com\n ['Dataprovider', 'seo_tool', /dataprovider\\.com/i],\n // https://www.meltwater.com\n ['Meltwater', 'seo_tool', /meltwater/i],\n // https://awario.com/bots.html\n ['Awario', 'seo_tool', /awario/i],\n\n // search engines\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['Googlebot', 'search_crawler', /googlebot/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['Storebot-Google', 'search_crawler', /storebot-google/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers\n ['GoogleOther', 'search_crawler', /googleother/i],\n // https://www.bing.com/webmasters/help/which-crawlers-does-bing-use-8c184ec0\n ['Bingbot', 'search_crawler', /bingbot/i],\n // https://support.apple.com/en-us/119829\n ['Applebot', 'search_crawler', /applebot/i],\n // https://www.baidu.com/search/spider.html\n ['Baiduspider', 'search_crawler', /baiduspider/i],\n // https://yandex.com/support/webmaster/robot-workings/check-yandex-robots.html\n ['YandexBot', 'search_crawler', /yandex(?:\\w*bot|images|metrika)/i],\n // https://duckduckgo.com/duckduckgo-help-pages/results/duckduckbot\n ['DuckDuckBot', 'search_crawler', /duckduckbot/i],\n // https://help.yahoo.com/kb/SLN22600.html\n ['Yahoo Slurp', 'search_crawler', /yahoo!?[\\s/]*slurp/i],\n // https://www.sogou.com/docs/help/webmasters.htm#07\n ['Sogou', 'search_crawler', /sogou[\\w\\s-]*spider/i],\n // https://www.so.com/help/help_3_2.html\n ['360Spider', 'search_crawler', /360spider|haosouspider/i],\n // https://knownagents.com/agents/yisouspider\n ['YisouSpider', 'search_crawler', /yisouspider/i],\n // https://webmaster.petalsearch.com/site/petalbot\n ['PetalBot', 'search_crawler', /petalbot/i],\n // https://napoveda.seznam.cz/en/seznambot-intro/\n ['SeznamBot', 'search_crawler', /seznambot/i],\n // https://knownagents.com/agents/yeti\n ['Yeti', 'search_crawler', /\\byeti\\//i],\n // https://help2.line.me/linesearchbot/web/?contentId=50006055&lang=en\n ['Linespider', 'search_crawler', /linespider/i],\n // https://help.qwant.com/bot/\n ['Qwantbot', 'search_crawler', /qwant(?:bot|ify)/i],\n // https://help.coccoc.com/searchengine\n ['coccocbot', 'search_crawler', /coccocbot/i],\n // https://www.mojeek.com/bot.html\n ['MojeekBot', 'search_crawler', /mojeekbot/i],\n // https://search.brave.com/help/brave-search-crawler\n ['Bravebot', 'search_crawler', /bravebot/i],\n // https://bot.seekport.com\n ['SeekportBot', 'search_crawler', /seekport/i],\n // https://mwmbl.org\n ['mwmbl', 'search_crawler', /mwmbl/i],\n // https://archive.org/details/archive.org_bot\n ['Internet Archive', 'search_crawler', /archive\\.org_bot|ia_archiver|archive-it|archiveteam/i],\n\n // monitoring, synthetics, security and consent scanners, service callers\n // https://www.pingdom.com\n ['Pingdom', 'monitoring', /pingdom/i],\n // https://uptimerobot.com\n ['UptimeRobot', 'monitoring', /uptimerobot/i],\n // https://www.statuscake.com\n ['StatusCake', 'monitoring', /statuscake/i],\n // https://www.site24x7.com\n ['Site24x7', 'monitoring', /site24x7/i],\n // https://betterstack.com/docs/uptime/\n ['Better Stack', 'monitoring', /better ?uptime|betterstack/i],\n // https://docs.datadoghq.com/synthetics/\n ['Datadog', 'monitoring', /datadog/i],\n // https://www.checklyhq.com/docs/\n ['Checkly', 'monitoring', /checkly/i],\n // https://docs.newrelic.com/docs/synthetics/\n ['NewRelicPinger', 'monitoring', /newrelicpinger/i],\n // https://github.com/louislam/uptime-kuma\n ['Uptime-Kuma', 'monitoring', /uptime-kuma/i],\n // https://grafana.com/docs/grafana-cloud/testing/synthetic-monitoring/\n ['Grafana Synthetic Monitoring', 'monitoring', /grafanasyntheticmonitoring/i],\n // https://docs.dynatrace.com/docs/observe/digital-experience/synthetic-monitoring\n ['Dynatrace', 'monitoring', /ruxitsynthetic|dynatrace/i],\n // https://docs.splunk.com/observability/en/synthetics/intro-synthetics.html\n ['Splunk', 'monitoring', /splunk/i],\n // https://www.catchpoint.com\n ['Catchpoint', 'monitoring', /catchpoint/i],\n // https://ghostinspector.com\n ['Ghost Inspector', 'monitoring', /ghost inspector/i],\n // https://docs.digitalocean.com/products/uptime/\n ['DigitalOcean Uptime', 'monitoring', /digitalocean uptime/i],\n // https://ohdear.app/docs/faq/what-is-the-oh-dear-checker\n ['OhDear', 'monitoring', /ohdear/i],\n // https://developers.google.com/crawling/docs/crawlers-fetchers/google-special-case-crawlers\n ['Google-Safety', 'monitoring', /google-safety/i],\n // https://www.cookiebot.com\n ['Cookiebot', 'monitoring', /cookiebot/i],\n // https://knownagents.com/agents/onetrust-cmp-scanner\n ['OneTrust', 'monitoring', /onetrust/i],\n // https://www.cookiehub.com\n ['CookieHub', 'monitoring', /cookiehub/i],\n // https://detectify.com/bot/\n ['Detectify', 'monitoring', /detectify/i],\n // https://about.censys.io\n ['CensysInspect', 'monitoring', /censysinspect/i],\n // https://www.bitsight.com\n ['BitSightBot', 'monitoring', /bitsightbot/i],\n // https://github.com/zmap/zgrab2\n ['zgrab', 'monitoring', /zgrab/i],\n // https://nmap.org/book/nse.html\n ['Nmap', 'monitoring', /nmap scripting engine/i],\n // https://docs.stripe.com/webhooks\n ['Stripe', 'monitoring', /stripe\\/1\\.0|stripebot|merchantsecurityscanner/i],\n\n // scripted browsers\n // https://developer.chrome.com/docs/chromium/headless\n ['HeadlessChrome', 'headless_browser', /headlesschrome/i],\n // https://phantomjs.org\n ['PhantomJS', 'headless_browser', /phantomjs/i],\n // https://slimerjs.org\n ['SlimerJS', 'headless_browser', /slimerjs/i],\n // https://playwright.dev\n ['Playwright', 'headless_browser', /playwright/i],\n // https://pptr.dev\n ['Puppeteer', 'headless_browser', /puppeteer/i],\n // https://www.selenium.dev\n ['Selenium', 'headless_browser', /selenium/i],\n // https://www.cypress.io\n ['Cypress', 'headless_browser', /cypress/i],\n // https://lightpanda.io\n ['Lightpanda', 'headless_browser', /lightpanda/i],\n // https://wkhtmltopdf.org\n ['wkhtmltopdf', 'headless_browser', /wkhtmltopdf/i],\n\n // libraries and command-line clients\n // https://curl.se\n ['curl', 'http_client', /^curl\\//i],\n // https://www.gnu.org/software/wget/\n ['Wget', 'http_client', /^wget\\//i],\n // https://requests.readthedocs.io\n ['python-requests', 'http_client', /python-requests/i],\n // https://docs.python.org/3/library/urllib.request.html\n ['python-urllib', 'http_client', /python-urllib/i],\n // https://docs.aiohttp.org\n ['aiohttp', 'http_client', /aiohttp/i],\n // https://www.python-httpx.org\n ['httpx', 'http_client', /python-httpx|^httpx\\//i],\n // https://scrapy.org\n ['Scrapy', 'http_client', /scrapy/i],\n // https://pkg.go.dev/net/http\n ['Go-http-client', 'http_client', /go-http-client/i],\n // https://github.com/square/okhttp\n ['okhttp', 'http_client', /^okhttp\\//i],\n // https://hc.apache.org/httpcomponents-client-5.5.x/\n ['Java', 'http_client', /^java\\/|apache-httpclient/i],\n // https://axios-http.com\n ['axios', 'http_client', /^axios\\//i],\n // https://github.com/node-fetch/node-fetch\n ['node-fetch', 'http_client', /node-fetch/i],\n // https://undici.nodejs.org\n ['undici', 'http_client', /^undici/i],\n // https://www.postman.com\n ['PostmanRuntime', 'http_client', /postmanruntime/i],\n // https://insomnia.rest\n ['insomnia', 'http_client', /^insomnia\\//i],\n // https://metacpan.org/pod/LWP\n ['libwww-perl', 'http_client', /libwww-perl/i],\n // https://docs.guzzlephp.org\n ['Guzzle', 'http_client', /guzzlehttp/i],\n // https://developers.google.com/apps-script/reference/url-fetch\n ['Google-Apps-Script', 'http_client', /google-apps-script/i],\n // https://support.google.com/docs/answer/3093339\n ['GoogleDocs', 'http_client', /googledocs/i],\n] as const satisfies readonly (readonly [string, BotCategory, RegExp])[];\n\nconst botishToken =\n /\\b([\\w.-]*?(?:bot|crawler|spider|scraper|fetcher|agent|preview|checker|monitor)[\\w-]*)\\b/i;\nconst botishWord = /^(?:bot|crawler|spider|scraper|fetcher|agent|preview|checker|monitor)$/i;\nconst compatibleToken = /compatible;\\s*([a-z][\\w.-]*(?: [a-z][\\w.-]*)?)/i;\nconst productTokens = /([a-z][\\w.-]*)\\/\\d/gi;\nconst browserToken =\n /^(?:mozilla|applewebkit|khtml|gecko|chrome|chromium|safari|version|mobile|firefox|edg|edge|opr|msie|trident)$/i;\n\n/**\n * A name for a bot that is not in the named table, from the first of: a token that sounds like\n * one (`Bytespider`, `ABEvalBot`), the name after `compatible;` (`Google-Read-Aloud`), a product\n * token that is not a browser's (`Barkrowler/0.5`), what the generic pattern matched. URLs and\n * email addresses are dropped first, as nearly every crawler links its docs.\n */\nexport function nameOfUnknownBot(userAgent: string, matched: string): string {\n const text = userAgent\n .replace(/\\+?https?:\\/\\/\\S+/gi, ' ')\n .replace(/[\\w.+-]+@[\\w-]+(?:\\.[\\w-]+)+/g, ' ');\n\n const botish = botishToken.exec(text)?.[1];\n if (botish && !botishWord.test(botish)) return botish.slice(0, 64);\n\n const compatible = compatibleToken.exec(text)?.[1];\n if (compatible && !browserToken.test(compatible)) return compatible.slice(0, 64);\n\n for (const [, product] of text.matchAll(productTokens)) {\n if (!browserToken.test(product)) return product.slice(0, 64);\n }\n\n return matched.replace(/^\\W+|\\W+$/g, '').slice(0, 64) || 'unknown';\n}\n\n/**\n * The request user agent of a page opened in Facebook's or Instagram's in-app browser when the\n * app sends the page's requests through its own network stack: `[FBAN/FB4A;FBAV/…]`,\n * `Instagram 445.0.0.34.44 (iPhone18,1; iOS 26_6_1; …) AppleWebKit/420+`. The page itself still\n * reads a browser's `navigator.userAgent`, which is why PostHog, GA4 and Matomo see a person.\n * isbot's generic pattern takes both for bots (a long token with no space, a product token that is\n * no browser's), so they are people here before it runs. Meta's ad prefetch loads only the HTML,\n * which runs no script and creates no visitor. The in-app browser's own user agent starts with\n * `Mozilla/5.0`, so the anchors leave it alone.\n */\nconst META_APP = /^\\[FBAN\\/|^Instagram \\d+(?:\\.\\d+)+ \\(/;\n\n/**\n * Whether a web visitor is a bot, which one, and what kind. Run on the server when the visitor\n * is created, with the tags it was created with: the user agent is the request's header\n * (`tags.user_agent`, which the server writes), not anything the client says about itself, so\n * the verdict can be recomputed from stored tags when the rules change.\n *\n * Call it for web visitors only: a native app's requests carry an HTTP library's user agent\n * (CFNetwork, okhttp) that would read as a bot, and no crawler runs the app.\n *\n * In order: a bot we can name; a browser driven by WebDriver (`tags.webdriver`, which the SDK\n * sets from `navigator.webdriver`, the one sign a scripted browser with a normal user agent\n * gives); a person in a Meta app (`META_APP`); anything the generic pattern calls automated; no\n * user agent at all.\n */\nexport function botOf(tags: TrackTags): Bot {\n const userAgent = typeof tags.user_agent === 'string' ? tags.user_agent.trim() : '';\n\n for (const [name, category, pattern] of NAMED_BOTS) {\n if (pattern.test(userAgent)) return { is_bot: true, bot_name: name, bot_category: category };\n }\n\n const generic = userAgent ? genericBot().exec(userAgent) : null;\n const unknownName = generic ? nameOfUnknownBot(userAgent, generic[0]) : null;\n\n // A scripted browser that says so in its user agent takes that name, else it is just WebDriver.\n if (tags.webdriver === true) {\n return { is_bot: true, bot_name: unknownName ?? 'WebDriver', bot_category: 'headless_browser' };\n }\n\n if (META_APP.test(userAgent)) return NOT_A_BOT;\n\n if (unknownName) return { is_bot: true, bot_name: unknownName, bot_category: 'other' };\n\n if (!userAgent)\n return { is_bot: true, bot_name: '(no user agent)', bot_category: 'no_user_agent' };\n\n return NOT_A_BOT;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAYA,MAAa,YAAiB;CAAE,QAAQ;CAAO,UAAU;CAAM,cAAc;AAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BlF,MAAa,aAAa;CAGxB;EAAC;EAAoB;EAAe;CAAmB;CAEvD;EAAC;EAAmB;EAAe;CAAkB;CAErD;EAAC;EAAiB;EAAe;CAAgB;CAEjD;EAAC;EAAwB;EAAe;CAAuB;CAE/D;EAAC;EAAY;EAAe;CAAW;CAEvC;EAAC;EAAkB;EAAe;CAAiB;CAEnD;EAAC;EAA0B;EAAe;CAA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AI,QAAQ,KAAK,SAAS,GAAG,OAAO;EAAE,QAAQ;EAAM,UAAU;EAAM,cAAc;CAAS;CAG7F,MAAM,UAAU,YAAY,WAAW,CAAC,CAAC,KAAK,SAAS,IAAI;CAC3D,MAAM,cAAc,UAAU,iBAAiB,WAAW,QAAQ,EAAE,IAAI;CAGxE,IAAI,KAAK,cAAc,MACrB,OAAO;EAAE,QAAQ;EAAM,UAAU,eAAe;EAAa,cAAc;CAAmB;CAGhG,IAAI,SAAS,KAAK,SAAS,GAAG,OAAO;CAErC,IAAI,aAAa,OAAO;EAAE,QAAQ;EAAM,UAAU;EAAa,cAAc;CAAQ;CAErF,IAAI,CAAC,WACH,OAAO;EAAE,QAAQ;EAAM,UAAU;EAAmB,cAAc;CAAgB;CAEpF,OAAO;AACT"}
@@ -3,17 +3,57 @@ const require_track_index = require("../track/index.cjs");
3
3
  let react = require("react");
4
4
  // src/hooks/use-outbound-click-analytics.ts
5
5
  /**
6
- * Tracks outbound link clicks - when a user clicks a link that leads away
7
- * from the current domain to another website.
6
+ * The registrable domain (eTLD+1) of `hostname`, found the way gtag's `cookie_domain: 'auto'`
7
+ * finds it: a cookie is tried on each suffix from the shortest up, and the first one the browser
8
+ * accepts is the domain — browsers refuse public suffixes (`com`, `co.uk`), so no suffix list is
9
+ * needed. A hostname without dots (`localhost`) or one no suffix accepts (an IP address) is its
10
+ * own domain. `probe` tries one suffix and says whether the cookie stuck.
11
+ */
12
+ function registrableDomain(hostname, probe = canSetCookieOn) {
13
+ const labels = hostname.split(".");
14
+ if (labels.length < 2 || /^[\d.]+$/.test(hostname)) return hostname;
15
+ for (let i = labels.length - 2; i >= 0; i -= 1) {
16
+ const candidate = labels.slice(i).join(".");
17
+ if (probe(candidate)) return candidate;
18
+ }
19
+ return hostname;
20
+ }
21
+ const PROBE = "_sa_d";
22
+ function canSetCookieOn(domain) {
23
+ try {
24
+ document.cookie = `${PROBE}=1; domain=${domain}; path=/; SameSite=Lax`;
25
+ const stuck = document.cookie.split("; ").includes(`${PROBE}=1`);
26
+ if (stuck) document.cookie = `${PROBE}=; domain=${domain}; path=/; max-age=0; SameSite=Lax`;
27
+ return stuck;
28
+ } catch {
29
+ return false;
30
+ }
31
+ }
32
+ /**
33
+ * Whether a link leads away from the site, by GA4's definition of an outbound click: an http(s)
34
+ * link to a host that is not the site's registrable domain or a subdomain of it. `mailto:`,
35
+ * `tel:` and the like are not outbound clicks (GA4 never counts them), and `www.` → `app.` is
36
+ * not leaving the site.
37
+ */
38
+ function isOutboundLink(url, siteDomain) {
39
+ if (url.protocol !== "http:" && url.protocol !== "https:") return false;
40
+ const host = url.hostname;
41
+ return host !== siteDomain && !host.endsWith(`.${siteDomain}`);
42
+ }
43
+ /**
44
+ * Tracks outbound link clicks - when a user clicks a link that leads away from the site to
45
+ * another website (see `isOutboundLink`).
8
46
  */
9
47
  function useOutboundClickAnalytics() {
10
48
  (0, react.useEffect)(() => {
49
+ const siteDomain = registrableDomain(window.location.hostname);
11
50
  const onClick = (event) => {
12
51
  const anchor = event.target.closest("a");
13
52
  if (!anchor?.href) return;
14
53
  try {
15
54
  const url = new URL(anchor.href, window.location.origin);
16
- if (url.hostname !== window.location.hostname) require_track_index.track("click", {
55
+ if (!isOutboundLink(url, siteDomain)) return;
56
+ require_track_index.track("click", {
17
57
  outbound: true,
18
58
  link_id: anchor.id || "",
19
59
  link_url: anchor.href,
@@ -30,6 +70,8 @@ function useOutboundClickAnalytics() {
30
70
  return () => document.removeEventListener("click", onClick, { capture: true });
31
71
  }, []);
32
72
  }
73
+ exports.isOutboundLink = isOutboundLink;
74
+ exports.registrableDomain = registrableDomain;
33
75
  exports.useOutboundClickAnalytics = useOutboundClickAnalytics;
34
76
 
35
77
  //# sourceMappingURL=use-outbound-click-analytics.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-outbound-click-analytics.cjs","names":[],"sources":["../../src/hooks/use-outbound-click-analytics.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { track } from '../track/index';\n\n/**\n * Tracks outbound link clicks - when a user clicks a link that leads away\n * from the current domain to another website.\n */\nexport function useOutboundClickAnalytics() {\n useEffect(() => {\n const onClick = (event: MouseEvent) => {\n // Find the closest anchor element from the clicked target\n const target = event.target as HTMLElement;\n const anchor = target.closest('a');\n if (!anchor?.href) return;\n\n try {\n const url = new URL(anchor.href, window.location.origin);\n\n // Check if it's an external link (different hostname)\n if (url.hostname !== window.location.hostname) {\n track('click', {\n outbound: true,\n link_id: anchor.id || '',\n link_url: anchor.href,\n // An anchor can wrap a whole card, so its text runs to kilobytes of markup content\n // that no report ever looks at. 100 characters is what GA4 keeps of a text event\n // parameter, and the transport limit is well above it either way.\n link_text: anchor.textContent.trim().slice(0, 512),\n link_domain: url.hostname,\n link_classes: anchor.className || '',\n });\n }\n } catch {\n // Invalid URL, ignore\n }\n };\n\n document.addEventListener('click', onClick, { passive: true, capture: true });\n return () => document.removeEventListener('click', onClick, { capture: true });\n }, []);\n}\n"],"mappings":";;;;;;;;AAOA,SAAgB,4BAA4B;CAC1C,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,MAAM,WAAW,UAAsB;GAGrC,MAAM,SADS,MAAM,OACC,QAAQ,GAAG;GACjC,IAAI,CAAC,QAAQ,MAAM;GAEnB,IAAI;IACF,MAAM,MAAM,IAAI,IAAI,OAAO,MAAM,OAAO,SAAS,MAAM;IAGvD,IAAI,IAAI,aAAa,OAAO,SAAS,UACnC,oBAAA,MAAM,SAAS;KACb,UAAU;KACV,SAAS,OAAO,MAAM;KACtB,UAAU,OAAO;KAIjB,WAAW,OAAO,YAAY,KAAK,CAAC,CAAC,MAAM,GAAG,GAAG;KACjD,aAAa,IAAI;KACjB,cAAc,OAAO,aAAa;IACpC,CAAC;GAEL,QAAQ,CAER;EACF;EAEA,SAAS,iBAAiB,SAAS,SAAS;GAAE,SAAS;GAAM,SAAS;EAAK,CAAC;EAC5E,aAAa,SAAS,oBAAoB,SAAS,SAAS,EAAE,SAAS,KAAK,CAAC;CAC/E,GAAG,CAAC,CAAC;AACP"}
1
+ {"version":3,"file":"use-outbound-click-analytics.cjs","names":[],"sources":["../../src/hooks/use-outbound-click-analytics.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { track } from '../track/index';\n\n/**\n * The registrable domain (eTLD+1) of `hostname`, found the way gtag's `cookie_domain: 'auto'`\n * finds it: a cookie is tried on each suffix from the shortest up, and the first one the browser\n * accepts is the domain — browsers refuse public suffixes (`com`, `co.uk`), so no suffix list is\n * needed. A hostname without dots (`localhost`) or one no suffix accepts (an IP address) is its\n * own domain. `probe` tries one suffix and says whether the cookie stuck.\n */\nexport function registrableDomain(\n hostname: string,\n probe: (domain: string) => boolean = canSetCookieOn\n): string {\n const labels = hostname.split('.');\n if (labels.length < 2 || /^[\\d.]+$/.test(hostname)) return hostname;\n for (let i = labels.length - 2; i >= 0; i -= 1) {\n const candidate = labels.slice(i).join('.');\n if (probe(candidate)) return candidate;\n }\n return hostname;\n}\n\nconst PROBE = '_sa_d';\n\nfunction canSetCookieOn(domain: string): boolean {\n try {\n document.cookie = `${PROBE}=1; domain=${domain}; path=/; SameSite=Lax`;\n const stuck = document.cookie.split('; ').includes(`${PROBE}=1`);\n if (stuck) document.cookie = `${PROBE}=; domain=${domain}; path=/; max-age=0; SameSite=Lax`;\n return stuck;\n } catch {\n return false;\n }\n}\n\n/**\n * Whether a link leads away from the site, by GA4's definition of an outbound click: an http(s)\n * link to a host that is not the site's registrable domain or a subdomain of it. `mailto:`,\n * `tel:` and the like are not outbound clicks (GA4 never counts them), and `www.` → `app.` is\n * not leaving the site.\n */\nexport function isOutboundLink(url: URL, siteDomain: string): boolean {\n if (url.protocol !== 'http:' && url.protocol !== 'https:') return false;\n const host = url.hostname;\n return host !== siteDomain && !host.endsWith(`.${siteDomain}`);\n}\n\n/**\n * Tracks outbound link clicks - when a user clicks a link that leads away from the site to\n * another website (see `isOutboundLink`).\n */\nexport function useOutboundClickAnalytics() {\n useEffect(() => {\n const siteDomain = registrableDomain(window.location.hostname);\n const onClick = (event: MouseEvent) => {\n // Find the closest anchor element from the clicked target\n const target = event.target as HTMLElement;\n const anchor = target.closest('a');\n if (!anchor?.href) return;\n\n try {\n const url = new URL(anchor.href, window.location.origin);\n if (!isOutboundLink(url, siteDomain)) return;\n track('click', {\n outbound: true,\n link_id: anchor.id || '',\n link_url: anchor.href,\n // An anchor can wrap a whole card, so its text runs to kilobytes of markup content\n // that no report ever looks at. GA4 keeps 100 characters of a text event parameter;\n // 512 leaves room for the whole label of a long button while staying well under the\n // transport limit.\n link_text: anchor.textContent.trim().slice(0, 512),\n link_domain: url.hostname,\n link_classes: anchor.className || '',\n });\n } catch {\n // Invalid URL, ignore\n }\n };\n\n document.addEventListener('click', onClick, { passive: true, capture: true });\n return () => document.removeEventListener('click', onClick, { capture: true });\n }, []);\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAgB,kBACd,UACA,QAAqC,gBAC7B;CACR,MAAM,SAAS,SAAS,MAAM,GAAG;CACjC,IAAI,OAAO,SAAS,KAAK,WAAW,KAAK,QAAQ,GAAG,OAAO;CAC3D,KAAK,IAAI,IAAI,OAAO,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG;EAC9C,MAAM,YAAY,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG;EAC1C,IAAI,MAAM,SAAS,GAAG,OAAO;CAC/B;CACA,OAAO;AACT;AAEA,MAAM,QAAQ;AAEd,SAAS,eAAe,QAAyB;CAC/C,IAAI;EACF,SAAS,SAAS,GAAG,MAAM,aAAa,OAAO;EAC/C,MAAM,QAAQ,SAAS,OAAO,MAAM,IAAI,CAAC,CAAC,SAAS,GAAG,MAAM,GAAG;EAC/D,IAAI,OAAO,SAAS,SAAS,GAAG,MAAM,YAAY,OAAO;EACzD,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;;;;;;;AAQA,SAAgB,eAAe,KAAU,YAA6B;CACpE,IAAI,IAAI,aAAa,WAAW,IAAI,aAAa,UAAU,OAAO;CAClE,MAAM,OAAO,IAAI;CACjB,OAAO,SAAS,cAAc,CAAC,KAAK,SAAS,IAAI,YAAY;AAC/D;;;;;AAMA,SAAgB,4BAA4B;CAC1C,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,MAAM,aAAa,kBAAkB,OAAO,SAAS,QAAQ;EAC7D,MAAM,WAAW,UAAsB;GAGrC,MAAM,SADS,MAAM,OACC,QAAQ,GAAG;GACjC,IAAI,CAAC,QAAQ,MAAM;GAEnB,IAAI;IACF,MAAM,MAAM,IAAI,IAAI,OAAO,MAAM,OAAO,SAAS,MAAM;IACvD,IAAI,CAAC,eAAe,KAAK,UAAU,GAAG;IACtC,oBAAA,MAAM,SAAS;KACb,UAAU;KACV,SAAS,OAAO,MAAM;KACtB,UAAU,OAAO;KAKjB,WAAW,OAAO,YAAY,KAAK,CAAC,CAAC,MAAM,GAAG,GAAG;KACjD,aAAa,IAAI;KACjB,cAAc,OAAO,aAAa;IACpC,CAAC;GACH,QAAQ,CAER;EACF;EAEA,SAAS,iBAAiB,SAAS,SAAS;GAAE,SAAS;GAAM,SAAS;EAAK,CAAC;EAC5E,aAAa,SAAS,oBAAoB,SAAS,SAAS,EAAE,SAAS,KAAK,CAAC;CAC/E,GAAG,CAAC,CAAC;AACP"}
@@ -1,6 +1,21 @@
1
1
  /**
2
- * Tracks outbound link clicks - when a user clicks a link that leads away
3
- * from the current domain to another website.
2
+ * The registrable domain (eTLD+1) of `hostname`, found the way gtag's `cookie_domain: 'auto'`
3
+ * finds it: a cookie is tried on each suffix from the shortest up, and the first one the browser
4
+ * accepts is the domain — browsers refuse public suffixes (`com`, `co.uk`), so no suffix list is
5
+ * needed. A hostname without dots (`localhost`) or one no suffix accepts (an IP address) is its
6
+ * own domain. `probe` tries one suffix and says whether the cookie stuck.
7
+ */
8
+ export declare function registrableDomain(hostname: string, probe?: (domain: string) => boolean): string;
9
+ /**
10
+ * Whether a link leads away from the site, by GA4's definition of an outbound click: an http(s)
11
+ * link to a host that is not the site's registrable domain or a subdomain of it. `mailto:`,
12
+ * `tel:` and the like are not outbound clicks (GA4 never counts them), and `www.` → `app.` is
13
+ * not leaving the site.
14
+ */
15
+ export declare function isOutboundLink(url: URL, siteDomain: string): boolean;
16
+ /**
17
+ * Tracks outbound link clicks - when a user clicks a link that leads away from the site to
18
+ * another website (see `isOutboundLink`).
4
19
  */
5
20
  export declare function useOutboundClickAnalytics(): void;
6
21
  //# sourceMappingURL=use-outbound-click-analytics.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-outbound-click-analytics.d.cts","names":[],"sources":["../../src/hooks/use-outbound-click-analytics.ts"],"mappings":";;;;wBAOgB"}
1
+ {"version":3,"file":"use-outbound-click-analytics.d.cts","names":[],"sources":["../../src/hooks/use-outbound-click-analytics.ts"],"mappings":";;;;;;;wBAUgB,kBACd,kBACA,SAAQ;;;;;;;wBA8BM,eAAe,KAAK,KAAK;;;;;wBAUzB"}
@@ -1,6 +1,21 @@
1
1
  /**
2
- * Tracks outbound link clicks - when a user clicks a link that leads away
3
- * from the current domain to another website.
2
+ * The registrable domain (eTLD+1) of `hostname`, found the way gtag's `cookie_domain: 'auto'`
3
+ * finds it: a cookie is tried on each suffix from the shortest up, and the first one the browser
4
+ * accepts is the domain — browsers refuse public suffixes (`com`, `co.uk`), so no suffix list is
5
+ * needed. A hostname without dots (`localhost`) or one no suffix accepts (an IP address) is its
6
+ * own domain. `probe` tries one suffix and says whether the cookie stuck.
7
+ */
8
+ export declare function registrableDomain(hostname: string, probe?: (domain: string) => boolean): string;
9
+ /**
10
+ * Whether a link leads away from the site, by GA4's definition of an outbound click: an http(s)
11
+ * link to a host that is not the site's registrable domain or a subdomain of it. `mailto:`,
12
+ * `tel:` and the like are not outbound clicks (GA4 never counts them), and `www.` → `app.` is
13
+ * not leaving the site.
14
+ */
15
+ export declare function isOutboundLink(url: URL, siteDomain: string): boolean;
16
+ /**
17
+ * Tracks outbound link clicks - when a user clicks a link that leads away from the site to
18
+ * another website (see `isOutboundLink`).
4
19
  */
5
20
  export declare function useOutboundClickAnalytics(): void;
6
21
  //# sourceMappingURL=use-outbound-click-analytics.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-outbound-click-analytics.d.mts","names":[],"sources":["../../src/hooks/use-outbound-click-analytics.ts"],"mappings":";;;;wBAOgB"}
1
+ {"version":3,"file":"use-outbound-click-analytics.d.mts","names":[],"sources":["../../src/hooks/use-outbound-click-analytics.ts"],"mappings":";;;;;;;wBAUgB,kBACd,kBACA,SAAQ;;;;;;;wBA8BM,eAAe,KAAK,KAAK;;;;;wBAUzB"}
@@ -2,17 +2,57 @@ import { track } from "../track/index.mjs";
2
2
  import { useEffect } from "react";
3
3
  // src/hooks/use-outbound-click-analytics.ts
4
4
  /**
5
- * Tracks outbound link clicks - when a user clicks a link that leads away
6
- * from the current domain to another website.
5
+ * The registrable domain (eTLD+1) of `hostname`, found the way gtag's `cookie_domain: 'auto'`
6
+ * finds it: a cookie is tried on each suffix from the shortest up, and the first one the browser
7
+ * accepts is the domain — browsers refuse public suffixes (`com`, `co.uk`), so no suffix list is
8
+ * needed. A hostname without dots (`localhost`) or one no suffix accepts (an IP address) is its
9
+ * own domain. `probe` tries one suffix and says whether the cookie stuck.
10
+ */
11
+ function registrableDomain(hostname, probe = canSetCookieOn) {
12
+ const labels = hostname.split(".");
13
+ if (labels.length < 2 || /^[\d.]+$/.test(hostname)) return hostname;
14
+ for (let i = labels.length - 2; i >= 0; i -= 1) {
15
+ const candidate = labels.slice(i).join(".");
16
+ if (probe(candidate)) return candidate;
17
+ }
18
+ return hostname;
19
+ }
20
+ const PROBE = "_sa_d";
21
+ function canSetCookieOn(domain) {
22
+ try {
23
+ document.cookie = `${PROBE}=1; domain=${domain}; path=/; SameSite=Lax`;
24
+ const stuck = document.cookie.split("; ").includes(`${PROBE}=1`);
25
+ if (stuck) document.cookie = `${PROBE}=; domain=${domain}; path=/; max-age=0; SameSite=Lax`;
26
+ return stuck;
27
+ } catch {
28
+ return false;
29
+ }
30
+ }
31
+ /**
32
+ * Whether a link leads away from the site, by GA4's definition of an outbound click: an http(s)
33
+ * link to a host that is not the site's registrable domain or a subdomain of it. `mailto:`,
34
+ * `tel:` and the like are not outbound clicks (GA4 never counts them), and `www.` → `app.` is
35
+ * not leaving the site.
36
+ */
37
+ function isOutboundLink(url, siteDomain) {
38
+ if (url.protocol !== "http:" && url.protocol !== "https:") return false;
39
+ const host = url.hostname;
40
+ return host !== siteDomain && !host.endsWith(`.${siteDomain}`);
41
+ }
42
+ /**
43
+ * Tracks outbound link clicks - when a user clicks a link that leads away from the site to
44
+ * another website (see `isOutboundLink`).
7
45
  */
8
46
  function useOutboundClickAnalytics() {
9
47
  useEffect(() => {
48
+ const siteDomain = registrableDomain(window.location.hostname);
10
49
  const onClick = (event) => {
11
50
  const anchor = event.target.closest("a");
12
51
  if (!anchor?.href) return;
13
52
  try {
14
53
  const url = new URL(anchor.href, window.location.origin);
15
- if (url.hostname !== window.location.hostname) track("click", {
54
+ if (!isOutboundLink(url, siteDomain)) return;
55
+ track("click", {
16
56
  outbound: true,
17
57
  link_id: anchor.id || "",
18
58
  link_url: anchor.href,
@@ -29,6 +69,6 @@ function useOutboundClickAnalytics() {
29
69
  return () => document.removeEventListener("click", onClick, { capture: true });
30
70
  }, []);
31
71
  }
32
- export { useOutboundClickAnalytics };
72
+ export { isOutboundLink, registrableDomain, useOutboundClickAnalytics };
33
73
 
34
74
  //# sourceMappingURL=use-outbound-click-analytics.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-outbound-click-analytics.mjs","names":[],"sources":["../../src/hooks/use-outbound-click-analytics.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { track } from '../track/index';\n\n/**\n * Tracks outbound link clicks - when a user clicks a link that leads away\n * from the current domain to another website.\n */\nexport function useOutboundClickAnalytics() {\n useEffect(() => {\n const onClick = (event: MouseEvent) => {\n // Find the closest anchor element from the clicked target\n const target = event.target as HTMLElement;\n const anchor = target.closest('a');\n if (!anchor?.href) return;\n\n try {\n const url = new URL(anchor.href, window.location.origin);\n\n // Check if it's an external link (different hostname)\n if (url.hostname !== window.location.hostname) {\n track('click', {\n outbound: true,\n link_id: anchor.id || '',\n link_url: anchor.href,\n // An anchor can wrap a whole card, so its text runs to kilobytes of markup content\n // that no report ever looks at. 100 characters is what GA4 keeps of a text event\n // parameter, and the transport limit is well above it either way.\n link_text: anchor.textContent.trim().slice(0, 512),\n link_domain: url.hostname,\n link_classes: anchor.className || '',\n });\n }\n } catch {\n // Invalid URL, ignore\n }\n };\n\n document.addEventListener('click', onClick, { passive: true, capture: true });\n return () => document.removeEventListener('click', onClick, { capture: true });\n }, []);\n}\n"],"mappings":";;;;;;;AAOA,SAAgB,4BAA4B;CAC1C,gBAAgB;EACd,MAAM,WAAW,UAAsB;GAGrC,MAAM,SADS,MAAM,OACC,QAAQ,GAAG;GACjC,IAAI,CAAC,QAAQ,MAAM;GAEnB,IAAI;IACF,MAAM,MAAM,IAAI,IAAI,OAAO,MAAM,OAAO,SAAS,MAAM;IAGvD,IAAI,IAAI,aAAa,OAAO,SAAS,UACnC,MAAM,SAAS;KACb,UAAU;KACV,SAAS,OAAO,MAAM;KACtB,UAAU,OAAO;KAIjB,WAAW,OAAO,YAAY,KAAK,CAAC,CAAC,MAAM,GAAG,GAAG;KACjD,aAAa,IAAI;KACjB,cAAc,OAAO,aAAa;IACpC,CAAC;GAEL,QAAQ,CAER;EACF;EAEA,SAAS,iBAAiB,SAAS,SAAS;GAAE,SAAS;GAAM,SAAS;EAAK,CAAC;EAC5E,aAAa,SAAS,oBAAoB,SAAS,SAAS,EAAE,SAAS,KAAK,CAAC;CAC/E,GAAG,CAAC,CAAC;AACP"}
1
+ {"version":3,"file":"use-outbound-click-analytics.mjs","names":[],"sources":["../../src/hooks/use-outbound-click-analytics.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { track } from '../track/index';\n\n/**\n * The registrable domain (eTLD+1) of `hostname`, found the way gtag's `cookie_domain: 'auto'`\n * finds it: a cookie is tried on each suffix from the shortest up, and the first one the browser\n * accepts is the domain — browsers refuse public suffixes (`com`, `co.uk`), so no suffix list is\n * needed. A hostname without dots (`localhost`) or one no suffix accepts (an IP address) is its\n * own domain. `probe` tries one suffix and says whether the cookie stuck.\n */\nexport function registrableDomain(\n hostname: string,\n probe: (domain: string) => boolean = canSetCookieOn\n): string {\n const labels = hostname.split('.');\n if (labels.length < 2 || /^[\\d.]+$/.test(hostname)) return hostname;\n for (let i = labels.length - 2; i >= 0; i -= 1) {\n const candidate = labels.slice(i).join('.');\n if (probe(candidate)) return candidate;\n }\n return hostname;\n}\n\nconst PROBE = '_sa_d';\n\nfunction canSetCookieOn(domain: string): boolean {\n try {\n document.cookie = `${PROBE}=1; domain=${domain}; path=/; SameSite=Lax`;\n const stuck = document.cookie.split('; ').includes(`${PROBE}=1`);\n if (stuck) document.cookie = `${PROBE}=; domain=${domain}; path=/; max-age=0; SameSite=Lax`;\n return stuck;\n } catch {\n return false;\n }\n}\n\n/**\n * Whether a link leads away from the site, by GA4's definition of an outbound click: an http(s)\n * link to a host that is not the site's registrable domain or a subdomain of it. `mailto:`,\n * `tel:` and the like are not outbound clicks (GA4 never counts them), and `www.` → `app.` is\n * not leaving the site.\n */\nexport function isOutboundLink(url: URL, siteDomain: string): boolean {\n if (url.protocol !== 'http:' && url.protocol !== 'https:') return false;\n const host = url.hostname;\n return host !== siteDomain && !host.endsWith(`.${siteDomain}`);\n}\n\n/**\n * Tracks outbound link clicks - when a user clicks a link that leads away from the site to\n * another website (see `isOutboundLink`).\n */\nexport function useOutboundClickAnalytics() {\n useEffect(() => {\n const siteDomain = registrableDomain(window.location.hostname);\n const onClick = (event: MouseEvent) => {\n // Find the closest anchor element from the clicked target\n const target = event.target as HTMLElement;\n const anchor = target.closest('a');\n if (!anchor?.href) return;\n\n try {\n const url = new URL(anchor.href, window.location.origin);\n if (!isOutboundLink(url, siteDomain)) return;\n track('click', {\n outbound: true,\n link_id: anchor.id || '',\n link_url: anchor.href,\n // An anchor can wrap a whole card, so its text runs to kilobytes of markup content\n // that no report ever looks at. GA4 keeps 100 characters of a text event parameter;\n // 512 leaves room for the whole label of a long button while staying well under the\n // transport limit.\n link_text: anchor.textContent.trim().slice(0, 512),\n link_domain: url.hostname,\n link_classes: anchor.className || '',\n });\n } catch {\n // Invalid URL, ignore\n }\n };\n\n document.addEventListener('click', onClick, { passive: true, capture: true });\n return () => document.removeEventListener('click', onClick, { capture: true });\n }, []);\n}\n"],"mappings":";;;;;;;;;;AAUA,SAAgB,kBACd,UACA,QAAqC,gBAC7B;CACR,MAAM,SAAS,SAAS,MAAM,GAAG;CACjC,IAAI,OAAO,SAAS,KAAK,WAAW,KAAK,QAAQ,GAAG,OAAO;CAC3D,KAAK,IAAI,IAAI,OAAO,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG;EAC9C,MAAM,YAAY,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG;EAC1C,IAAI,MAAM,SAAS,GAAG,OAAO;CAC/B;CACA,OAAO;AACT;AAEA,MAAM,QAAQ;AAEd,SAAS,eAAe,QAAyB;CAC/C,IAAI;EACF,SAAS,SAAS,GAAG,MAAM,aAAa,OAAO;EAC/C,MAAM,QAAQ,SAAS,OAAO,MAAM,IAAI,CAAC,CAAC,SAAS,GAAG,MAAM,GAAG;EAC/D,IAAI,OAAO,SAAS,SAAS,GAAG,MAAM,YAAY,OAAO;EACzD,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;;;;;;;AAQA,SAAgB,eAAe,KAAU,YAA6B;CACpE,IAAI,IAAI,aAAa,WAAW,IAAI,aAAa,UAAU,OAAO;CAClE,MAAM,OAAO,IAAI;CACjB,OAAO,SAAS,cAAc,CAAC,KAAK,SAAS,IAAI,YAAY;AAC/D;;;;;AAMA,SAAgB,4BAA4B;CAC1C,gBAAgB;EACd,MAAM,aAAa,kBAAkB,OAAO,SAAS,QAAQ;EAC7D,MAAM,WAAW,UAAsB;GAGrC,MAAM,SADS,MAAM,OACC,QAAQ,GAAG;GACjC,IAAI,CAAC,QAAQ,MAAM;GAEnB,IAAI;IACF,MAAM,MAAM,IAAI,IAAI,OAAO,MAAM,OAAO,SAAS,MAAM;IACvD,IAAI,CAAC,eAAe,KAAK,UAAU,GAAG;IACtC,MAAM,SAAS;KACb,UAAU;KACV,SAAS,OAAO,MAAM;KACtB,UAAU,OAAO;KAKjB,WAAW,OAAO,YAAY,KAAK,CAAC,CAAC,MAAM,GAAG,GAAG;KACjD,aAAa,IAAI;KACjB,cAAc,OAAO,aAAa;IACpC,CAAC;GACH,QAAQ,CAER;EACF;EAEA,SAAS,iBAAiB,SAAS,SAAS;GAAE,SAAS;GAAM,SAAS;EAAK,CAAC;EAC5E,aAAa,SAAS,oBAAoB,SAAS,SAAS,EAAE,SAAS,KAAK,CAAC;CAC/E,GAAG,CAAC,CAAC;AACP"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shware/analytics",
3
- "version": "16.3.1",
3
+ "version": "16.3.3",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -137,7 +137,7 @@
137
137
  },
138
138
  "dependencies": {
139
139
  "@posthog/types": "^1.419.0",
140
- "@shware/utils": "^2.0.2",
140
+ "@shware/utils": "^2.0.3",
141
141
  "capi-param-builder-nodejs": "~1.3.2",
142
142
  "cookie": "^2.0.1",
143
143
  "uuid": "^14.0.3",