Embedding the Beamer script in your React application can be done differently based on whether you’re using a vanilla React setup or a Vite + React setup or Nextjs. This guide will help you integrate Beamer with your Next.js setup.
Embedding the Beamer script in your Next.js application can be done differently based on whether you’re using the traditional /pages directory or the new App Router with the /app directory. This guide will help you integrate Beamer with your Next.js project.
For a Next.js setup using the traditional /pages
directory, you need to embed the Beamer script using the next/script
component in your pages or _app.js
.
_app.js
:pages
folder._app.js
.Add the following script tags using the next/script
component:
import "@/styles/globals.css";
import type { AppProps } from "next/app";
import Script from "next/script";
export default function App({ Component, pageProps }: AppProps) {
return (
<>
<Script id="beamer-config" strategy="beforeInteractive">
{`var beamer_config={product_id:"your_product_id",feedback_button:true,feedback_button_position:"right"};`}
</Script>
<Script
src="https://app.getbeamer.com/js/beamer-embed.js"
strategy="beforeInteractive"
/>
);
}
_app.js
file.npm run dev
or yarn dev
.Click Here to know about How to Inject User Data into Beamer script in React
For a Next.js setup using the new App Router with the /app directory, you need to embed the Beamer script in the app/layout.tsx file.
layout.tsx
:app
folder.layout.tsx
.Add the following script tags using the next/script
component:
import type { Metadata } from "next";
import Script from "next/script";
import "./globals.css";
const inter = Inter({ subsets: ["latin"] });
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};
export default function RootLayout({
children,
}: Readonly<{ children: React.ReactNode }>) {
return (
<html lang="en">
<head>
<Script id="beamer-config">
{`var beamer_config={product_id:"your_product_id",feedback_button:true,feedback_button_position:"right"};`}
</Script>
<Script src="https://app.getbeamer.com/js/beamer-embed.js" />
);
}
layout.tsx
file.npm run dev
or yarn dev
.By following these steps, you can effectively embed the Beamer script in your Next.js application, whether you’re using the traditional /pages
directory or the new App Router with the /app
directory.
Click Here to know about How to Inject User Data into Beamer script in React
Help us help you more
At Beamer, we care about our customers’ data and this is how we protect it.
Data Ownership
Your account and data belongs to you and will not be sold in any case. We can delete your account and data upon your request. Learn more
Encryption
Beamer data is encrypted in transit (advanced TLS protocols and 2,048-bit keys or better) and at rest (using AES 256 encryption with integrity).
Access
Customer data is always backed up and uptime is over 99.9%.
GDPR
Beamer is GDPR Compliant and has the Data Processing Agreements in place. Learn more
Penetration testing
Third party network, application and physical security tests are conducted regularly. Learn more