One of the best features I get out of using Hubspot and MailChimp is the integration of read/click data that gets posted from MailChimp into Hubspot. I want to replace MailChimp with Ghost (because it’s awesome!) but I’m reluctant because I will lose the ability to see in Hubspot which newsletters a member has opened.
So, in looking through Ghost webhooks and Admin CLI, I don’t see anywhere a way to tap into the member activity data. I know it’s there somewhere, because when you click on a member you can see his activity (even click again on all activity to see more). But how do we get to that data so we can plug it into Hubspot? It’d be great to have a webhook trigger when a member reads/opens/clicks a newsletter or post.
If you are self-hosted, you might see if there’s a Mailgun API that does this.
(If you are in managed hosting, that’s not going to work, because you don’t control your own Mailgun.)
Anything you can see in the admin dashboard is technically accessible. Whether or not getting it is annoying is a separate question. The admin dashboard is just making API calls to the Ghost back-end, so you can probably see how it retrieves that data and mimic it. (Note that some endpoints only take cookie authentication, as an added complication.)
So… you could probably run a scheduled process somewhere that talks to Ghost, gets open stats, and pushes them into the Hubspot API.
There’s a lot of data that I wish we could get at in Ghot(Pro) hosted sites.
I think the problem here is that if you had this webhook, it would fire a lot. Imagine you had 10K readers, and 4K of them opened the newsletter. You will get 4K webhooks. For many people people that will lead to very expensive surprise Zapier bills (because Zapier pricing can quickly get very expensive). It’s not that 4K API calls are expensive to handle, it’s that Zapier charges a lot for that and a lot of Ghost users rely on Zapier.
I’d love if there were an API call one could make to get bulk data or a delta from yesterday’s data, etc. A lot of cool stuff would get unlocked if this data weren’t locked inside Ghost.
Right now the only way to know if someone is a very active user is to look at them in the dashboard but that doesn’t let you do anything programatically with the data.
@Cathy_Sarisky is right you can get to this while logged into the admin but that’s not something most people (including me) feel comfortable with. And yes if self-hosted, you can get opens and clicks out of Mailgun fairly easily.
Thanks for your replies, @Cathy_Sarisky and @rsingel. For my self hosted Ghost site, I’m now researching and trying to implement using the Mailgun webhooks. There is an ‘opened’ webhook event that fires when a user opens a particular email. I installed N8N on my server (no Zapier bills!) to receive the webhook data which I will then attach to my Hubspot users.
The trouble I’m running into now is that the opened event data doesn’t include the email subject, which is the piece of data I wanted to insert into Hubspot. Mailgun allows custom data to be entered into the email header that would then be passed on in the event data. However, I don’t see a way in Ghost to insert a header into bulk emails.
It would be nice to accomplish this without modifying Ghost code. Any thoughts? What about a “custom header” field in the Settings->Newsletter->Edit->Email Info section in which you could insert headers. I could then insert v: email_subject=$[post_title]
(I’m not sure how to insert the post title into the code.)
All the rest of the Mailgun event data is related to the recipient, date, agent, etc. It looks like Mailgun expects us to customize the user-variables according to our needs, rather than provide that by default (from what I read on a post).
Looking around in the Ghost code, I see that emailId is being used to identify and track specific email events. However, email sending data doesn’t seem to show up in the admin api data, according to the docs.
I captured “Post published” event data from Ghost and also captured “Email Opened” event data from Mailgun. Unfortunately, the emailId is not found in the post published data.
In the custom webhooks settings, there doesn’t seem to be any webhooks related to newsletters/email, so I tried post-published. Oh well.
It looks the Ghost core code adds in the Mailgun custom variable here.
// add a reference to the original email record for easier mapping of mailgun event -> email
if (message.id) {
messageData['v:email-id'] = message.id;
}