Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ module.exports = React.createClass({

## Parameters

| Name | Type | Required | Default |
| Name | Type | Required | Default |
|----------------------------|------------------|-----------|------------|
| path | String | true | |
| responsive | Boolean | true | true |
Expand All @@ -82,6 +82,7 @@ module.exports = React.createClass({
| onImpressionViewable | Function | false | |
| onSlotVisibilityChanged | Function | false | |
| collapseEmptyDiv | boolean or Array | false | |
| slotRefresher | Function | false | |

## Path

Expand Down Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions src/GooglePublisherTag.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -146,6 +147,7 @@ export default class GooglePublisherTag extends Component {
enableSingleRequest: false,
dimensions: null,
resizeDebounce: 100,
slotRefresher: slot => googletag.pubads().refresh([slot]),
};

componentDidMount() {
Expand Down Expand Up @@ -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() {
Expand All @@ -266,7 +268,7 @@ export default class GooglePublisherTag extends Component {

refreshSlot() {
if (this.slot) {
googletag.pubads().refresh([this.slot]);
this.props.slotRefresher(this.slot);
}
}

Expand Down