1.1.11 • Published 1 year 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
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