How to integrate SEO and analytics on Ghost
Integrate SEO and analytics on Ghost by configuring meta data settings, installing Google Analytics tracking code, and setting up Google Search Console. Ghost's built-in SEO features combined with proper analytics tracking provide comprehensive website optimization and performance monitoring.
Prerequisites
- Ghost CMS admin access
- Google Analytics account
- Basic understanding of SEO principles
- Google Search Console account
Step-by-Step Instructions
Configure Ghost SEO Settings
Set Up Individual Post SEO
Install Google Analytics 4
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'GA_MEASUREMENT_ID');
</script>Replace GA_MEASUREMENT_ID with your actual Google Analytics measurement ID.Set Up Google Search Console
Generate and Submit XML Sitemap
yoursite.com/sitemap.xml. In Google Search Console, go to Sitemaps in the left sidebar and click Add a new sitemap. Enter sitemap.xml and click Submit. Verify the sitemap is successfully processed and shows no errors.Configure Ghost Navigation for SEO
Set Up Advanced Analytics Tracking
<script>
// Track newsletter signups
document.addEventListener('submit', function(e) {
if (e.target.classList.contains('subscribe-form')) {
gtag('event', 'newsletter_signup', {
'event_category': 'engagement'
});
}
});
</script>This tracks newsletter subscriptions and other custom events in Google Analytics.Monitor and Optimize Performance
Common Issues & Troubleshooting
Google Analytics not tracking visitors
Verify the tracking code is in the Site header section, not footer. Check for JavaScript errors in browser console and ensure the measurement ID is correct.
Search Console verification failing
Clear Ghost cache after adding verification meta tag. Try HTML file verification method by uploading the file to your server root directory instead of using meta tags.
Sitemap not updating with new content
Check Settings → General and ensure your site is not set to private. Ghost automatically updates sitemaps, but it may take time to reflect in Search Console.
Meta descriptions not showing in search results
Ensure meta descriptions are under 160 characters and not keyword-stuffed. Google may choose to generate its own descriptions if yours don't match search intent.