Add the chat to a Ghost publication
Ghost Code injection has a Site Header box that prints into every page. One paste there puts the chat across your whole publication.
Browse topics
What it is
Ghost has a feature called Code injection with two boxes: Site Header and Site Footer. Whatever you put in Site Header is printed into the <head> of every page on your publication. Agentency's Ghost card gives you a single <script> tag for that box, so you get chat on your whole site without editing your theme files or re-uploading a theme zip.
When you would use it
Use this on any Ghost publication — self-hosted or Ghost(Pro) — where readers or members might want to ask something. It is particularly useful on a paid-membership site, where questions about billing and access would otherwise arrive as email.
Because Code injection survives theme changes and theme updates, this is the right route even if you plan to switch themes later.
Where to find it
Open Dashboard → Chatbots → your chatbot → Integrations → Plugins → Ghost.
Before you start
- You need an Administrator (or Owner) account on the Ghost site. Editors and Contributors cannot open Code injection.
- Add your publication's domain to the widget allowlist in Agentency — see Allow the widget on your domains.
- Confirm the chatbot is Active on its Playground tab.
Steps
- Open Dashboard → Chatbots → your chatbot → Integrations → Plugins and click the Ghost card.
- Click Copy embed code.
- In Ghost admin, open Settings → Code injection. In older Ghost versions the same screen is at Settings → Advanced → Code Injection.
- Paste the snippet into the Site Header box. Leave anything already there alone and add yours on a new line.
- Click Save.
- Open your publication in a normal browser tab (not the admin preview) and let the page settle.
- Send a test message and confirm it arrives under Conversations.
What the snippet looks like
Here is the shape of what goes in the Site Header box. Yours will already contain your own token:
<!-- Ghost: Settings -> Code injection -> Site Header -->
<script src="https://agentency.com/js/chatbot-widget.js" defer data-widget-token="wt_YOUR_WIDGET_TOKEN" data-api-base-url="https://api.agentency.com" referrerpolicy="strict-origin-when-cross-origin" crossorigin="anonymous"></script>
data-widget-token is the part that picks your chatbot; the widget refuses to start without it. defer keeps the chat from competing with your article content for load time, which matters on a reading-first site.
What you will see
Ghost saves immediately and shows no visible change in admin. On the live site, the bubble appears in the corner your chatbot's appearance settings specify, on posts, pages, tag archives, and the home page alike.
Ghost also has per-post code injection under Post settings in the editor. You do not need it for the widget — Site Header already covers every page — but it is the way to add the chat to one specific post if you ever want that.
Limits and plan notes
Embedding on your own site requires a paid Agentency plan. On Free, the Plugins catalogue is visible but locked, and you share the hosted chatbot link instead. See Which plans include integrations and the pricing page.
Ghost imposes no plan limit on Code injection — it is available on every Ghost(Pro) tier and on self-hosted installs.
The widget does not know who is signed in to your Ghost membership. If you want the conversation list to show a member's name rather than "anonymous", that is a separate, deliberate step — see Name visitors on the widget, which needs your theme to print the member's details into the tag.
Common problems
I saved the injection but see no bubble.
Ghost caches aggressively behind a CDN on Ghost(Pro). Hard-refresh the page, or open it in a private window, before assuming the code did not save.
It works on the home page and not on posts.
That would mean the snippet went into a post's own code injection rather than the site-wide Site Header box. Move it to Settings → Code injection.
The chat is blocked on my custom domain.
Add the exact host visitors see. If Ghost redirects example.com to www.example.com, the second one is the host that matters. See The widget is blocked.
My theme already loads another chat tool.
Two chat bubbles will stack in the same corner. Either remove the old tool or move ours to the other side under Change the widget look and position.
Common questions
Where exactly does the snippet go in Ghost?
Settings → Code injection → Site Header. In older Ghost versions the same screen sits at Settings → Advanced → Code Injection.
Do I need to change my theme?
No, and that is the point. Code injection survives theme switches and theme updates, so the chat stays put when you redesign.
Is Code injection available on every Ghost plan?
Yes. It is available on all Ghost(Pro) tiers and on self-hosted installs, as long as you are an Administrator or Owner.
Can conversations show which member is chatting?
Only if you set that up deliberately. Your theme has to print the member's details into the tag; see the visitor identity guide.
Was this article helpful?
Related articles
Website plugins overview
Fifteen platforms, two ways to install: the one-click WordPress plugin, or a copy-paste snippet for everything else. Start here.
Add the chat to a Blogger blog
Blogger takes the snippet through an HTML/JavaScript gadget in Layout, or in Theme, Edit HTML. The gadget route is safer and reversible.
Add the chat to a Squarespace site
Squarespace Code Injection takes the snippet in one paste. Here is the exact field, the plans that have it, and how to test properly.
Name visitors on the widget
Pass your own user's id and name so conversations show who is chatting. It is a label, never a login.
Ready to try it on your own content?
Create a free workspace, add a document, and ask the questions your team is tired of answering.