react-adsense

:film_projector: a simple React-component for Google AdSense / Baidu advertisement.

Github星跟蹤圖

react-adsense

react-adsense is a React-component for Google AdSense / Baidu advertisement.

Build Status
npm
npm
npm
demo

1. Install

npm install --save react-adsense

Before use Google AdSense, you should add the script at the end of HTML.

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

2. Usage

import React from 'react';
import AdSense from 'react-adsense';

// ads with no set-up
<AdSense.Google
  client='ca-pub-7292810486004926'
  slot='7806394673'
/>

// ads with custom format
<AdSense.Google
  client='ca-pub-7292810486004926'
  slot='7806394673'
  style={{ width: 500, height: 300, float: 'left' }}
  format=''
/>

// responsive and native ads
<AdSense.Google
  client='ca-pub-7292810486004926'
  slot='7806394673'
  style={{ display: 'block' }}
  layout='in-article'
  format='fluid'
/>

// auto full width responsive ads
<AdSense.Google
  client='ca-pub-7292810486004926'
  slot='7806394673'
  style={{ display: 'block' }}
  format='auto'
  responsive='true'
  layoutKey='-gw-1+2a-9x+5c'
/>

3. Props

  • Required props:
    • client
    • slot
  • Optional props:
    • className:
    • style:
    • layout:
    • layoutKey:
    • format:
    • responsive:

4. TODO

  • Baidu advertisement supported.

LICENSE

MIT@hustcc.

主要指標

概覽
名稱與所有者hustcc/react-adsense
主編程語言JavaScript
編程語言JavaScript (語言數: 2)
平台
許可證MIT License
所有者活动
創建於2016-10-09 11:29:32
推送於2023-03-27 13:51:54
最后一次提交2019-11-04 07:16:56
發布數0
用户参与
星數275
關注者數7
派生數43
提交數26
已啟用問題?
問題數18
打開的問題數7
拉請求數6
打開的拉請求數2
關閉的拉請求數2
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?