Skip to end of metadata
Go to start of metadata

Click-Through URL

The term click-through refers to the capability of the AppNexus Mobile SDK to handle what happens when the user clicks on an ad. This document describes how click-through works and provides examples on how to implement this feature for Android and iOS.

On This Page

Overview

AppNexus Mobile SDK allows you to determine how the value of the click_url string in the bid response will be handled when the user clicks on an ad. There are three possibilities:

  • Open the click-through URL in the SDK browser.
  • Open the click-through URL in the external device browser.
  • Return the URL to the calling environment without opening any browser.

Cases that open a browser will notify the caller via onAdClicked in Android and adWasClicked:withURL: in iOS.

In the case of a native ad request:

  • Two URLs are returned: click_url and click_url_fallback.
    It is assumed that the caller will handle click-through URL(s) appropriately by displaying their contents to the user.  The click_url_fallback, if defined, is used only if click_url cannot be resolved, for whatever reason, by the browser display system.
  • The listener/delegate callback method is: onAdWasClicked(clickUrl, fallbackURL) for Android; adWasClickedWithURL:fallbackURL: for iOS.

Mobile SDK Structure

Android

  • For Banner, Interstitial and Video: AdListener defines the method onAdClicked(adView, clickUrl).
  • For Native, AdListener defines the method onAdWasClicked(clickUrl, fallbackURL).

iOS

  • For Banner, Interstitial and Video, ANAdProtocol defines a delegate method, adWasClicked:withURL:
  • For Native, ANNativeAdDelegate defines a delegate method, adWasClickedWithURL:fallbackURL:.

Examples of Use

Android

If you do not want to fetch ClickURL, you still need to implement a method onAdClicked that returns clickURL, but it can be left empty. 

If you do want to fetch ClickURL, you can use the following code example to get started:

Then add onAdClicked to get clickURL.

iOS

If you do not want to fetch ClickURL, there is no need to implement the method adWasClicked:withURL: that returns clickURL.

If you do want to fetch ClickURL, you can use the following code example to get started:

Then add adWasClicked:withURL: to get urlString.

  • No labels