Annex

  1. Overview of all VisxEvents
  2. Predefined AdSizes
  3. Setting Keyword Targeting
  4. Setting Advertising Label (Banner only)

Overview of all VisxEvents

The following VisxEvents can be listened to using the onEvent method. You can use them for adding logic from your app between an ad call, ad rendering and disposal. VisxEvents are derived from the VisxAdViewDelegate of the original VIS.X® SDK for iOS. Further information can be found here.

public enum VisxEvents: String {
    // The SDK has initiated an ad request to the VIS.X® Platform
    case visxAdRequestStarted
    // The SDK has received an ad response from the VIS.X® Platform
    case visxAdResponseReceived
    // The VisxView is now ready
    case visxAdViewDidInitialize
    // Ad creative has requested a size change for VisxView with new a width and height
    case visxAdViewSizeChange
    // Ad creative has changed its ad format type, e.g. from banner to YOC Understitial Ad®
    case visxAdViewEffectChange
    // Creative will open landing page in browser
    case visxLandingPageOpened
    // VisxView has been closed, ad placement may be closed
    case visxAdViewClosed
    // Creative has been clicked
    case visxAdViewClicked
    // Video creative has finished playing a video
    case visxAdVideoFinished
    // Interstitial is about to be closed
    case visxAdInterstitialWillBeClosed
    // Interstitial has been closed
    case visxAdInterstitialClosed
    // Requesting, retrieving or rendering of an ad has failed
    case visxAdFailedWithError
    // Interaction with banner creative is drawing focus from the app
    case appShouldSuspendForAd
    // Banner creative has opened a Modal View, which has been closed
    case appShouldResumeFromAd
    // VisxView has been closed and is deallocated
    case visxAdViewDeallocated
	}

Predefined AdSizes

VisxAdSize in the VIS.X® SDK is defined as a group of CGSize (width, height) and VisxPlacementType, which can be either VisxPlacementType.inline for banner or VisxPlacementType.interstitial for interstitials.

let myAdSize = VisxAdSize(adSize: CGSize(width: 300, height: 50), 
                            type: VisxPlacementType.inline);

The following pre-configured VisxAdSize instances cover regular IAB banners and interstitials. Just call e.g. kSmartphoneBanner300x50 from your init.

Constant VisxPlacementType Size
kSmartphoneBanner300x50 inline 300x50
kSmartphoneBanner300x75 inline 300x75
kSmartphoneBanner300x150 inline 300x150
kSmartphoneBanner320x50 inline 320x50
kBillboard970x250 inline 970x250
kLeaderboard728x90 inline 728x90
kPushdown970x90 inline 970x90
kHalfpage300x600 inline 300x600
kPortrait300x1050 inline 300x1050
kSkyscraper160x600 inline 160x600
kUnderstitial320x480 inline 320x480
kUnderstitial300x600 inline 300x600
kMediumRectangle300x150 inline 300x150
kMediumRectangle300x250 inline 300x250
kUnderstitial300x250 inline 300x250
kInterstitial1x1 interstitial 1x1
kInterstitial320x480 interstitial 320x480
kInterstitial300x600 interstitial 300x600

Setting Keyword Targeting

The VIS.X® SDK for SwiftUI 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.

To utilize the feature, add the loadWithCustomTargetingParameters: ["key": "value", ..] parameter to your init method.

let visxView = VisxView(adUnitId: "123456",
                        domain: "domain-of-your-app-ads-txt.com",
                        size: .kMediumRectangle300x250,
                        universal: true,
                        loadWithCustomTargetingParameters: ["age": "40", "gender": "male"])

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 of [\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 the key is pushed again

Setting Advertisement Label (Banner only)

The EU Directive 2000/31/EC declares “[..] commercial communication shall be identified as such”. Non-EU countries may also require similar identifiability of advertising. Advertising should be labeled and visually separated from editorial content. You can use the advertisingLabelText in your init method to apply a label on top of the creative, in all cases YOC is delivering an ad. The String could be either plain text, e.g. "Advertisement"; or escaped HTML, e.g. "<span style=\"font-size:12px\">Werbung</span>".

let visxView = VisxView(adUnitId: "123456",
                        domain: "domain-of-you-app-ads-txt.com",
                        size: .kMediumRectangle300x250,
                        universal: true,
                        advertisingLabelText: "Advertisement")