Skip to content

Commit 180751f

Browse files
chihsuanmatticbot
authored andcommitted
Add bot detection to skip event recording in analytics tracking (#45552)
* Add bot detection to skip event recording in analytics tracking - Implemented a method to identify bot requests based on user agent. - Updated event recording logic to skip events from detected bots. - Fixed a typo in the method documentation for event name parameter. * changelog * Update bot detection regex in analytics tracking to improve accuracy - Replaced the existing user agent regex with a more comprehensive pattern to identify a wider range of bots. - Adjusted regex delimiters to prevent issues with unescaped characters. * Add new bot user agents to detection list - Expanded the list of recognized bot user agents in the User_Agent_Info class to include various new bots, enhancing the accuracy of bot detection. - This update includes well-known bots such as gptbot, claudebot, and others, improving overall functionality. * Integrate Device Detection for Bot Tracking - Added the Device Detection package to enhance bot detection capabilities in analytics tracking. - Updated the logic to utilize the existing bot detection method, improving accuracy in skipping event recording for bot requests. - Revised changelog entry for clarity on the changes made. * Update changelog * Update composer.lock * changelog Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/18773616520 Upstream-Ref: Automattic/jetpack@ba5ff5f
1 parent c787832 commit 180751f

File tree

6 files changed

+184
-12
lines changed

6 files changed

+184
-12
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type": "wordpress-plugin",
55
"license": "GPL-2.0-or-later",
66
"require": {
7-
"automattic/jetpack-device-detection": "^3.1.0"
7+
"automattic/jetpack-device-detection": "^3.1.1-alpha"
88
},
99
"require-dev": {
1010
"yoast/phpunit-polyfills": "^4.0.0",

composer.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/automattic/jetpack-device-detection/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [3.1.1-alpha] - unreleased
9+
10+
This is an alpha version! The changes listed here are not final.
11+
12+
### Changed
13+
- Add missing bot agents to bot detection
14+
815
## [3.1.0] - 2025-10-10
916
### Added
1017
- Filter data for SEO bot. [#45431]
@@ -252,6 +259,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
252259

253260
- Moving jetpack_is_mobile into a package
254261

262+
[3.1.1-alpha]: https://github.com/Automattic/jetpack-device-detection/compare/v3.1.0...v3.1.1-alpha
255263
[3.1.0]: https://github.com/Automattic/jetpack-device-detection/compare/v3.0.9...v3.1.0
256264
[3.0.9]: https://github.com/Automattic/jetpack-device-detection/compare/v3.0.8...v3.0.9
257265
[3.0.8]: https://github.com/Automattic/jetpack-device-detection/compare/v3.0.7...v3.0.8

vendor/automattic/jetpack-device-detection/src/class-user-agent-info.php

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,6 +1743,170 @@ public static function is_bot_user_agent( $ua = null ) {
17431743
'mojeekbot', // https://www.mojeek.com/bot.html
17441744
'linkwalker', // https://www.linkwalker.com/
17451745
'dataforseobot', // https://www.dataforseo.com/dataforseo-bot
1746+
'gptbot', // https://platform.openai.com/docs/gptbot
1747+
'google-inspectiontool', // https://developers.google.com/search/docs/crawling-indexing/google-common-crawlers
1748+
'blexbot',
1749+
'dotbot', // https://darkvisitors.com/agents/dotbot
1750+
'claudebot', // https://support.anthropic.com/en/articles/8896518
1751+
'wp-e2e-tests', // WordPress e2e tests
1752+
// https://github.com/ua-parser/uap-core/blob/432e95f6767cc8bab4c20c255784cd6f7e93bc15/regexes.yaml#L151
1753+
'whatsapp',
1754+
'linkedinbot',
1755+
'scrapy',
1756+
'mj12bot',
1757+
'simplepie',
1758+
'bingpreview',
1759+
'yahoo! slurp',
1760+
'nutch',
1761+
'adsbot-google',
1762+
'zyborg',
1763+
'csimplespider',
1764+
'cityreview robot',
1765+
'crawldaddy',
1766+
'crawlfire',
1767+
'finderbots',
1768+
'index crawler',
1769+
'job roboter',
1770+
'kiwistatus spider',
1771+
'lijit crawler',
1772+
'queryseekersp ider',
1773+
'scollspider',
1774+
'trends crawler',
1775+
'usyd-nlp-spider',
1776+
'sitecat webbot',
1777+
'123metaspider-bot',
1778+
'1470.net crawler',
1779+
'50.nu',
1780+
'8bo crawler bot',
1781+
'aboundex',
1782+
'appengine-google',
1783+
'archiver',
1784+
'blitzbot',
1785+
'blogbridge',
1786+
'bloglovin',
1787+
'boardreader blog indexer',
1788+
'boardreader favicon fetcher',
1789+
'boitho.com-dc',
1790+
'botseer',
1791+
'bubing',
1792+
'catchpoint',
1793+
'charlotte',
1794+
'checklinks',
1795+
'clumboot',
1796+
'comodo http',
1797+
'comodo-webinspector-crawler',
1798+
'converacrawler',
1799+
'crawl-e',
1800+
'crawlconvera',
1801+
'daumoa',
1802+
'feed seeker bot',
1803+
'feedbin',
1804+
'findlinks',
1805+
'flamingo_searchengine',
1806+
'followsite bot',
1807+
'furlbot',
1808+
'genieo',
1809+
'gomezagent',
1810+
'gonzo1',
1811+
'googleother',
1812+
'google sketchup',
1813+
'grub-client',
1814+
'gsa-crawler',
1815+
'hiddenmarket',
1816+
'holmes',
1817+
'hoowwwer',
1818+
'htdig',
1819+
'icc-crawler',
1820+
'icarus6j',
1821+
'ichiro',
1822+
'iconsurf',
1823+
'iltrovatore',
1824+
'infuzapp',
1825+
'innovazion crawler',
1826+
'internetarchive',
1827+
'jbot',
1828+
'kaloogabot',
1829+
'kurzor',
1830+
'larbin',
1831+
'leia',
1832+
'lesnikbot',
1833+
'linguee bot',
1834+
'linkaider',
1835+
'lite bot',
1836+
'llaut',
1837+
'mail.ru_bot',
1838+
'masscan',
1839+
'masidani_bot',
1840+
'mediapartners-google',
1841+
'microsoft',
1842+
'mogimogi',
1843+
'mozdex',
1844+
'msrbot',
1845+
'mtps feed aggregation system',
1846+
'netresearch',
1847+
'netvibes',
1848+
'newsgator',
1849+
'ning',
1850+
'nymesis',
1851+
'objectssearch',
1852+
'ogscrper',
1853+
'orbiter',
1854+
'oozbot',
1855+
'pagepeeker',
1856+
'pagesinventory',
1857+
'paxleframework',
1858+
'peeplo screenshot bot',
1859+
'phpcrawl',
1860+
'plantynet_webrobot',
1861+
'pompos',
1862+
'qwantify',
1863+
'read%20later',
1864+
'reaper',
1865+
'redcarpet',
1866+
'retreiver',
1867+
'riddler',
1868+
'rival iq',
1869+
'scrubby',
1870+
'searchsight',
1871+
'seekbot',
1872+
'semanticdiscovery',
1873+
'simpy',
1874+
'seostats',
1875+
'simplerss',
1876+
'sitecon',
1877+
'slackbot-linkexpanding',
1878+
'slack-imgproxy',
1879+
'snappy',
1880+
'speedy spider',
1881+
'squrl java',
1882+
'stringer',
1883+
'theusefulbot',
1884+
'thumbshotsbot',
1885+
'thumbshots.ru',
1886+
'tiny tiny rss',
1887+
'url2png',
1888+
'vagabondo',
1889+
'voilabot',
1890+
'vortex',
1891+
'votay bot',
1892+
'voyager',
1893+
'wasalive.bot',
1894+
'web-sniffer',
1895+
'webthumb',
1896+
'wesee',
1897+
'whatweb',
1898+
'wire',
1899+
'wordpress',
1900+
'wotbox',
1901+
'www.almaden.ibm.com',
1902+
'xenu',
1903+
'yottaamonitor',
1904+
'yowedo',
1905+
'zao',
1906+
'zao-crawler',
1907+
'zebot_www.ze.bz',
1908+
'zooshot',
1909+
'arcgis hub indexer',
17461910
);
17471911

17481912
foreach ( $bot_agents as $bot_agent ) {

vendor/composer/installed.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
"packages": [
33
{
44
"name": "automattic/jetpack-device-detection",
5-
"version": "3.1.0",
6-
"version_normalized": "3.1.0.0",
5+
"version": "3.1.1-alpha.1761293060",
6+
"version_normalized": "3.1.1.0-alpha1761293060",
77
"dist": {
88
"type": "path",
99
"url": "/tmp/jetpack-build/Automattic/jetpack-device-detection",
10-
"reference": "1992654398f9e18a13ce75f50ce61b2c72ac69ae"
10+
"reference": "b416b04dc1c05f2ca869889faa2a989e4ffe1f5f"
1111
},
1212
"require": {
1313
"php": ">=7.2"

vendor/composer/installed.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
),
1212
'versions' => array(
1313
'automattic/jetpack-device-detection' => array(
14-
'pretty_version' => '3.1.0',
15-
'version' => '3.1.0.0',
16-
'reference' => '1992654398f9e18a13ce75f50ce61b2c72ac69ae',
14+
'pretty_version' => '3.1.1-alpha.1761293060',
15+
'version' => '3.1.1.0-alpha1761293060',
16+
'reference' => 'b416b04dc1c05f2ca869889faa2a989e4ffe1f5f',
1717
'type' => 'jetpack-library',
1818
'install_path' => __DIR__ . '/../automattic/jetpack-device-detection',
1919
'aliases' => array(),

0 commit comments

Comments
 (0)