1.1.11 • Published 1 year ago

gpt-ads-react v1.1.11

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year 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

1 year ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.10

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.2

2 years ago

1.0.32

2 years ago

1.0.31

2 years ago

1.0.22

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.29

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.30

2 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago