We send a triggered email via Discourse to all users when a new topic is posted by an admin in a specific section. I assume some users are unsubscribing from these triggered emails and/or changing their email preferences upon receiving the email.
Is there a way to track the number of unsubscribes?
We were able to use the data explorer plugin to find the users who are no longer watching the category (thanks @pfaffman!). We would also like to find the users who unsubscribe by clicking on “To unsubscribe from these emails, click here” and then selecting “Don’t send me any mail from Squarespace Circle Forum”
Do you have any insight on the best way to query the results for the don’t send me any mail folks?
-- 列出电子邮件偏好设置为负的用户,并包含他们的 TL、联系日期和 Cheers
SELECT u.ID “用户 ID”
,u.USERNAME “用户名”
,u.trust_level “TL”
-- 下一行可选地包含来自 Gamifaction 插件的全部 Cheers 分数。请参阅下面的第二个连接。
,di.gamification_score “Cheers”
,CAST (u.first_seen_at AS DATE) “加入”
,CAST (u.last_seen_at AS DATE) “最后 seen”
,CAST (u.last_emailed_at AS DATE) “最后邮件”
,CASE uo.email_digests
WHEN 't' THEN '是'
WHEN 'f' THEN '否'
ELSE '未设置'
END “摘要?”
,CASE uo.email_level
WHEN 0 THEN '从不'
WHEN 1 THEN '离开'
WHEN 2 THEN '总是'
END “邮件级别”
,CASE uo.email_messages_level
WHEN 0 THEN '从不'
WHEN 1 THEN '离开'
WHEN 2 THEN '总是'
END “邮件消息级别”
FROM USERS u
LEFT OUTER JOIN USER_OPTIONS uo
ON u.ID = uo.USER_ID
-- 第二个连接包括来自 Gamifaction 插件的全部 Cheers 分数
LEFT OUTER JOIN directory_items di
ON u.ID = di.USER_ID AND di.period_type = 1
-- 使用以下 SELECT 语句列出未收到任何主题活动电子邮件的用户
WHERE uo.email_digests = 'f' OR (uo.email_level = 0)
-- 或使用以下 SELECT 语句列出未收到任何主题活动电子邮件和任何消息活动电子邮件的用户
-- WHERE uo.email_digests = 'f' OR (uo.email_level = 0 AND uo.email_messages_level = 0)
AND u.ID <> -1
ORDER BY u.last_emailed_at DESC