'use client' import Link from 'next/link' import { ArrowLeftIcon } from '@ciphera-net/ui' export default function ReactIntegrationPage() { return (
{/* * --- ATMOSPHERE (Background) --- */}
Back to Integrations

React Integration

For standard React SPAs (Create React App, Vite, etc.), you can simply add the script tag to your index.html.


Method 1: index.html (Recommended)

The simplest way is to add the script tag directly to the <head> of your index.html file.

public/index.html
{`

  
    
    
    
    
    
    
    My React App
  
  
    
`}

Method 2: Programmatic Injection

If you need to load the script dynamically (e.g., only in production), you can use a useEffect hook in your main App component.

src/App.tsx
{`import { useEffect } from 'react'

function App() {
  useEffect(() => {
    // Only load in production
    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 (
    

Hello World

) }`}
) }