@ctrl/react-adsense
TypeScript icon, indicating that this package has built-in type declarations

1.8.0 • Public • Published

@ctrl/react-adsense npm coverage status

DEMO: https://react-adsense.xmplaylist.com

Install

npm install @ctrl/react-adsense

Use

Use the standard AdSense code somewhere in your <head></head> as you normally would

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
import React from 'react';
import {Adsense} from '@ctrl/react-adsense';

// ads with no set-up
<Adsense
  client="ca-pub-7640562161899788"
  slot="7259870550"
/>

// ads with custom format
<Adsense
  client="ca-pub-7640562161899788"
  slot="7259870550"
  style={{ width: 500, height: 300 }}
  format=""
/>

// responsive and native ads
<Adsense
  client="ca-pub-7640562161899788"
  slot="7259870550"
  style={{ display: 'block' }}
  layout="in-article"
  format="fluid"
/>

/@ctrl/react-adsense/

    Package Sidebar

    Install

    npm i @ctrl/react-adsense

    Weekly Downloads

    3,666

    Version

    1.8.0

    License

    MIT

    Unpacked Size

    10.1 kB

    Total Files

    13

    Last publish

    Collaborators

    • scttcper