剑客
关注科技互联网

react-adsence:简单的 Google 广告 React 组件

react-adsence

react-adsence is a React-component for Google AdSence / Baidu advertisement.

1. Install

npm install react-adsence

Before use Google AdSence, 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 AdSence from 'react-adsence';

<AdSence.Google client='ca-pub-7292810486004926'
                slot='7806394673' />

// or

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

3. TODO

  • Baidu
    advertisement supported.
  • Google
    sync adsence supported.

4. LICENSE

MIT

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址