Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(workflows): add taxonomy entries for $workflows_email_* events (#89731)

Daniel Marchuk563852b62bd5
diff --git a/frontend/src/scenes/session-recordings/playlist/sessionRecordingsListPropertiesLogic.test.ts b/frontend/src/scenes/session-recordings/playlist/sessionRecordingsListPropertiesLogic.test.ts
index 3d50dafca107..a3b612ac5c9d 100644
--- a/frontend/src/scenes/session-recordings/playlist/sessionRecordingsListPropertiesLogic.test.ts
+++ b/frontend/src/scenes/session-recordings/playlist/sessionRecordingsListPropertiesLogic.test.ts
@@ -166,11 +166,15 @@ describe('sessionRecordingsListPropertiesLogic', () => {
}).toDispatchActions(['loadPropertiesForSessionsSuccess'])
expect(issuedQueries).toHaveLength(1)
- expect(issuedQueries[0]).toContain('any(session.$entry_utm_medium) as $entry_utm_medium')
- expect(issuedQueries[0]).toContain('any(session.$channel_type) as $channel_type')
+ // The WHERE clause lists every core event name, so a pin can only be found absent by looking
+ // at the select list. Searching the whole query trips over an unrelated event that shares the
+ // pin's name as a substring.
+ const selectList = issuedQueries[0].split('FROM events')[0]
+ expect(selectList).toContain('any(session.$entry_utm_medium) as $entry_utm_medium')
+ expect(selectList).toContain('any(session.$channel_type) as $channel_type')
// non-session pins must not leak into the query
- expect(issuedQueries[0]).not.toContain('email')
- expect(issuedQueries[0]).not.toContain('Start')
+ expect(selectList).not.toContain('email')
+ expect(selectList).not.toContain('Start')
expect(logic.values.recordingPropertiesById['s1']).toMatchObject({
$browser: 'Chrome',
diff --git a/frontend/src/taxonomy/core-filter-definitions-by-group.json b/frontend/src/taxonomy/core-filter-definitions-by-group.json
index 9889c0681633..49af38dec197 100644
--- a/frontend/src/taxonomy/core-filter-definitions-by-group.json
+++ b/frontend/src/taxonomy/core-filter-definitions-by-group.json
@@ -4125,6 +4125,42 @@
"description": "Automatically captured web vitals data.",
"label": "Web vitals"
},
+ "$workflows_email_blocked": {
+ "description": "Fires when a recipient reports a workflow email as spam. Despite the event name, this does not count blocked mail: it counts spam complaints that mailbox providers pass back through their feedback loops. Gmail does not send those reports, so a Gmail user marking an email as spam is not counted here. Workflow metrics show the same count as \"Marked as spam\".",
+ "label": "Workflow email marked as spam"
+ },
+ "$workflows_email_bounced": {
+ "description": "Fires when a workflow email bounces.",
+ "label": "Workflow email bounced"
+ },
+ "$workflows_email_delivered": {
+ "description": "Fires when a workflow email reaches the recipient's inbox, confirmed by their mail server accepting it.",
+ "label": "Workflow email delivered"
+ },
+ "$workflows_email_failed": {
+ "description": "Fires when a workflow email could not be sent. This covers a failed call to the email provider, a template that did not render, a message the provider rejected for containing a virus, and a misconfigured email step, such as a sender that no longer exists or a domain that is not verified.",
+ "label": "Workflow email failed"
+ },
+ "$workflows_email_link_clicked": {
+ "description": "Fires when a recipient clicks a link in a workflow email. Emails sent without click tracking can never record a click, so they are missing from this count.",
+ "label": "Workflow email link clicked"
+ },
+ "$workflows_email_opened": {
+ "description": "Fires when a recipient opens a workflow email. Emails sent without open tracking can never record an open, so they are missing from this count.",
+ "label": "Workflow email opened"
+ },
+ "$workflows_email_sent": {
+ "description": "Fires when a workflow sends an email to a recipient.",
+ "label": "Workflow email sent"
+ },
+ "$workflows_email_tracking_consent_updated": {
+ "description": "Fires when a recipient changes whether workflow emails can track their opens and clicks, on the email preferences page.",
+ "label": "Workflow email tracking consent updated"
+ },
+ "$workflows_email_unsubscribed": {
+ "description": "Fires when a recipient unsubscribes from workflow emails, through the one-click unsubscribe link or the preferences page. The `category` property holds the message category they left, or `$all` when they opted out of everything.",
+ "label": "Workflow email unsubscribed"
+ },
"All events": {
"description": "This is a wildcard that matches all events.",
"label": "All events"
diff --git a/posthog/taxonomy/taxonomy.py b/posthog/taxonomy/taxonomy.py
index 3ae4b4f2448b..d0d878694f7f 100644
--- a/posthog/taxonomy/taxonomy.py
+++ b/posthog/taxonomy/taxonomy.py
@@ -488,6 +488,45 @@ CORE_FILTER_DEFINITIONS_BY_GROUP: dict[str, dict[str, CoreFilterDefinition]] = {
"label": "Slack message received",
"description": "Fires when a message is posted in a Slack channel PostHog is connected to.",
},
+ # Descriptions here must stay in step with the matching workflow email metric definitions in
+ # products/workflows/frontend/Workflows/workflowMetricsSummaryLogic.ts, since the two surfaces
+ # count the same thing.
+ "$workflows_email_sent": {
+ "label": "Workflow email sent",
+ "description": "Fires when a workflow sends an email to a recipient.",
+ },
+ "$workflows_email_delivered": {
+ "label": "Workflow email delivered",
+ "description": "Fires when a workflow email reaches the recipient's inbox, confirmed by their mail server accepting it.",
+ },
+ "$workflows_email_failed": {
+ "label": "Workflow email failed",
+ "description": "Fires when a workflow email could not be sent. This covers a failed call to the email provider, a template that did not render, a message the provider rejected for containing a virus, and a misconfigured email step, such as a sender that no longer exists or a domain that is not verified.",
+ },
+ "$workflows_email_opened": {
+ "label": "Workflow email opened",
+ "description": "Fires when a recipient opens a workflow email. Emails sent without open tracking can never record an open, so they are missing from this count.",
+ },
+ "$workflows_email_link_clicked": {
+ "label": "Workflow email link clicked",
+ "description": "Fires when a recipient clicks a link in a workflow email. Emails sent without click tracking can never record a click, so they are missing from this count.",
+ },
+ "$workflows_email_bounced": {
+ "label": "Workflow email bounced",
+ "description": "Fires when a workflow email bounces.",
+ },
+ "$workflows_email_blocked": {
+ "label": "Workflow email marked as spam",
+ "description": 'Fires when a recipient reports a workflow email as spam. Despite the event name, this does not count blocked mail: it counts spam complaints that mailbox providers pass back through their feedback loops. Gmail does not send those reports, so a Gmail user marking an email as spam is not counted here. Workflow metrics show the same count as "Marked as spam".',
+ },
+ "$workflows_email_unsubscribed": {
+ "label": "Workflow email unsubscribed",
+ "description": "Fires when a recipient unsubscribes from workflow emails, through the one-click unsubscribe link or the preferences page. The `category` property holds the message category they left, or `$all` when they opted out of everything.",
+ },
+ "$workflows_email_tracking_consent_updated": {
+ "label": "Workflow email tracking consent updated",
+ "description": "Fires when a recipient changes whether workflow emails can track their opens and clicks, on the email preferences page.",
+ },
},
"elements": {
"tag_name": {
diff --git a/products/workflows/frontend/Workflows/workflowMetricsSummaryLogic.ts b/products/workflows/frontend/Workflows/workflowMetricsSummaryLogic.ts
index 89a3407a189e..70c10ce082d1 100644
--- a/products/workflows/frontend/Workflows/workflowMetricsSummaryLogic.ts
+++ b/products/workflows/frontend/Workflows/workflowMetricsSummaryLogic.ts
@@ -255,7 +255,7 @@ export const WORKFLOW_EMAIL_METRICS: Record<
email_failed: {
name: 'Failed',
description:
- 'Total number of emails that were not attempted to be sent. This typically indicates the PostHog email service determined the email contained a virus.',
+ 'Total number of emails that could not be sent. This covers a failed call to the email provider, a template that did not render, a message the provider rejected for containing a virus, and a misconfigured email step, such as a sender that no longer exists or a domain that is not verified.',
color: METRIC_COLORS['Failed'],
metricNames: ['email_failed'],
},