Jun 18, 2019 4:02 PM
I am working on creating a marketing overview dashboard for my company. We would like to see month over month email statistics. Currently the only way to get that data is to manually export the emails on the "Marketing->Email" tab and select each month in the fixed time frame. I am looking for an api that will allow me to get the same data that is available via that report but in an automated fashion.
I wrote a script that warehoused every single email event in our hubspot instance (api endpoint: email/public/v1/events) which will work but the number of records is too big for my MySql database. Any recommendations here would be great! I would think month over month email metrics would be a common request.
Feb 7, 2020 2:20 AM
We had similar issues across our organisation as well. And since we are a lead generation and marketing agency, tracking the emails sent were very important to us.
Luckily we came across one tool which integrateed with HS and allowed us to get deeper insights on our campaigns.
If you or anyone would like to know about the tool I can send an inbox.
Jun 19, 2019 1:22 PM
I think you should be able to do this using our Marketing Email API, which you can find documentation for here: https://developers.hubspot.com/docs/methods/lists/marketing-email-overview. You can filter the request in the request URL. So if you wanted to pull emails sent within a certain time range, you could use the endpoint documented here: https://developers.hubspot.com/docs/methods/cms_email/get-all-marketing-emails. Your request could look something like: marketing-emails/v1/emails?hapikey=XXXX&publish_date__gte=1556668800000&publish_date__lt=1559347200000 . And then using the IDs returned in the response, you can get the stats for an individual email through the endpoint documented here: https://developers.hubspot.com/docs/methods/cms_email/get-the-statistics-for-a-marketing-email. So far as I can tell, everything that's included in the report from the Email dashboard can also be found through these Marketing Email endpoints.
Let me know if that will help accomplish what you're looking for or if you have any questions here.
Leland ScanlanHubSpot Developer Support
Sep 24, 2019 8:27 AM
I think that he ask about aggregation, so I'm join in 🙂
I want to get marketing email statistics grouped by day.
(you have this option in Analytics API)
As I understand from the documentation https://developers.hubspot.com/docs/methods/cms_email/get-all-marketing-email-statistics
the endpiont retrieves only lifetime stats.
But in the Marketing dashboard I can choose from multiple date range options - so the daily data is somewere...
Can you guid me how to retrieve daily statistics?
Sep 24, 2019 9:29 AM
What I ended up doing was grabbing all email events. Here's the url:
This will retrieve every single event which means that you will need a very big database to store it (make sure to index). These event come with date stamps so I am using that field with Tableau to make month charts for email activity. Let me know if you have questions on how to break this out. Not ideal as an endpoint that had the aggregated monthly values would be much more efficient but it is working for now.
Sep 24, 2019 10:34 AM - edited Sep 24, 2019 10:34 AM
That what we do now...
But I hope that HubSpot will provied simple solution
Dec 29, 2019 12:34 PM
There is now a HubSpot to Tableau connector in the HubSpot App marketplace. The connector service includes a HubSpot-optimized SQL data warehouse hosted in the Microsoft Azure cloud.