Installation of the Unity SDK

This SDK supports Unity versions no older than 5.4.0. iOS minimum version support is 8.0 and Android minimum version support is API level 11.

Please download our latest SDK.

1. Installation

Download the SDK, and import the TapdaqUnity.unitypackage into your project. To do this, select Assets > Import Package > Custom Package..

Select the network adapter packages that you want to use in your project, only the base project is included in the TapdaqUnity.unitypackage

2. Authenticate with Tapdaq

To add in your iOS and Android App ID and Client Key, simply go to Window > Tapdaq > Edit Settings.

Window>Tapdaq>Edit Settings

A panel will appear in your editor prompting you to enter your Tapdaq App ID and Client Key (these can be found when logging in to the Tapdaq Dashboard under Settings > General).

Settings Panel

Note: If your app supports iOS and Android, you will need to create two separate apps on the Tapdaq dashboard.

3. Initialise Tapdaq

Create a script and add it to a GameObject in your scene.

NOTE: We recommend your script extends MonoBehaviour class type. If you choose otherwise, ensure that all methods are called as Start, OnEnable, OnDisable and OnApplicationPause all override MonoBehaviour methods - therefore these will not be called

To initialise Tapdaq, simply put one of the following Init methods in the Start() function:

private void Start() {
  AdManager.Init(); //Unknown User.
  //OR
  AdManager.InitWithConsent (TDStatus.TRUE, TDStatus.FALSE, TDStatus.UNKNOWN);//IsUserSubjectToGDPR, UserConsent, isAgeRestrictedUser
}

NOTE: Consent must be acquired from EU users for networks to display personalised ads. Where it is unknown that a user is from the EU or consent has not been set to true, consent data will not be sent to ad networks

Callbacks are also available for notifications when Tapdaq has been initialise or failed to initialise. Add them like so:

private void OnEnable () {
	TDCallbacks.TapdaqConfigLoaded += OnTapdaqConfigLoaded;
	TDCallbacks.TapdaqConfigFailedToLoad += OnTapdaqConfigFailToLoad;
}

private void OnDisable () {
	TDCallbacks.TapdaqConfigLoaded -= OnTapdaqConfigLoaded;
	TDCallbacks.TapdaqConfigFailedToLoad -= OnTapdaqConfigFailToLoad;
}

private void OnTapdaqConfigLoaded() {
	//Tapdaq Ready to use
}

private void OnTapdaqConfigFailToLoad(TDAdError error) {
	//Tapdaq failed to initialise
}

Make sure you are using the Tapdaq namespace in your project:

using Tapdaq;

4. Update GDPR consent

Consent can be updated mid session as well as at initialisation, it can be set and unset.

AdManager.SetUserSubjectToGDPR (TDStatus.TRUE);
AdManager.SetConsentGiven (true);
AdManager.SetIsAgeRestrictedUser (true);

5. Lifecycle methods

Within each of your scenes, your script must override a MonoBehaviour method OnApplicationPause to report lifecycle events to Android ad network adapters.

void OnApplicationPause(bool pauseStatus)
{
    AdManager.OnApplicationPause (pauseStatus);
}

Note: This is only required for Android Receptiv Adapter. For iOS only applications this is not required

6. Display an advert

To display an advert, please click on one of the following guides.

You can test that each ad network has been integrated correctly by visiting the Debugging page.

7. iOS specific steps

Please add the following entries in Target -> Info -> Custom iOS Target Properties. These steps are required when submitting your app to the App Store.

A. App Transport Security

App Transport Security (ATS), introduced in iOS 9, improves user security and privacy by requiring apps to use secure network connections over HTTPS. However, some ad network adapters still use insecure network connections in their ad serving. As such, please follow the steps below to ensure your app passes Apple’s review process:

App Transport Security Settings: Set the type to Dictionary and add the "Allow Arbitrary Loads" key as a 'Boolean' type and set the value to 'YES'

B. AdMob specific steps

When including AdMob to your project, you must set the following additional App Transport Security settings:

NSAllowsArbitraryLoadsForMedia: Set the type to Boolean and set the value to YES

NSAllowsArbitraryLoadsInWebContent: Set the type to Boolean and set the value to YES

C. AdColony specific steps

When including AdColony to your project, you must set the following three entries in order to submit your app to Apple:

NSCalendarsUsageDescription: Set the type to String and set the value to the following Adding events.

NSPhotoLibraryUsageDescription: Set the type to String and set the value to the following Taking selfies.

NSMotionUsageDescription: Set the type to String and set the value to the following Interactive ad controls.

D. Known Issues

When building iOS projects to Unity, frameworks may not be imported correctly, after selecting "Switch Platform" to iOS, select the Unity Editor window to allow our script to run, then go back and Select Build.

8. Android specific steps

A. Play Services 17+

If using Play Services 17 (or higher), this will be required in your AndroidManfiest.xml

 <meta-data
            android:name="com.google.android.gms.ads.AD_MANAGER_APP"
            android:value="true"/>

B. AndroidManifest.xml & R.txt conflicts

When using FAN & YouAppi SDK's together, a conflict may arise if building with gradle between two unused files in each SDK, to resolve the issue, add these exclusion rules to you mainTemplate.gradle file:

android {
    packagingOptions {
        exclude 'AndroidManifest.xml'
	exclude 'R.txt'
    }
}

Need help?

If you are having any problems integrating, feel free to contact us on [email protected] and we will be more than happy to help.