Skip to content

Commit

Permalink
add ads closed event
Browse files Browse the repository at this point in the history
  • Loading branch information
nechehin committed Nov 8, 2017
1 parent 2b0424b commit 9d19a8f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ catfish
### Events
Available events for listen:
- rendered (catfish.EVENTS.RENDERED) - fire after ads was rendered
- closed (catfish.EVENTS.CLOSED) - fire after ads was closed

```js
catfish
Expand Down
6 changes: 4 additions & 2 deletions googletag-catfish.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* Google-tag catfish
*
* @version 0.0.7
* @version 0.0.8
* @param {Object} gt GoogleTag object instance
* @return {Object}
*/
Expand All @@ -34,7 +34,8 @@ function googletagCatfish(gt) {
var SLOTS_MODES = {};

var EVENTS = {
RENDERED: 'rendered'
RENDERED: 'rendered',
CLOSED: 'closed'
};

var adsRendered = false;
Expand Down Expand Up @@ -134,6 +135,7 @@ function googletagCatfish(gt) {
*/
function hideAdsBox() {
adsBox.className = adsBox.className.replace('catfish-ads--visible', '');
fireEvent(EVENTS.CLOSED);
}


Expand Down
16 changes: 8 additions & 8 deletions googletag-catfish.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9d19a8f

Please sign in to comment.