eisberg labs logo
Eisberg Labs React Components
About UsBlog

Downloads

Next Google Adsense

NextJS React Component for Google Adsense.

Installation

npm i --save @eisberg-labs/next-google-adsense

Usage

Follow the instructions on Google Adsense and create ads.txt in the public directory. Format of ads.txt should be something like:
google.com, pub-0000000, DIRECT, 00000000
If you just want to run autoads, adding <Adsense client_id="..."> on your page should be enough:

export default function Page(){
    return (
        <>
          <Adsense client_id="myClientId"/>
        </>
    )
}

To include an ad unit:

import {AdUnit} from "@eisberg-labs/next-google-adsense";

export default function Page() {
  return (
    <>
      <Adsense client_id="myClientId"/>
      <AdUnit className="adsbygoogle block"
                data-ad-client="..."
                data-ad-slot="..."
                data-ad-format="auto"
                data-full-width-responsive="true"/>
      </>);
}

License

MIT © Eisberg Labs

Examples

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

4.0.2 (2023-01-25)

Note: Version bump only for package @eisberg-labs/next-google-adsense

4.0.1 (2023-01-25)

Note: Version bump only for package @eisberg-labs/next-google-adsense

4.0.0 (2023-01-25)

Note: Version bump only for package @eisberg-labs/next-google-adsense

3.1.1 (2023-01-04)

Bug Fixes

3.1.0 (2023-01-03)

Note: Version bump only for package @eisberg-labs/next-google-adsense

3.0.1 (2023-01-02)

Bug Fixes

3.0.0 (2022-12-27)

Bug Fixes

Features