We have a need to send out a combination of static content and then per-member customized content. We know how to do this on the website using some JS and cookies and modifying themes but we don’t know how to make this work in the newsletters themselves due to a seeming lack of ability to insert system variables.
Note that we’re hosted currently with Ghost Pro and would like to avoid moving the site so that we could hack it to make it do what we need for it to do. That’s just more work for now and I prefer not to fork code if we can help it.
We can deliver this custom content in images using the member ID (or other identifier such as member email address) as a script argument where a different server will generate the graphic on the fly based on preferences we also store elsewhere. So all we need is to be able to insert a variable representing the member as plain text wherever we want to in a post.
The bottom line is that I need to figure out some way to insert an identifier variable for the member into a path and I’m wondering if there is a way to do this by modifying themes or newsletter templates.
Does anyone have a suggestion for how to go about doing this?
I tested this this morning and ended up writing about it, since it was quite insightful. It includes a list of all email personalization tags that are available in Ghost:
However, achieving what you want to do is still tricky.
The personalizations only work inside email cards. That is problematic in the sense that email cards cannot render HTML or images. The only thing you could do is add a link there (or try to display what you want to show as static text with the personalization options available).
This would get you a clickable link in most email clients:
Your personalized content:
https://example.com/content?key={key}
But that’s about everything that’s possible.
I tried putting an <img> tag into the email card, but the email rendering logic treats that as static content. While the personalization gets processed, it won’t render as an image.
Well damn Jannis, that was succinct and also much appreciated even though you were unable to find a solution, but at least you documented that black hole of email cards.
I think we have three options:
Lobby for changes to how these variables can be used, though we would still have to generate images instead of HTML which is a good amount of work, though Ghost should absolutely support user variables in both HTML and text, and on the website as well as in newsletters.
Set up a sidecar application that looks for certain types of posts (we need this for a particular daily email) and uses the API to get user info and the content of the post, generating our own emails, and then sending them to a separate MailGun account (could be anything of course but bulk mail is notoriously difficult for non-bulk mail organizations).
Move to self-hosting and fork the editor code or newsletter generation code, though we would still be in the position of needing to generate the per-user content using graphics unless we hacked it a lot.
I’m heavily leaning to #2. Ghost actually has competitive pricing when you factor in MailGun for largish email lists. We have about 5,000 and counting, and will be emailing on average twice a day for about 5 months of the year or 300,000/month for 5 months (minimal for the other 7).
Forking is possible, but with bigger changes to the editor/rendering I would not want to merge and test every single future update (which usually happen on a weekly basis).
I know there are huge publications that have forked Ghost and made it something truly unique, but they are also years behind in updates. Wouldn’t recommend
I settled on the sidecar approach last night after a little more thought. It shouldn’t be too terribly difficult to do and I think we can pull some tricks like track unsubscribes by setting up a dummy newsletter to match in Ghost and keeping track there so that newsletter management is in one place.