Variable names matching ignore patterns are not captured at all. This is useful for excluding internal variables, temporary data, or framework-specific variables that don't provide debugging value.
By default, Python internal variables (starting with __) are ignored.
Customizing ignore patterns
Python
posthog = Posthog(
"<ph_project_api_key>",
enable_exception_autocapture=True,
code_variables_enabled=True,
code_variables_ignore_patterns=[
r"^__.*",# Python internals
r"^_.*",# Private variables
r"temp_.*",# Temporary variables
r"cache_.*",# Cache variables
r"debug_.*",# Debug variables
],
)
Scoped ignore patterns
You can set ignore patterns for specific code blocks using contexts: