Files
pulse/content/integrations/gatsby.mdx
Usman Baig 066f1288f1 feat: trim integration pages from 75 to 25 + migrate to MDX
- Add dedicatedPage flag to integration registry (25 true, 50 false)
- Delete hardcoded nextjs/react/vue/wordpress route pages (wrong metadata)
- Hub page routes non-dedicated integrations to /integrations/script-tag
- Add 301 redirects for 50 removed slugs → /integrations/script-tag
- Migrate guide content from TSX to MDX (content/integrations/*.mdx)
- Add gray-matter, next-mdx-remote, remark-gfm dependencies
- Add content loader (lib/integration-content.ts) matching ciphera-website pattern
- Add prebuild script for integration guide index generation
- Sitemap reduced from 83 to 35 URLs with real lastmod dates
- Remove seoDescription from registry (now in MDX frontmatter)
2026-03-29 00:28:47 +01:00

53 lines
1.3 KiB
Plaintext

---
title: "Gatsby"
description: "Add Pulse analytics to your Gatsby site using gatsby-ssr or the Gatsby Head API."
category: "ssg"
brandColor: "#663399"
officialUrl: "https://www.gatsbyjs.com/docs"
relatedIds: ["react", "nextjs", "hugo"]
date: "2026-03-28"
---
Use the Gatsby SSR API or the Gatsby Head API to add Pulse to your site.
---
## Method 1: gatsby-ssr.js
Use the `onRenderBody` hook to inject the Pulse script into every page's `<head>`.
<CodeBlock filename="gatsby-ssr.js">{`import React from "react"
export const onRenderBody = ({ setHeadComponents }) => {
setHeadComponents([
<script
key="pulse-analytics"
defer
data-domain="your-site.com"
src="https://pulse.ciphera.net/script.js"
/>,
])
}`}</CodeBlock>
## Method 2: Gatsby Head API (v4.19+)
If you're on Gatsby 4.19 or later, you can use the Head export in any page or template component.
<CodeBlock filename="src/pages/index.tsx">{`import React from "react"
export function Head() {
return (
<script
defer
data-domain="your-site.com"
src="https://pulse.ciphera.net/script.js"
/>
)
}
export default function IndexPage() {
return <h1>Hello World</h1>
}`}</CodeBlock>
For more details, see the [Gatsby Head API docs](https://www.gatsbyjs.com/docs/reference/built-in-components/gatsby-head/).