Campaign Events vs Email type


#1

Hi,
I get all the emails of type SENT with https://developers.hubspot.com/docs/methods/email/get_events.
But when I filter these by Campaign ID the number of emails sent for a particular Campaign ID does not match with the “sent” counter of the campaign with the API https://developers.hubspot.com/docs/methods/email/get_campaign_data.
Why is this difference?


#2

Hi @sachin_manawadi,

Can you give me some more details on the discrepancy you’re seeing? Is it possible you’re not pulling all of the available events? Can you give me an example campaign and your Hub ID?


#3

Hi Derek,
The HubSpot ID I am using is 3921613.
We have a campaign with ID 60568819. When I use the API
https://api.hubapi.com/email/public/v1/campaigns/60568819?hapikey=xxxx . I get the following counters data -
“counters”: {
“processed”: 676,
“deferred”: 86,
“unsubscribed”: 1,
“statuschange”: 1,
“bounce”: 5,
“mta_dropped”: 4,
“dropped”: 42,
“delivered”: 665,
“suppressed”: 1,
“sent”: 672,
“click”: 39,
“open”: 153
},

When I use http://api.hubapi.com/email/public/v1/events?hapikey=xxx&eventType=SENT (I send this request until hasMore is false) I get total 21536 “sent” emails for the portal. Out of these 21536, 676 emails belong to the above mentioned Campaign ID i.e 60568819 which I determine by the field “emailCampaignId” .
My question is why is there a difference between the first API giving me 672 and the bulk API results to 676. This is also true for “opened”, “clicked” and “delivered”. From the second bulk API, I get opened - 155, clicked - 62, and delivered - 667 which is different from the counters above.

Also, after doing some math we found out that the sent emails as per my calculations i.e. 676 and the one in counters i.e 672 = 676- mta_dropped. We tried with most of the campaigns and it holds true. Is this the calculation used to display on the HubSpot UI?
Also, I could not get any relation to match the UI counters and my calculations for “opened”, “click” and “delivered”.

Thanks,
Sachin BM


#4

Hi @sachin_manawadi,

SENT events can be emitted before messages are dropped by the email service provider, so that would explain the discrepancy between SENT events. Do you see an obsoletedBy event on any SENT events? SENT events can be rendered obsolete by a later DROPPED event; in that case, the SENT event should have an obsoleteBy field with a reference to the DROPPED event. Regarding the OPEN and CLICK discrepancies; it’s likely that the ‘missing’ events aren’t appearing because they’re being filtered out based on the portal’s reports settings (filtered IPs, bot filtering, etc.).