Annex

  1. Overview of all VisxCallbacks
  2. Setting Keyword Targeting
  3. Setting Advertising Label (Banner only)
  4. Disable Resizing (Banner only)
  5. Header Bidding, Lazy Loading
Overview of all VisxCallbacks

The following VisxCallbacks are available for both banner and interstitial placements You can use them for adding logic from your app between an ad call, ad rendering and disposal.

VisxCallbacks Description
onAdRequestStarted Called when the process of requesting the ad has started.
onAdResponseReceived Called when the ad has been fully retrieved from the server.
onAdLoadingFinished Called when loading the ad has finished. The message contains the ad data.
onAdLoadingFailed Called when an error occurred in the process of loading and displaying the ad. Please note that this method may be called several times while trying to display an ad. Use the given arguments to determine when the process has finished permanently and you may e.g. hide the corresponding ad space.
onAdSizeChanged Called when ad size has been changed, with the new width and height in density independent pixel.
onAdClicked The ad has been clicked.
onAdLeftApplication The user left the application, due to interaction with the ad.
onAdResumeApplication The ad has drawn focus from the app (e.g. by opening an overlay), which has now be forfeited allowing the app to resume.
onVideoFinished The video ad has been played and is finished.
onEffectChange The ad is about to activate an effect, e.g. YOC Understitial®, or YOC Mystery Scroller®.
onAdViewable The ad is counted as viewable.
onInterstitialWillBeClosed The interstitial is about to be closed.
onInterstitialClosed The interstitial has been closed successfully.
onAdClosed The banner ad has been closed or dismissed, the adContainer can be recycled or dimissed.
onLandingPageOpened Called when a landing page has been opened in an internal view or when a landing page is about to be opened in an external browser. Usually this action is triggered when the user has clicked the creative.
onLandingPageClosed Called when an internal landing page view has been dismissed by the user. Note that this callback method will not be invoked for landing pages that have been opened in an external browser.
var visxCallback = VisxCallbacks() {
	override fun onAdRequestStarted(visxAdManager: VisxAdManager?) {
		Log.i("onAdRequestStarted()")
	}

	override fun onAdResponseReceived(visxAdManager: VisxAdManager, price: Double, currency: String) {
		Log.i("onAdResponseReceived()")
	}

	override fun onAdLoadingStarted(visxAdManager: VisxAdManager?) {
		Log.i("onAdLoadingStarted()")
	}

	override fun onAdLoadingFinished(visxAdManager: VisxAdManager?, message: String?) {
		Log.i("onAdLoadingFinished() $message")
		Log.i("Ad is ready to be displayed")
	}

	override fun onAdLoadingFailed(message: String?, errorCode: Int, isFinal: Boolean) {
		Log.i("onAdLoadingFailed() $message errorCode: $errorCode")
	}

	override fun onAdSizeChanged(width: Int, height: Int) {
		Log.i("onAdSizeChanged()")
	}

	override fun onAdClicked() {
		Log.i("onAdClicked()")
	}

	override fun onAdLeftApplication() {
		Log.i("onAdLeftApplication()")
	}

	override fun onAdResumeApplication() {
		Log.i("onAdResumeApplication()")
	}

	override fun onVideoFinished() {
		Log.i("onVideoFinished()")
	}

	override fun onEffectChange(effect: String?) {
		Log.i("onEffectChange() -> effect: $effect")
	}

	override fun onLandingPageOpened(inExternalBrowser: Boolean) {
		Log.i("onLandingPageOpened. inExternalBrowser = $inExternalBrowser")
	}

	override fun onLandingPageClosed() {
		Log.i("onLandingPageClosed()")
	}

	override fun onInterstitialWillBeClosed() {
		Log.i("onInterstitialWillBeClosed()")
	}

	override fun onInterstitialClosed() {
		Log.i("onInterstitialClosed()")
	}

	override fun onAdClosed() {
		Log.i("onAdClosed()")
	}
}
Setting Keyword Targeting

The VIS.X® SDK allows setting individual key-value targeting for placements. This can be useful, among other things, if contextually different blocklists or floor prices are used for one ad unit (e.g., channel targeting).

For these targetings to be effective, an individual agreement with the account manager is necessary so that they can also be implemented on the YOC backend configuration.

Key-values are structured as a HashMap<String, String>. The first parameter represents the key, and the second parameter is the value. You can send the key values using the .customTargetParams() from the Builder of VisxAdManager.

var customTargetingParams = HashMap<String, String>()
customTargetingParams.put("age","20-30,30-50")
customTargetingParams.put("sport-cars","Porsche,Audi")
customTargetingParams.put("channel","Finance")
Builder Methods (optional) Description
.customTargetParams(params) .customTargetParams() Key values are structured as a HashMap<String, String>

The following constraints apply when using custom key-value targeting:

For Keys:

  • Keys must consist of [\w_-\d] Unicode word characters, incl. [0-9_-]
  • Up to 5 keys are accepted in a single ad call
  • Keys are OR combined
  • Keys must have at least one value. Pure key targeting is not accepted
  • Keys must not use breakable and non-breakable spaces

For Values:

  • Values must consist [\w_-\d] Unicode word characters, incl. [0-9_-]
  • Multiple values are accepted, they need to be comma-separated
  • Values are OR combined
  • Values must not use breakable and non-breakable spaces
  • Values associated with a key will be overridden if a key is pushed again
Setting Advertisement Label (Banner only)

The EU Directive 2000/31/EC declares “[..] commercial communication shall be identifiable as such”. Non-EU countries may also require similar identifiability of advertising. Advertising should be labeled and visually separated from editorial content. The VIS.X® SDK offers the setup of an Advertising Label above all our creatives, using the .setAdvertisingLabel() from the Builder of VisxAdManager.

Builder Methods (optional) Description
.setAdvertisingLabel(String) The String could be either plain text, e.g. "Advertisement"; or escaped html, e.g. "<span style=\"font-size:12px\">Werbung</span>".
Disable Resizing (Banner only)

To play high-impact ad formats from YOC, VIS.X ad units must be able to adjust the size of the adContainer by default. However, there are positions in the app where this is simply not possible. In this case, the resizing can be restricted with the Builder Method .fixedSize(). As it will heavily affect monetization, it is advised to use .fixedSize() only if needed and report usage to your YOC account manager, to remove high-impact ads for that ad unit.

Builder Methods (optional) Description
.fixedSize() Resizing of the adContainer will be restictred to the Size provided in .adSize()
Header Bidding, Lazy Loading

The default life cycle of ads in the SDK is split into two steps:

  1. The app requests an ad, VIS.X® will respond with an ad and prepare the ad to be displayed, by creating a WebView immediately
  2. The app will listen to onAdLoadingFinished, pick up the VisxAdView and add it as a SubView into the ViewHierachy

This workflow is based on the assumption that the publisher asks for an ad whenever they need one. However, there are also scenarios where the app wants to ask an ad, but not necessarily render them, e.g. in a header bidding scenario or when prefetching ads is performed to increase the overall speed of the app.

For this kind of scenario, the VIS.X® SDK can split the delivery into three steps:

  1. The app requests an ad, VIS.X® will respond with an ad and call onAdResponseReceived with a Price and a CurrencyThe app decides to initiate the render process by calling renderAd method, initiating the WebView
  2. The app will listen to onAdLoadingFinished, pick up the VisxAdView and add it as a SubView into the ViewHierachy

To enable this feature use the builder method headerBidding in your ad request.

Builder Methods (optional) Description
.headerBidding() When ad from VIS.X® is received, onAdResponseReceived is called and pauses the rendering until renderAd is called.
override fun onAdResponseReceived(visxAdManager: VisxAdManager, price: Double, currency: String) {
	// ad is received and ready to be rendered as a webView
	visxAdManager.renderAd()
	// when the ad is finally rendered onAdLoadingFinished is called
}