diff --git a/app/integrations/nextjs/page.tsx b/app/integrations/nextjs/page.tsx new file mode 100644 index 0000000..12ec2c4 --- /dev/null +++ b/app/integrations/nextjs/page.tsx @@ -0,0 +1,129 @@ +'use client' + +import Link from 'next/link' +import { ArrowLeftIcon } from '@ciphera-net/ui' + +export default function NextJsIntegrationPage() { + return ( +
+ The best way to add Pulse to your Next.js application is using the built-in next/script component.
+
+ Add the script to your root layout file (usually app/layout.tsx or app/layout.js).
+
+{`import Script from 'next/script'
+
+export default function RootLayout({
+ children,
+}: {
+ children: React.ReactNode
+}) {
+ return (
+
+
+
+
+ {children}
+
+ )
+}`}
+
+
+ If you are using the older Pages Router, add the script to your custom _app.tsx or _document.tsx.
+
+{`import Script from 'next/script'
+import type { AppProps } from 'next/app'
+
+export default function App({ Component, pageProps }: AppProps) {
+ return (
+ <>
+
+
+ >
+ )
+}`}
+
+ example.com).
+ https://pulse.ciphera.net/script.js
+ afterInteractive to ensure it loads quickly without blocking hydration.
+
+ For standard React SPAs (Create React App, Vite, etc.), you can simply add the script tag to your index.html.
+
+ The simplest way is to add the script tag directly to the <head> of your index.html file.
+
+{`
+
+
+
+
+
+
+
+
+ My React App
+
+
+
+
+`}
+
+
+ If you need to load the script dynamically (e.g., only in production), you can use a useEffect hook in your main App component.
+
+{`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
+
+ )
+}`}
+
+
+ Integrating Pulse with Vue.js is straightforward. You can add the script to your index.html file.
+
+ Add the script tag to the <head> section of your index.html file. This works for both Vue 2 and Vue 3 projects created with Vue CLI or Vite.
+
+{`
+
+
+
+
+
+
+
+
+ My Vue App
+
+
+
+
+
+`}
+
+
+ For Nuxt.js applications, you should add the script to your nuxt.config.js or nuxt.config.ts file.
+
+{`export default defineNuxtConfig({
+ app: {
+ head: {
+ script: [
+ {
+ src: 'https://pulse.ciphera.net/script.js',
+ defer: true,
+ 'data-domain': 'your-site.com'
+ }
+ ]
+ }
+ }
+})`}
+
+ + You can add Pulse to your WordPress site without installing any heavy plugins, or by using a simple code snippet plugin. +
+ +
+{``}
+
+
+ If you are comfortable editing your theme files, you can add the script directly to your header.php file.
+
header.php from the right sidebar.</head> tag.