Ghost Integration
Step-by-step guide to tracking banner ads in Ghost newsletters and websites
Ghost Integration
Ghost has excellent HTML support through HTML cards in the editor, making it one of the best platforms for BannerTrackr integration. The same HTML works in both the web post and email newsletter.
Prerequisites
- A BannerTrackr account with at least one placement created
- Your Pixel ID from the placement
- The sponsor's banner image
Ghost Newsletter Emails
Ghost sends posts directly to subscribers as emails. Here's how to add tracked sponsor banners.
Method 1: Smart Image (Recommended)
Use a single URL for image hosting, impressions, and clicks.
Step 1: Set Up Your Placement
- Go to your BannerTrackr dashboard
- Create or edit a placement
- Upload the sponsor's banner image
- Set the destination URL
- Copy your Smart Image URL:
https://bannertrackr.com/api/track/img/YOUR_PIXEL_ID
Step 2: Add HTML Card in Ghost
- Open your Ghost editor
- On a new line, type
/htmland press Enter (or click + and select HTML) - Paste this code:
<div style="text-align: center; margin: 2em 0;">
<a href="https://bannertrackr.com/api/track/img/YOUR_PIXEL_ID">
<img
src="https://bannertrackr.com/api/track/img/YOUR_PIXEL_ID"
alt="Sponsored by [Sponsor Name]"
style="max-width: 100%; height: auto;"
/>
</a>
</div>- Replace
YOUR_PIXEL_IDwith your actual Pixel ID
Pro Tip: HTML cards support visibility settings. Click the 👁️ icon in the card toolbar to show/hide content for different member tiers.
Method 2: Using Ghost's Image Card + Tracking Pixel
If you prefer Ghost's built-in image cards:
- Add an image card with your banner
- Add an HTML card right below with the tracking pixel:
<img
src="https://bannertrackr.com/api/track/px/YOUR_PIXEL_ID"
width="1"
height="1"
alt=""
style="opacity: 0;"
/>Note: Ghost's image cards don't support custom link URLs, so this method only tracks impressions, not clicks. For click tracking, use an HTML card with the full linked image.
Ghost Websites
For tracking banners on your Ghost website (not just in email newsletters).
Theme Integration
Add tracking to your Ghost theme for persistent ad placements.
In Theme Files (.hbs)
Edit your theme's Handlebars files (e.g., post.hbs, index.hbs):
<div class="sponsor-banner">
<a href="https://bannertrackr.com/api/track/img/YOUR_PIXEL_ID">
<img
src="https://bannertrackr.com/api/track/img/YOUR_PIXEL_ID"
alt="Sponsored"
loading="lazy"
/>
</a>
</div>Using Code Injection
For quick additions without editing theme files:
- Go to Settings → Code Injection
- Add to Site Footer:
<script>
document.addEventListener('DOMContentLoaded', function() {
const postContent = document.querySelector('.post-content');
if (postContent && postContent.children.length > 2) {
const sponsorBanner = document.createElement('div');
sponsorBanner.innerHTML = `
<div style="text-align: center; margin: 2em 0; padding: 1em; background: #f9f9f9;">
<small style="color: #888;">SPONSORED</small><br><br>
<a href="https://bannertrackr.com/api/track/img/YOUR_PIXEL_ID">
<img src="https://bannertrackr.com/api/track/img/YOUR_PIXEL_ID" alt="Sponsor" style="max-width: 100%;">
</a>
</div>
`;
postContent.insertBefore(sponsorBanner, postContent.children[2]);
}
});
</script>This inserts a sponsor banner after the second paragraph of each post.
Ghost Members Integration
Show different ads to free vs paid members:
Using Handlebars Conditionals
{{#if @member.paid}}
{{!-- No ads for paid members --}}
{{else}}
<div class="sponsor-banner">
<a href="https://bannertrackr.com/api/track/img/YOUR_PIXEL_ID">
<img src="https://bannertrackr.com/api/track/img/YOUR_PIXEL_ID" alt="Sponsor" />
</a>
</div>
{{/if}}Using HTML Card Visibility
In the Ghost editor, HTML cards have visibility settings:
- Add your HTML card with sponsor content
- Click the 👁️ icon in the card toolbar
- Choose who sees this content: Public, Free members, or Paid members
Email-Specific Content
Ghost has special card types for email-only content:
Email Content Card
Add content that only appears in the email (not on the web version):
- Type
/emailin the editor - Add your sponsor message
Email Call-to-Action Card
Add buttons that only appear in emails:
- Type
/email-ctain the editor - Customize the button
These can complement your BannerTrackr HTML cards.
Styling Examples
Newsletter Style (Table Layout)
For better email client compatibility:
<table width="100%" cellpadding="0" cellspacing="0" style="margin: 30px 0;">
<tr>
<td style="text-align: center;">
<p style="font-size: 11px; color: #888; margin-bottom: 10px;">SPONSORED</p>
<a href="https://bannertrackr.com/api/track/img/YOUR_PIXEL_ID">
<img
src="https://bannertrackr.com/api/track/img/YOUR_PIXEL_ID"
alt="Sponsor"
style="max-width: 600px; width: 100%;"
/>
</a>
</td>
</tr>
</table>Card Style (Website)
For a polished website look:
<div style="border: 1px solid #eee; border-radius: 8px; padding: 20px; margin: 20px 0; text-align: center;">
<span style="font-size: 10px; color: #aaa; text-transform: uppercase;">Sponsored</span>
<a href="https://bannertrackr.com/api/track/img/YOUR_PIXEL_ID" style="display: block; margin-top: 15px;">
<img
src="https://bannertrackr.com/api/track/img/YOUR_PIXEL_ID"
alt="Sponsor"
style="max-width: 100%; border-radius: 4px;"
/>
</a>
</div>Important Notes
Newsletter vs Web Tracking
Ghost sends the same content to:
- Email subscribers (newsletter)
- Your website (published post)
BannerTrackr tracks both. You'll see impressions from both sources in your stats. If you want to track them separately, create two placements.
Email Rendering Best Practices
Ghost uses its own email renderer. For best compatibility:
- Use inline CSS (not external stylesheets)
- Stick to basic HTML elements
- Avoid JavaScript in email content (it won't run)
- Use table layouts for complex structures
Recommended Banner Sizes
| Placement | Width | Notes |
|---|---|---|
| Newsletter | 600px | Ghost's email width |
| Full-width web | 1200px | For wide themes |
| Sidebar | 300px | Standard sidebar size |
Troubleshooting
Banner not appearing in emails?
- Make sure you're using an HTML card, not a markdown code block
- Check the HTML is valid (no unclosed tags)
- Send a test email to yourself
- Verify the placement isn't paused
Low newsletter impression counts?
- Some subscribers have images disabled by default
- Apple Mail Privacy Protection may pre-fetch images
- Check if the placement is paused or over its limit
Tracking works on web but not email?
Try simplifying the HTML:
- Remove complex CSS
- Use basic inline styles
- Test with a minimal image tag first
Next Steps
- UTM Tracking — Add tracking parameters to sponsor links
- Advertiser Portal — Give sponsors their own stats dashboard
- Reports — Generate professional PDF reports