Getting started

This documentation will go through all the steps required to display Ogury ads on iOS platform.

We recommend you to check our migration guide to prepare for the upcoming release of iOS 14.

Step 1: Register your application

The Asset Key follows the pattern: OGY-XXXXXXXXXXXX, where X is an uppercase letter or digit. In all the following code samples, we will refer to this Asset Key by using the string ASSET_KEY.

Step 2: Import the Ogury SDK

To import the latest version of the Ogury SDK into your project, Ogury provides two methods:

  • Automated integration using Ogury's CocoaPods repository (recommended).

  • Manual integration of the Ogury SDK.

CocoaPods
Manual integration
CocoaPods

Configure your Podfile

Open the podfile of your application and add the following lines into your target:

pod 'OguryAds'
pod 'OguryChoiceManager'

If you are using Xcode 12+, please use CocoaPods 1.10+ to avoid build errors due to the migration of our SDK to XCFramework.

To know more about the latest release of the Ogury SDK, you can check the release notes.

Manual integration

Download the Ogury SDK

Configure your IDE

Drag the following Frameworks into your Xcode project:

  • OguryAds.framework

  • OguryChoiceManager.framework

  • OMSDK_Oguryco.framework

Check if the frameworks are added to Linked Frameworks and Libraries on Target properties under General Tab of your project

To know more about the latest release of the Ogury SDK, you can check the release notes.

Step 3: Configure your application

In your project Build Settings, do the following changes:

  • add the -ObjC flag to Other Linker Flags.

Step 4: Collect the user consent and initialize Ogury Ads

The European GDPR regulation requires obtaining the users' consent in order to display them personalized ads, (i) when the company processing personal data is based in the EU, or (ii) when the users are EU citizens.

As a company based in the EU, Ogury accordingly requires an explicit consent from the users to collect their personal data and display them personalized ads. The consent collection can be operated:

Note that the Ogury SDK meets privacy requirements by design. Shall it not receive a valid consent status from the Ogury Choice Manager or from a validated third-party consent solution, it will display an End User License Agreement (EULA) before serving the first ad. Another way to put it: no targeted ad will be displayed to the users if they didn't give their consent first.

In order to integrate the Ogury Choice Manager, you must (i) first collect the user consent and (ii) then initialize Ogury Ads with the setup method.

Initialize Ogury Ads

The setup method will initialize Ogury Ads:

Swift
Objective-C
Swift
OguryAds.shared().setup(withAssetKey: "ASSET_KEY")
Objective-C
[[OguryAds shared] setupWithAssetKey:@"ASSET_KEY"];

The setup method takes the following parameter:

  • the Asset Key of your application. If you do not have one yet, you can refer to the first step to create it.

A complete integration example with consent collection is available within Ogury Choice Manager section.

Step 5: Integrate our ad formats

Congratulations, the Ogury SDK is now initialized! You are now ready to integrate your first ad. Ogury provides four different ad formats, (i) Interstitial Ads, (ii) Opt-in Video Ads, (iii) Banner Ads, and (iv) Thumbnail Ads. You can refer to the following sections to proceed with the integration:

We suggest you setup a test device before you start integrating so that the device configuration has time to propagate while you perform your integration.

Before going live

Ogury is part of the IAB Authorized Sellers for Apps initiative to fight inventory fraud for applications. It is recommended to update your app-ads.txt to include Ogury as described in the app-ads.txt section.

Advanced topics

Initialize Ogury Ads with completion block

Setup method with completion block :

Swift
Objective C
Swift
OguryAds.shared()?.setup(withAssetKey: "ASSET_KEY", andCompletionHandler: { (error) in
if error == nil {
print("Ogury Setup with success")
} else {
print("Setup failed with error : \(error.debugDescription)")
}
})
Objective C
[[OguryAds shared] setupWithAssetKey:@"ASSET_KEY" andCompletionHandler:^(NSError *error) {
if (error != nil){
NSLog(@"Ogury Setup with success");
} else {
NSLog(@"Setup failed with error : %li",(long)error.code);
}
}];

The setup method takes the following parameter:

  • assetKey: the Asset Key of your application. If you do not have one yet, you can refer to the first step to create it.

  • completionHandler: the completion block called when the setup is finished. error parameter is nil if the operation was successful. Learn more about setup error handling.

Setup error handling

If the Ogury SDK fails to initialize for any reason during a setup, the completion block provides an error parameter. This parameter contains the cause of the failure.‌

To get this cause, you can call the following method:

error.code

The error can be one of the following:

Message

Value

Definition

OguryAdsSetupErrorNoInternetConnection

0

The device has no Internet connection. Try again when the device is connected to Internet again.

OguryAdsSetupErrorAlreadyLoading

1

Another setup call is already in progress

OguryAdsSetupErrorSetupFailed

2

Setup failed for an unknown reason please try again

OguryAdsSetupErrorBundleNotMatching

3

The application bundle not matching the bundle provided to Ogury when the asset was configured.