This guide shows you how to add Heyo to your Ghost publication. Works with Ghost(Pro) and self-hosted Ghost.
<script src="https://heyo.so/embed/script" defer data-project-id="YOUR_PROJECT_ID"></script>
The chat widget will now appear on all pages of your publication.
Show chat only to logged-in members:
<script src="https://heyo.so/embed/script" defer data-project-id="YOUR_PROJECT_ID"></script>
{{#if @member}}
<script>
window.addEventListener('load', function() {
if (window.HEYO) {
window.HEYO.init({
projectId: 'YOUR_PROJECT_ID',
user: {
name: '{{@member.name}}',
email: '{{@member.email}}',
id: '{{@member.uuid}}'
}
});
}
});
</script>
{{else}}
<style>
#heyo-widget-button {
display: none !important;
}
</style>
{{/if}}
Offer chat as a premium member benefit:
<script src="https://heyo.so/embed/script" defer data-project-id="YOUR_PROJECT_ID"></script>
{{#if @member}}
{{#has status="paid"}}
<script>
window.addEventListener('load', function() {
if (window.HEYO) {
window.HEYO.init({
projectId: 'YOUR_PROJECT_ID',
user: {
name: '{{@member.name}}',
email: '{{@member.email}}',
subscription: 'premium'
}
});
window.HEYO.show();
}
});
</script>
{{else}}
<style>
#heyo-widget-button {
display: none !important;
}
</style>
{{/has}}
{{/if}}
Use Ghost's route helpers:
<script src="https://heyo.so/embed/script" defer data-project-id="YOUR_PROJECT_ID"></script>
{{#is "post"}}
<script>
// Show chat on blog posts
window.HEYO?.show();
</script>
{{/is}}
{{#is "page"}}
<style>
/* Hide chat on static pages */
#heyo-widget-button {
display: none !important;
}
</style>
{{/is}}
{{#if @member}}
<script>
window.addEventListener('load', function() {
if (window.HEYO) {
window.HEYO.init({
projectId: 'YOUR_PROJECT_ID',
user: {
name: '{{@member.name}}',
email: '{{@member.email}}',
tier: '{{#foreach @member.subscriptions}}{{tier.name}}{{/foreach}}',
status: '{{@member.status}}'
}
});
}
});
</script>
{{/if}}
Add a custom chat button to your posts using Ghost's markdown/HTML:
<button onclick="window.HEYO?.show()" style="padding: 12px 24px; background: #6366f1; color: white; border: none; border-radius: 8px; cursor: pointer;">
Chat with me about this post
</button>
For more advanced integration, you can modify your Ghost theme:
default.hbs in the <head> sectionThis allows version control and more granular placement.
If building a custom theme, add to default.hbs:
<!DOCTYPE html>
<html>
<head>
{{! ... other head content ... }}
<script src="https://heyo.so/embed/script" defer data-project-id="{{@site.heyo_project_id}}"></script>
</head>
<body>
{{{body}}}
</body>
</html>
Note: You'll need to replace {{@site.heyo_project_id}} with your actual project ID since Ghost doesn't support custom site properties by default.
{{@member}}){{#if @member}}...{{/if}}<head> tagHeyo works identically on both:
Works alongside: