1.1.11 • Published 3 years ago
gpt-ads-react v1.1.11
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
Props | Type | Desc |
---|---|---|
networkId | string | some desc |
children | React.node | some desc |
disableInitialLoad | boolean | some desc |
enableCollapseEmptyDivs | boolean | some desc |
enablePersonalizeAds | boolean | some desc |
enableLazyLoad | boolean | some desc |
enableSingleRequest | boolean | some desc |
enableLoadLimitedAdsSDK | boolean | some desc |
enableLoadSDKScriptByPromise | boolean | some desc |
targetingArguments | Map<string, string Array> | some desc |
AdsSlot
Props | Type | Desc | |
---|---|---|---|
networkId | string | some desc | |
slotId | string | some desc | |
adUnit | string | some desc | |
sizes | GeneralSize | some desc | |
isOutOfPageSlot | boolean | some desc | |
sizeMapping | Array | some desc | |
targetingArguments | "Map<string, string | Array>" | some desc |
onImpressionViewable | ImpressionViewableEventCallbackType | some desc | |
onSlotOnload | SlotOnloadEventCallbackType | some desc | |
onSlotRenderEnded | SlotRenderEndedEventCallbackType | some desc | |
onSlotRequested | SlotRequestedEventCallbackType | some desc | |
onSlotResponseReceived | SlotResponseReceivedCallbackType | some desc | |
onSlotVisibilityChanged | SlotVisibilityChangedEventCallbackType | some 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