pkasila / ReactAdsense

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@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'} />;
}

About

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

License:MIT License


Languages

Language:TypeScript 93.7%Language:Shell 6.3%