Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nextjs-edgee

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nextjs-edgee

The Edgee SDK for React applications

  • 1.0.2
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
0
Weekly downloads
 
Created
Source

nextjs-edgee Component

EdgeeSdk is a React component that injects the Edgee SDK script into the application. It also sets up listeners to track page navigations via history.pushState and history.replaceState to automatically call the edgee.page method, ensuring page views are tracked during SPA navigations.

NPM NPM Downloads

Install

using npm:

npm install nextjs-edgee

using yarn:

yarn add nextjs-edgee

Usage

import using:

import EdgeeSdk from 'nextjs-edgee';

Usage with app/layout.js for app folder structure

For rendering add <EdgeeSdk /> to your return() inside the <body></body> of RootLayout():

import EdgeeSdk from "nextjs-edgee";

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>
        {children}
        <EdgeeSdk src={"https://yourdomain.com/_edgee/sdk.js"} />
      </body>
    </html>
  );
}

Usage with pages/_app.js for pages folder structure

For rendering add <EdgeeSdk /> to your return() in MyApp():

import EdgeeSdk from 'nextjs-edgee';

export default function MyApp({ Component, pageProps }) {
  return (
    <>
      <Component {...pageProps} />
      <EdgeeSdk src="https://yourdomain.com/_edgee/sdk.js" />
    </>
  );
}

Usage with React, Vite React or any other React Based Framework

For rendering add <EdgeeSdk /> to your return() inside the component in App() in your App.js:

import EdgeeSdk from 'nextjsedgee';
const App = () => {
  return (
    <div>
    <Router>
      <EdgeeSdk src="https://yourdomain.com/_edgee/sdk.js" />
    <Routes>
    {/* Your Routes Here */}
    </Routes>
    </Router>
    </div>
  )
}

export default App;

Edgee Context Payload Usage

import using:

import { EdgeeSdk, EdgeeContextPayload, EdgeeContextObject } from "nextjs-edgee";

Usage with app/layout.js for app folder structure

import { EdgeeSdk, EdgeeContextPayload, EdgeeContextObject } from "nextjs-edgee";

export default function RootLayout({ children }) {
  const edgeeContextPayload: EdgeeContextObject = {
    page: {
      name: "With Edgee",
      category: "demo",
      title: "With Edgee",
      url: "https://mysite.com/my/path",
      path: "/my/path",
      search: "?ok",
      keywords: ["demo", "edgee"],
      properties: {
        section: "edge computing",
        order: 6
      }
    },
    identify: {
      userId: "12345",
      anonymousId: "12345",
      properties: {
        email: "me@example.com",
        name: "John Doe",
        age: 32
      }
    },
    destinations: {
      all: true,
      google_analytics: true,
      amplitude: true,
      facebook_capi: true
    }
  };

  return (
    <html lang="en">
      <body>
        {children}
        <EdgeeSdk src={"https://yourdomain.com/_edgee/sdk.js"} />
      </body>
    </html>
  );
}

To know more about the Edgee SDK, visit the Edgee SDK documentation.

Keywords

FAQs

Package last updated on 22 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc