MyGit

jaanauati/react-dfp

Fork: 53 Star: 127 (更新于 2024-11-17 13:14:10)

license: MIT

Language: JavaScript .

A React implementation of the Google DFP/GPT api. https://react-dfp.surge.sh

最后发布版本: v0.21.0 ( 2021-07-04 13:54:41)

GitHub网址

React DFP · Build Status Minizipped size GitHub license

A React implementation of the google DFP API. This package is inspired in the awesome library jquery.dfp, and aims to provide its same ease of usage but, of course, taking into consideration the react concepts & lifecycle features.

Installation:

To install just run the following command (no other dependencies are required):

npm install --save react-dfp

or

yarn add react-dfp

You can find more details in the React-dfp site.

Getting started

React-dfp has been designed in a very React-ish way, its main goal is to be able to serve DFP ads in your React application just using React components, which means that you won't have to programmatically perform any initialization call when your page loads.

Here a quick example, notice that ads will render in your page as soon as your component is mounted, through its components (DFPSlotsProvider and AdSlot), react-dfp is making a full abstraction of the google dfp/gpt API.

import React, { Component } from 'react';
import { DFPSlotsProvider, AdSlot } from 'react-dfp';
...
class Page extends Component {
   render() {
     ...

     return (
        <DFPSlotsProvider>
         ...
         <AdSlot adUnit="home/leaderboard" sizes={[ [900, 90], [728, 90]]} />
         ...
         /* you can override the props */
         <AdSlot adUnit="home/mobile" sizes={[ [300, 250], [300, 600]]} />
         ...
         <div>
           ...
           <AdSlot adUnit="home/footer" sizes={[ [300, 250], [300, 600]]} />
           ...
         </div>
         ...
       </DFPSlotsProvider>
     );
   }
}

Examples

See the React-dfp site for more examples (basic example, how to have refreshable ads, etc).

Documentation

You can find the React-dfp documentation on the website. The site is divided into many sections that describe each one the Components, properties and also the DFPManager API (in case you need to use this one manually).

The website is also full of live/working examples.

You can find the source code of the website here: https://github.com/jaanauati/react-dfp-website.

Wanna help?

I certainly know that test cases need to be improved, but, as long as your syntax is clean, submit test cases and, of course, all the interfaces are kept working, all kind of contribution is welcome.

Complaints.

Pull requests are welcome 🍻.

最近版本更新:(数据更新于 2024-10-21 16:00:12)

2021-07-04 13:54:41 v0.21.0

2021-05-21 06:11:01 v0.20.2

2021-03-24 19:01:39 v0.20.1

2021-03-05 21:24:10 v0.20.0

2020-09-24 21:09:26 v0.19.0

2020-08-13 21:32:55 v0.18.0

2020-06-25 20:26:06 v0.17.3

2020-06-25 20:25:42 v0.17.2

2020-02-18 03:43:49 v0.17.1

2020-02-18 03:43:13 v0.17.0

主题(topics):

advertising, dfp, es6, gpt, reactjs

jaanauati/react-dfp同语言 JavaScript最近更新仓库

2024-11-22 16:46:00 meshery/meshery

2024-11-21 23:03:24 bia-pain-bache/BPB-Worker-Panel

2024-11-21 22:46:48 MHSanaei/3x-ui

2024-11-21 07:00:59 nodejs/node

2024-11-21 00:49:46 FortAwesome/Font-Awesome

2024-11-18 14:26:02 projectdiscovery/nuclei-templates