This guide outlines the steps to migrate your app from Ogury SDK v4 to v5. The update introduces significant enhancements, including the removal of deprecated methods, a simplified initialization process, and improved ad format handling and privacy management.
Follow this guide to ensure a smooth transition, with clear comparisons between the legacy v4 API and the new v5 API, along with practical code examples.
Initialize the Ogury SDK
The latest version of the Ogury SDK introduces several key updates to streamline the initialization process.
API changes
The start() method now accepts two parameters:
the asset key as a String
an optional StartCompletionBlock for handling success or failure.
The OguryConfiguration and OguryConfigurationBuilder classes have been removed, and the asset key is passed directly.
The OguryStartErrorCode class offers predefined error codes for managing initialization.
Mediation details (name and version) are no longer passed at initialization but are set at the ad format level.
For more information on initializing the Ogury SDK, please refer to the Getting Started page.
Legacy API (v4) example
let configuration =OguryConfigurationBuilder(assetKey:"OGY-XXXXXXXXXXXX").build()Ogury.start(with: configuration)
The interstitialAd:didFailWithError:callback now returns an OguryAdError object instead of the previous OguryError. This object includes:
type: OguryAdErrorType.Load or OguryAdErrorType.Show.
code: Listed in OguryLoadErrorCode and OguryShowErrorCode.
localizedDescription: A description of the error.
For more information on integrating Interstitial ads, please refer to the Interstitial page.
Rewarded Ad (formerly Opt-in Video Ad)
API changes
The OguryOptinVideoAd,OguryOptinVideoAdDelegate and OGARewardItem classes have been renamed to OguryRewardedAd, OguryRewardedAdDelegate and OguryReward respectively.
The userId property has been removed.
The didDisplayOguryOptinVideoAd callback has been removed.
The rewardedAd:didFailWithError:callback now returns an OguryAdError object instead of the previous OguryError. This object includes:
type: OguryAdErrorType.Load or OguryAdErrorType.Show.
code: Listed in OguryLoadErrorCode and OguryShowErrorCode.
localizedDescription: A description of the error.
For more information on integrating Interstitial ads, please refer to the Rewarded page.
Small Banner / MREC (formerly MPU)
API changes
The OguryBannerAd and OguryBannerAdDelegate have been renamed to OguryBannerAdView and OguryBannerAdViewDelegate respectively to reflect that it is actually a UIView subclass.
The initializer for OguryBannerAdView now requires both the ad unit ID and the size, which can be either OguryBannerAdSize.small_banner_320x50() or OguryBannerAdSize.mrec_300x250().
The load(with: OguryBannerAdSize) method has been replaced by load().
The didDisplayOguryBannerAd callback has been removed.
The thumbnailAd:didFailWithError:callback now returns an OguryAdError object instead of the previous OguryError. This object includes:
type: OguryAdErrorType.Load or OguryAdErrorType.Show.
code: Listed in OguryLoadErrorCode and OguryShowErrorCode.
localizedDescription: A description of the error.
For more information on integrating Thumbnail ads, please refer to the Thumbnail page.
Privacy
All deprecated APIs related to the Ogury Choice Manager have been removed.
If you are using a Consent Management Platform (CMP) that complies with the IAB Transparency & Consent Framework (TCF) v2 or the IAB Global Privacy Platform GPP, consent is automatically collected, requiring no additional action on your part.
For users in the United States, Ogury SDK offers an opt-out option using the following boolean:
Ogury.setPrivacyData("us_optout", boolean:true)// To opt out
[Ogury setPrivacyData:@"us_optout" boolean:YES]; // To opt out
If you are mediation and need to pass this opt-out boolean to Ogury, use:
Ogury.setPrivacyData("us_optout_partner", boolean:true)// To opt out
[Ogury setPrivacyData:@"us_optout_partner" boolean:YES]; // To opt out
For more information about privacy, please refer to the Privacy compliance page.
Mediation
The version 5 introduces some changes to the mediation adapter APIs.
The OguryTokenService class has been renamed to OguryBidTokenService, and the method synchronous method getBidderToken is now is an asynchronous bidToken method that allows us to manage initialization and consent synchronization issues.
This updated method now requires a BidTokenCompletionBlock, which provides the bid token or returns an OguryError if the token cannot be generated.