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

1.0.2 • Public • Published

@pkasila/react-adsense

npm package Build Status Downloads Issues Code Coverage Commitizen Friendly Semantic Release

ReactAdsense is a component which allows you to use Google Adsense in React

Install

npm install @pkasila/react-adsense

Ads by Google script

Remember to include adsbygoogle.js:

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

Usage

import React from 'react';
import ReactAdsense from '@pkasila/react-katex';

function SimpleAd() {
  return <ReactAdsense client={'ca-pub-XXXXXXXXXXXXXXX'}
                       slot={'YYYYYYYYY'} />;
}

function CustomStyles() {
  return <ReactAdsense client={'ca-pub-XXXXXXXXXXXXXXX'}
                       slot={'YYYYYYYYY'}
                       format={''}
                       style={{width: 960, height: 64}} />;
}

function ResponsiveNativeAds() {
  return <ReactAdsense client={'ca-pub-XXXXXXXXXXXXXXX'}
                       slot={'YYYYYYYYY'}
                       layout={'in-article'}
                       format={'fluid'} />;
}

Package Sidebar

Install

npm i @pkasila/react-adsense

Weekly Downloads

21

Version

1.0.2

License

MIT

Unpacked Size

12.5 kB

Total Files

11

Last publish

Collaborators

  • pkasila