🦔 PostHog provides open-source web & product analytics, session recording, feature flagging and A/B testing that you can self-host. Get started - free.
I posted this as a comment in the docs, but realized it might be better as a proper feature request. Apologies if this is a dupe; I didn't find this from searching.
Is your feature request related to a problem?
I'd like to filter out internal+test users in my SQL query-based insights.
Describe the solution you'd like
I've already set up internal+test user filters in my project settings. I can nicely toggle a checkbox in most insights to apply this filter. But I can't in manual SQL query insights.
I'd love for this filter to be applied automatically as part of the normal {filters} placeholder:
select ...
from events
where {filters} -- replaced with global date and property filters
Short of that, another placeholder would work too:
select ...
from events
where {filters} -- replaced with global date and property filters
and not {internalAndTestUserFilter} -- or whatever name
Describe alternatives you've considered
What I've resorted to doing for now is manually reconstructing the filters in my SQL queries, e.g.:
select ...
from events
where {filters} -- replaced with global date and property filters
and not (
match(coalesce(properties.$host, ''), '^(localhost|127\\.0\\.0\\.1)($|:)')
or match(coalesce(person.properties.email, ''), '^[^@]@mycompany[.]com$')
or ...
)
You can see this is both (a) tedious to re-implement in every SQL query, (b) manual and error-prone (e.g. it took me a while to figure out that all the backslashes in 127\.0\.0\.1 needed to be double-escaped now), and (c) duplicative/"frozen" — any updates made to this filter in settings won't get applied to already-written SQL queries.
I posted this as a comment in the docs, but realized it might be better as a proper feature request. Apologies if this is a dupe; I didn't find this from searching.
Is your feature request related to a problem?
I'd like to filter out internal+test users in my SQL query-based insights.
Describe the solution you'd like
I've already set up internal+test user filters in my project settings. I can nicely toggle a checkbox in most insights to apply this filter. But I can't in manual SQL query insights.
I'd love for this filter to be applied automatically as part of the normal
{filters}
placeholder:That'd work especially well if this filter could be toggle-able dynamically at the dashboard level rather than per-insight.
Short of that, another placeholder would work too:
Describe alternatives you've considered
What I've resorted to doing for now is manually reconstructing the filters in my SQL queries, e.g.:
You can see this is both (a) tedious to re-implement in every SQL query, (b) manual and error-prone (e.g. it took me a while to figure out that all the backslashes in
127\.0\.0\.1
needed to be double-escaped now), and (c) duplicative/"frozen" — any updates made to this filter in settings won't get applied to already-written SQL queries.Additional context
(Thank you all for your work! ❤️)