0.21.0 • Published 3 years ago

react-dfp v0.21.0

Weekly downloads
9,781
License
-
Repository
github
Last release
3 years ago

React DFP · Build Status npm.io Minizipped size GitHub license npm.io

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 🍻.

0.21.0

3 years ago

0.20.2

3 years ago

0.20.1

3 years ago

0.20.0

3 years ago

0.19.0

4 years ago

0.18.0

4 years ago

0.17.3

4 years ago

0.17.2

4 years ago

0.17.1

4 years ago

0.17.0

4 years ago

0.16.0

4 years ago

0.15.0

4 years ago

0.14.2

4 years ago

0.14.1

5 years ago

0.14.0

5 years ago

0.13.0

5 years ago

0.12.2

5 years ago

0.12.1

5 years ago

0.12.0

5 years ago

0.11.2

5 years ago

0.11.1

5 years ago

0.11.0

5 years ago

0.10.3

5 years ago

0.10.2

5 years ago

0.10.1

5 years ago

0.10.0

5 years ago

0.9.3

5 years ago

0.9.2

5 years ago

0.9.1

5 years ago

0.9.0

5 years ago

0.8.1

5 years ago

0.8.0

5 years ago

0.7.6

5 years ago

0.7.5

6 years ago

0.7.4

6 years ago

0.7.3

6 years ago

0.7.2

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.6.0

6 years ago

0.5.0

6 years ago

0.4.2

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.8

7 years ago

0.3.7

7 years ago

0.3.6

7 years ago

0.3.5

8 years ago

0.3.4

8 years ago

0.3.3

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago