Enable newsletter open-rate analytics doesn't work

Ghost 3.39.0
Ubuntu 18.04

I have sent many newsletters, the value of the opened / read emails is always 0%, I have entered several of my emails as members receiving the newsletter, to test this functionality.

With all my accounts I have opened and read the newsletter, the value is always 0%.

What could be the problem?

@giacomosilli have you checked your logs for any errors? There’s a background job that is started every 5 minutes, you should see some output from it in the logs.

If there are no errors in your logs you may want to check Mailgun’s troubleshooting page, specifically the parts about having a working tracking CNAME in place https://help.mailgun.com/hc/en-us/articles/360013191513-Open-Tracking-Troubleshooting


thanks for the reply

records DNS are ok

Sorry if i didn’t post the error first.

I suppose it is this:

{"name":"Log","hostname":"example","pid":17524,"level":50,"err":{"domain":"https://example.it","message":"Cannot read property 'items' of undefined","stack":"TypeError: Cannot read property 'items' of undefined\n    at EmailAnalyticsMailgunProvider._fetchPages (/var/www/ghost/versions/3.39.0/core/server/services/email-analytics/providers/mailgun.js:110:27)\n    at process._tickCallback (internal/process/next_tick.js:68:7)"},"msg":"Cannot read property 'items' of undefined","time":"2020-12-07T10:02:14.796Z","v":0}

{"name":"Log","hostname":"example","pid":11017,"level":50,"worker":{"threadId":-1},"msg":"Worker for job \"email-analytics-fetch-latest\" exited with code 1","time":"2020-12-07T10:02:15.815Z","v":0}

Yep, that error is the problem. Bugfix has just been released in 3.39.2, please let me know how things go after the upgrade! :slight_smile:



1 Like

Hi @Kevin Still not working for me in 3.39.2. Just a guess, but have you enabled Mailgun EU sending domains? I experienced this problem when first using Mailintel to track Ghost newsletters — they originally only supported US sending domains but fixed it quickly.

@n1n10 if you’re self-hosting then any necessary Mailgun setup would be on you to perform, the only thing Ghost can do is enable the open tracking flag on individual emails when they are created, which is what Ghost does by default from 3.39.0 onwards.


I have two Ghost installations but the the tracking only works on my test site. On my main site it does not.

Looking through my Mailgun logs (related to the Ghost installation where the tracking doesn’t work) I can see alle the opened/clicked events. These are, however, not reflected in the backend of my main Ghost site.

What is even stranger is, that looking through the Ghost logs it seems that the events are actually fetched:

{"name":"Log","hostname":"ghost-techliv","pid":14484,"level":30,"msg":"Fetched 300 events and aggregated stats for 1 emails and 240 members in 2044ms","time":"2020-12-11T10:20:01.789Z","v":0} {"name":"Log","hostname":"ghost-techliv","pid":13943,"level":30,"worker":{"threadId":6},"msg":"Worker for job \"email-analyt ics-fetch-latest\" signaled completion","time":"2020-12-11T10:20:01.794Z","v":0}

Despite this, the open rate in Ghost remains at 0%.

@n1n10 it looks like events (this is all events, not just “opened” events) are being fetched fine so I’d suggest double-checking your Mailgun admin interface to ensure your account is fully set up to support open tracking

Thanks for your reply @Kevin

Mailgun is tracking all opens and clicks correctly (see attachment) so the problem seems to be in the connection between Mailgun and Ghost.
Skærmbillede 2020-12-11 kl. 13.40.51

The only difference between my two Ghost installations is, that I am using a first level domain on the Ghost installation that tracks opens correctly email.domain.com and a second level domain on the one that doesn’t work email.mg.domain.com. The second one is set up with a dedicated Cloudflare certificate.

The final super weird thing is that one of my posts (the very first newsletter sent out after 3.39.0) registered 2 percent open rate (in reality it is much higher) just as I updated from 3.39.0 to 3.39.3. before the tracking stopped working.

@n1n10 can you share some details about your environment? Which database are you using, and if it’s mysql which version?

@Kevin I am using mysql database with the following output of mysql -V:
mysql Ver 14.14 Distrib 5.7.32, for Linux (x86_64) using EditLine wrapper

@n1n10 can you check your email_recipients table for one of your recent emails to see if it has opened_at timestamps present? If it does then it’s indicating that the aggregation is failing somehow :thinking:

@Kevin The “opened-at” timestamps for all emails are NULL.

@n1n10 are there timestamps in any of the email_recipients rows for delivered_at / failed_at?

@Kevin Sorry it went at bit fast. There are nine opened_at timestamps (which equals the 2 percent I mentioned earlier - see attachment with mouse over) 12 failed_at and maybe a couple of hundred delivered_at

But the last three days is just NULL

Which is just null? All of the fields or just the opened_at fields?

All three are null: opened_at failed_at and delivered_at

Hi @Kevin Just a small update. Saturday afternoon —out of the blue — some of the opening rates began appearing. But it has stopped again. Any idea what causes this?