Captain_Satya
Captain_Satya

Reputation: 61

How to programmatically know if an Google AdSense ad is successfully displayed or if any error occured in my react/next.js website?

Our site let's user post content and we display ads on them and share some part of ad revenue with user just like YouTube. Now the issue is how to programmatically know if an ad was successfully displayed on user's post? We want to count the number of ads successfully displayed on user's post so that we can share the revenue accordingly. Are there any functions like onAdLoadSuccess(), or onAdError() etc so that we can write our own logic inside these functions to maybe save totalAdCounts in a database?

Upvotes: 1

Views: 1591

Answers (1)

Mikita Belahlazau
Mikita Belahlazau

Reputation: 15419

You can use data-ad-status to detect whether given ad slot has been filled. It's the closest variant to onAdLoadSuccess() adsense has: https://support.google.com/adsense/answer/10762946?hl=en

Upvotes: 2

Related Questions