AI Reports

Magento 2 SQL queries › Customers

How many newsletter subscribers do we have?

Short answer: Marketing › Newsletter Subscribers lists them; the query counts them per status and store view.

In the Magento admin

  1. Go to Marketing › Communications › Newsletter Subscribers and filter Status = Subscribed.

With one query

These queries only read data. Run them on a copy of your database if you can, or ask your developer to. If your tables have a prefix (set in app/etc/env.php), add it to each table name.

Works on Magento Open Source and Adobe Commerce:

SELECT CASE ns.subscriber_status
         WHEN 1 THEN 'Subscribed' WHEN 2 THEN 'Not activated'
         WHEN 3 THEN 'Unsubscribed' WHEN 4 THEN 'Unconfirmed'
       END AS status,
       ns.store_id,
       COUNT(*) AS subscribers
FROM newsletter_subscriber ns
GROUP BY ns.subscriber_status, ns.store_id
ORDER BY ns.store_id, ns.subscriber_status;

Good to know

Related

Gaurav Harsh

Gaurav Harsh is a Magento developer who works on large Adobe Commerce stores and builds AI Reports, a Magento extension for asking your store's data questions in plain English. LinkedIn