1.1.11 • Published 3 years ago

gpt-ads-react v1.1.11

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Google Publisher Tag Implementation for React

A React implementation of the google publisher tag SDK.

Installation:

run the following command to install pacakage:

npm install --save gpt-ads-react

or

yarn add gpt-ads-react

Usage

To use this package please load GPT library on the head

 <head>
    <meta charset="utf-8">
    <title>First GPT Implementation On React</title>
    <script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
</head>

Then define Provider and AdsSlot on the App component

import React, { Component } from 'react';
import { GooglePublisherTagProvider, AdsSlot } from 'react-ads-gpt';


const App = () => {
  return <GooglePublisherTagProvider 
          networkId="network-id-from-ad-manager">
            <AdsSlot adUnit="adunit/from-ad-manager" size={[300, 250]} />
            <AdsSlot adUnit="adunit/from-ad-manager" size={[300, 250]} />
            <AdsSlot adUnit="adunit/from-ad-manager" size={[300, 250]} />
        </GooglePublisherTagProvider>
}

API reference

GooglePublisherTagProvider

PropsTypeDesc
networkIdstringsome desc
childrenReact.nodesome desc
disableInitialLoadbooleansome desc
enableCollapseEmptyDivsbooleansome desc
enablePersonalizeAdsbooleansome desc
enableLazyLoadbooleansome desc
enableSingleRequestbooleansome desc
enableLoadLimitedAdsSDKbooleansome desc
enableLoadSDKScriptByPromisebooleansome desc
targetingArgumentsMap<string, string Array>some desc

AdsSlot

PropsTypeDesc
networkIdstringsome desc
slotIdstringsome desc
adUnitstringsome desc
sizesGeneralSizesome desc
isOutOfPageSlotbooleansome desc
sizeMappingArraysome desc
targetingArguments"Map<string, stringArray>"some desc
onImpressionViewableImpressionViewableEventCallbackTypesome desc
onSlotOnloadSlotOnloadEventCallbackTypesome desc
onSlotRenderEndedSlotRenderEndedEventCallbackTypesome desc
onSlotRequestedSlotRequestedEventCallbackTypesome desc
onSlotResponseReceivedSlotResponseReceivedCallbackTypesome desc
onSlotVisibilityChangedSlotVisibilityChangedEventCallbackTypesome desc

Flow Type Definition

You can look type defintion which is used in this project on src/definition.js

1.1.11

3 years ago

1.1.9

3 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.10

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.1.2

3 years ago

1.0.32

3 years ago

1.0.31

3 years ago

1.0.22

4 years ago

1.0.26

4 years ago

1.0.25

4 years ago

1.0.29

4 years ago

1.0.28

4 years ago

1.0.27

4 years ago

1.0.30

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.0

4 years ago