Open kjartank13 opened 6 years ago
I am also facing same issue, @kjartank13 did you find solution?
Yeah, I did. I edited the post, putting the solution at the bottom. The event names look like they should be variables, but they're actually strings. My issue was resolved by putting quotes around the event names.
So, admob.interstitial.events.LOAD
becomes "admob.interstitial.events.LOAD"
.
I'm having an issue wherein events appear as being undefined. What I've written so far is...
admob.setOptions({ isTesting: true, autoShow: false, publisherId: "<removed for copy/paste>", interstitialAdId: "<removed for copy/paste>" });
admob.interstitial.config({ id: "<removed for copy/paste>" });
admob.interstitial.prepare();
admob.interstitial.show();
This all works just fine and I am getting the ad to appear. But I'm also attempting to listen for events and I'm doing that like so...
document.addEventListener(admob.interstitial.events.LOAD, ads.adLoaded.bind(this)); document.addEventListener(admob.interstitial.events.LOAD_FAIL, ads.adError.bind(this)); document.addEventListener(admob.interstitial.events.OPEN, function (e) {}); document.addEventListener(admob.interstitial.events.CLOSE, ads.adFinished.bind(this));
When I attempt to run the listener code, I get an error telling me that admob.interstitial.events is undefined. Can anyone suggest a reason and/or fix for this?
EDIT: Figured it out. The events are strings, not variables. Putting quotation marks works. Like so...
document.addEventListener("admob.interstitial.events.LOAD", ads.adLoaded.bind(this));