Getting started

This documentation will go through all the steps required to display Ogury ads on your Android and iOS games built using Unity.

Step 1: Register your applications

In case you publish your application on both Android and iOS, you should do the following steps twice, once for the Android application and once for the iOS application. Otherwise just select the platform you publishes for.

  • Go to your Dashboard and register your application.

  • Copy the Asset Key from the Asset details, as shown in the screenshot below:

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:

  • the Asset Key of the Android application by using the string ANDROID_ASSET_KEY.

  • the Asset Key of the iOS application by using the string IOS_ASSET_KEY.

Step 2: Import the Ogury Unity plugin

To import the latest version of the Ogury Unity plugin into your project, Ogury provides an Unity Package.

Import the Unity Package

  • If you are upgrading it, delete the OgurySdk folder in your project Assets folder before following next steps.

  • Import the Unity Package into your project

    • Open your Unity Project.

    • Choose Assets > Import Package > Custom Package.

    • In the file explorer, select the package you have downloaded. The Import Unity Package dialog box appears, with all the items in the package checked.

    • Click on Import . The package content is added to the Assets folder

The Ogury Unity plugin uses External Dependency Manager for Unity to download some dependencies. You can use the version already imported in your project and ignore the PlayServicesResolver folder during import in case of conflict.

If you are building for iOS with XCode 12+, please make sure you have CocoaPods 1.10 or above to avoid build errors due to the migration of our SDK to XCFramework.

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

Import Ogury SDK namespace into your scripts

  • Import the OgurySdk namespace at the beginning of every script where you interacts with the Ogury SDK.

using OgurySdk;

Step 3: Import the Ogury Android and iOS SDKs

The Ogury Unity plugin depends on the Ogury Android and iOS SDKs, so they have to be integrated into your Unity Project. However, if you are using Ogury as ad network in your mediation, the Ogury SDKs are probably already integrated in your project, so you must skip this step.

To import Ogury Android and iOS SDKs from the Ogury repositories, create an OgurySdkDependencies.xml file in Assets/Editor directory with the following content:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<dependencies>
<androidPackages>
<androidPackage spec="co.ogury:ogury-sdk:5.+">
<repositories>
<repository>https://maven.ogury.co</repository>
</repositories>
</androidPackage>
</androidPackages>
<iosPods>
<iosPod name="OguryAds" version=">= 2.3.5"></iosPod>
<iosPod name="OguryChoiceManager" version=">= 3.1.8"/>
</iosPods>
</dependencies>

This default configuration allows you to import the latest version of Android and iOS SDKs. However, even if it recommended to use the latest versions, you can also choose specific ones.

For example, you could replace 5.+, >= 2.3.5 and >= 3.1.8 by 5.0.6, 2.3.5 and 3.1.8. In this case, please check the release notes for the compatibility between the Unity plugin and the chosen versions.

To know more about the latest release of the Ogury SDKs, you can check the Android release notes and iOS release notes.

Step 4: Create OguryCallbacks game object

In the first scene of your application:

  • Right-click in the Hierarchy panel and click on Create Empty option.

  • Select the new GameObject.

  • In the Inspector panel:

    • Rename it to OguryCallbacks.

    • Click on Add Component button and search for Ogury Callbacks script.

Step 5: Initialize Ogury SDK

Before calling any method of the Ogury SDK, you must configure the Asset Key as following:

Ogury.Start("ANDROID_ASSET_KEY", "IOS_ASSET_KEY");

The Start method takes the following parameter:

  • the Asset Key of your application for the Android platform. You can use null if your application is not available on Android.

  • the Asset Key of your application for the iOS platform. You can use null if your application is not available on iOS.

If you do not have any Asset Key yet, you can refer to the first step to create them.

Step 6: 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.

Initialize Ogury Ads

The StartAds method will initialize Ogury Ads:

Ogury.StartAds();

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

Step 7: Integrate Ogury ad formats

Congratulations, the Ogury SDK is now initialized! You are now ready to integrate your first ad. Ogury provides three 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.