Skip to Content
pushmarket.io is released 🎉

How to integrate in next.js app

In this section, we are going to tell you that how to integrate https://pushmarket.io  with Next.js

follow these steps:

  1. Install the package using npm or yarn

npm

npm install @presswink/pushmarket.io

yarn

yarn add @presswink/pushmarket.io
  1. Import it in your app
import { PushMarket } from '@presswink/pushmarket.io'
  1. Add the PushMarket component to your app below all tags in root file. Please replace {{your-project-id}} with your project id
<PushMarket projectId="{{your-project-id}}" />
  1. Create a new javascript file

Create a new javascript file, called sw.js in the public folder and add the following code to it.

/public/sw.js

importScripts("https://pushmarket.io/sdk/service-worker.js")

Example:

  1. Example

layout.tsx

import type { Metadata } from "next"; import "./globals.css"; import { PushMarket } from '@presswink/pushmarket.io' export default function RootLayout({ children, }: Readonly<{ children: React.ReactNode; }>) { return ( <html lang="en"> <body className={`${geistSans.variable} ${geistMono.variable} antialiased`} > {children} </body> {/** below body tags */} <PushMarket projectId="project-id" /> </html> ); }
Last updated on