diff --git a/README.md b/README.md index ac68c2f..6e0b239 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ module.exports = React.createClass({ ## Parameters -| Name | Type | Required | Default | +| Name | Type | Required | Default | |----------------------------|------------------|-----------|------------| | path | String | true | | | responsive | Boolean | true | true | @@ -82,6 +82,7 @@ module.exports = React.createClass({ | onImpressionViewable | Function | false | | | onSlotVisibilityChanged | Function | false | | | collapseEmptyDiv | boolean or Array | false | | +| slotRefresher | Function | false | | ## Path @@ -149,6 +150,10 @@ Pass a function that will be executed when the ad is fully rendered. Pass a function that will be executed when the on-screen percentage of an ad area changes +## slotRefresher + +Pass a function that will be used for refreshing slots. By default `googletag.pubads().refresh()` is used. + ## Credits [Zlatko Fedor](http://github.com/seeden) diff --git a/src/GooglePublisherTag.jsx b/src/GooglePublisherTag.jsx index cbbd573..46bd503 100644 --- a/src/GooglePublisherTag.jsx +++ b/src/GooglePublisherTag.jsx @@ -137,6 +137,7 @@ export default class GooglePublisherTag extends Component { resizeDebounce: PropTypes.number.isRequired, onSlotRenderEnded: PropTypes.func, onSlotVisibilityChanged: PropTypes.func, + slotRefresher: PropTypes.func.isRequired, }; static defaultProps = { @@ -146,6 +147,7 @@ export default class GooglePublisherTag extends Component { enableSingleRequest: false, dimensions: null, resizeDebounce: 100, + slotRefresher: slot => googletag.pubads().refresh([slot]), }; componentDidMount() { @@ -248,7 +250,7 @@ export default class GooglePublisherTag extends Component { // display new slot googletag.display(id); - googletag.pubads().refresh([slot]); + this.props.slotRefresher(slot); } removeSlot() { @@ -266,7 +268,7 @@ export default class GooglePublisherTag extends Component { refreshSlot() { if (this.slot) { - googletag.pubads().refresh([this.slot]); + this.props.slotRefresher(this.slot); } }