- 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)
57 lines
1.5 KiB
Plaintext
57 lines
1.5 KiB
Plaintext
---
|
|
title: "React"
|
|
description: "Integrate Pulse analytics with any React SPA — Create React App, Vite, or custom setups. Two easy methods."
|
|
category: "framework"
|
|
brandColor: "#61DAFB"
|
|
officialUrl: "https://react.dev"
|
|
relatedIds: ["nextjs", "remix", "gatsby", "preact"]
|
|
date: "2026-03-28"
|
|
---
|
|
|
|
For standard React SPAs, add the script to your `index.html`.
|
|
|
|
---
|
|
|
|
## Method 1: index.html (Recommended)
|
|
|
|
The simplest approach is to add the Pulse script directly to your HTML entry point.
|
|
|
|
<CodeBlock filename="public/index.html">{`<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
|
|
<script
|
|
defer
|
|
data-domain="your-site.com"
|
|
src="https://pulse.ciphera.net/script.js"
|
|
></script>
|
|
|
|
<title>My React App</title>
|
|
</head>
|
|
<body>
|
|
<div id="root"></div>
|
|
</body>
|
|
</html>`}</CodeBlock>
|
|
|
|
## Method 2: Programmatic injection via useEffect
|
|
|
|
If you prefer to inject the script programmatically (e.g. only in production), use a `useEffect` hook.
|
|
|
|
<CodeBlock filename="src/App.tsx">{`import { useEffect } from 'react'
|
|
|
|
function App() {
|
|
useEffect(() => {
|
|
if (process.env.NODE_ENV === 'production') {
|
|
const script = document.createElement('script')
|
|
script.defer = true
|
|
script.setAttribute('data-domain', 'your-site.com')
|
|
script.src = 'https://pulse.ciphera.net/script.js'
|
|
document.head.appendChild(script)
|
|
}
|
|
}, [])
|
|
|
|
return <div className="App"><h1>Hello World</h1></div>
|
|
}`}</CodeBlock>
|