react-google-ad

A React component to display a Google Adsense advert.

Usage no npm install needed!

<script type="module">
  import reactGoogleAd from 'https://cdn.skypack.dev/react-google-ad';
</script>

README

Google Ad React Component

Installation

npm i --save react-google-ad

Then in your HTML include:

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

Usage

import GoogleAd from 'react-google-ad'
<GoogleAd client="xxx" slot="xxx" format="xxx" />

Arguments

  • client: the data-ad-client provided by Google
  • slot: the data-ad-slot provided by Google
  • format: the data-ad-format provided by Google