4

Is there any way to detect when the user taps on the interstitial ads? I tried but did not find any callbacks for detecting interstitial ad clicks.

Any workaround for detecting the same would also be very helpful.

I want to detect ads click to prevent users from generating fake clicks for interstitial ads.

Praveen
  • 3,186
  • 2
  • 8
  • 23
  • Why you purposefully want to detect ad clicks from user? – Swaminathan V Jul 21 '21 at 13:15
  • @RaguSwaminathan To prevent users from generating fake clicks and leading to the suspension of the AdMob account. – Praveen Jul 21 '21 at 13:38
  • It will taken care by the Google. For testing and development purpose please try using the test ads. – Swaminathan V Jul 21 '21 at 13:44
  • @RaguSwaminathan Google doesn't take care of this, https://support.google.com/admob/answer/3342054, read 2nd point. Someone I know had generated fake clicks on my app's ads and now my account has limited ads serving. Repeated violations could lead to my account blocking. – Praveen Jul 21 '21 at 13:49
  • I understand that. But my question is how will you differentiate between normal user click and fake user click. After you publish the app to the stores Google will monitor for the invalid activity and then they will act accordingly. Meanwhile for dev purpose you can use test ads. Refer https://support.google.com/admob/answer/3342099 – Swaminathan V Jul 22 '21 at 03:42
  • 3
    For prevent fake clicks you can set Frequency capping in your admob. https://support.google.com/admob/answer/4377690 – Daxesh V Jul 22 '21 at 05:19
  • @RaguSwaminathan I'll limit ads on that particular user who clicks a certain number of ads for each day, If any user reaches the daily threshold. Ads would stop showing for that user. While Banner ads do have a callback, interstitial ads don't. I have an app with 3 million impressions per month and Google didn't monitor invalid traffic, instead, they limited ad serving and gave me a warning for account blocking. – Praveen Jul 22 '21 at 09:32
  • Have you tried writing to google or calling them (if possible)? If you seriously risk the ban, maybe you could try to turn to another advertising network for a while waiting for the waters to calm down, even if it is not a solution but only to limit the damage. Have you tried using something like Firebase to figure out the traffic source? Have you ever replied to the classic emails that promised an app boost? (in downloads or otherwise) – Francesco - FL Jul 22 '21 at 12:13
  • @FreeLearning I've tried to contact google, as they have forms to report these invalid activities by third parties, but I haven't got a reply from their team till now. I've tried other networks too but none of them have fill rates like Admob. I know the individual who is responsible for this, but I can't do anything about it as there's no way to prove it. No, I haven't used any third-party app boost or anything. For now, frequency capping seems like a feasible option, only after this limited ad serving ends. – Praveen Jul 23 '21 at 11:35
  • 1
    Alternative solution (perhaps impractical), if you know the responsible, could you be able to obtain the advertising code of the device? You could put it in the list of test devices. Have you tried writing to the admob community? Maybe if you are lucky you will find an expert user who tells you exactly what to do. https://support.google.com/admob/?hl=en#topic=7383088 – Francesco - FL Jul 23 '21 at 15:12
  • @FreeLearning I know the person but don't have access to their device. For now, I'm blocking anyone who's clicking on banner ads, more than a certain number of times and using frequency capping for interstitial ads. I haven't written to the AdMob community, thanks for suggesting this, will definitely try. – Praveen Jul 23 '21 at 15:27
  • @Praveen I read all the above comments it's bad luck that Admob has no support. Only bot reply there. Did you solve this issue? I want to discuss more in detail with you. – Bhavin Chauhan Nov 25 '21 at 07:43

3 Answers3

4

Google added back the removed interstitialAd callback onAdClicked() on SDK 20.4.0. Looks like they removed it and 6 months later realized they messed up and decided to add it back :)

Added the onAdClicked() callback to FullScreenContentCallback.

See the AdMob SDK release notes for details.

I’ve found that upgrading AdMob SDK to the latest version is a must.

Ramesh R
  • 7,009
  • 4
  • 25
  • 38
Jim
  • 51
  • 3
2

You can utilize the combination of ActivityLifecycleCallbacks and WindowCallback.

  • The ActivityLifecycleCallbacks enables you to observe every Activity lifecycle event that occurs in your app. All in one place.
  • The WindowCallback enables you to intercept many window events. One of the events that gets fired by the system that we are particularly interested in is dispatchTouchEvent.

Now, here is the strategy:

  1. Register our GlobalActivityLifecycleListener in the Application class
class MyApplication : Application() {

    override fun onCreate() {
        super.onCreate()
        registerActivityLifecycleCallbacks(GlobalActivityLifecycleListener())
    }
}
  1. Check if the currently displayed Activity is an Ad Activity. If yes, register our AdWindowCallbacks
class GlobalActivityLifecycleListener : Application.ActivityLifecycleCallbacks {
    //...
    override fun onActivityResumed(activity: Activity) {
        if (isAdActivity(activity)) {
            registerWindowCallbacks(activity)
        }
    }
    
    private fun registerWindowCallbacks(activity: Activity) {
        val currentWindow = activity.window
        /*This is needed to forward the events from our callback back to the original
        callback after we are done with the processing*/
        val originalCallbacks = currentWindow.callback
        currentWindow.callback = AdWindowCallbacks(originalCallbacks)
    }
}
  1. Intercept/process user touch events
class AdWindowCallbacks(private val originalCallback: Window.Callback) : Window.Callback {
    //...
    override fun dispatchTouchEvent(event: MotionEvent?): Boolean {
        //TODO process user touch event
        return originalCallback.dispatchTouchEvent(event)
    }
}

From there, you can detect the common gestures and act accordingly.

Muhammad Youssef
  • 373
  • 2
  • 11
0

I understand your point.

But technically there is no way to track the Interstitial ad clicks by user.

If you closely monitor the behavior, these ads are opened in a new page within your app. You can confirm them by logging onPause in your calling Activity.

And when user performs clicks on these ads, they are taken to respective destination either to Play Store or URL opened in mobile browser depending on the nature of the Ads.

As mentioned in comment section by @Daxesh Vekaria, you can set Frequency capping in your AdMob console

or try some other solution as suggested by @FreeLearning

EDIT 1 :

In worst case, you can try implementing fullScreenContentCallback. But as per the documentation it doesn't provide any click callbacks.

Swaminathan V
  • 4,663
  • 2
  • 22
  • 32
  • Monitoring `onPause` is not feasible too, as it doesn't guarantee that the user actually clicked on the ad and then the app went in the background, it could be, user intentionally minimized the app and that also would be registered as an ad click. Frequency capping seems like the only option, as mentioned by @Daxesh Vekaria – Praveen Jul 23 '21 at 11:44