Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
follow XDG Base Directory Specification to store telemetry_user_id
Louis Kapp913a0e992b4c
diff --git a/browser_use/telemetry/service.py b/browser_use/telemetry/service.pyindex e5e67e498..9fa50232c 100644--- a/browser_use/telemetry/service.py+++ b/browser_use/telemetry/service.py@@ -20,6 +20,14 @@ POSTHOG_EVENT_SETTINGS = {}+def xdg_cache_home() -> Path:+ default = Path.home() / '.cache'+ env_var = os.getenv('XDG_CACHE_HOME')+ if env_var and (path := Path(env_var)).is_absolute():+ return path+ return default++@singletonclass ProductTelemetry:"""@@ -28,7 +36,7 @@ class ProductTelemetry:If the environment variable `ANONYMIZED_TELEMETRY=False`, anonymized telemetry will be disabled."""- USER_ID_PATH = str(Path.home() / '.cache' / 'browser_use' / 'telemetry_user_id')+ USER_ID_PATH = str(xdg_cache_home() / 'browser_use' / 'telemetry_user_id')PROJECT_API_KEY = 'phc_F8JMNjW1i2KbGUTaW1unnDdLSPCoyc52SGRU0JecaUh'HOST = 'https://eu.i.posthog.com'UNKNOWN_USER_ID = 'UNKNOWN'