Skip to content

CleverTap/clevertap-unity-sdk

Repository files navigation

CleverTap Unity Plugin

codebeat badge

👋 Introduction

The CleverTap Unity Plugin for Mobile Customer Engagement and Analytics solutions.

For more information check out our website and documentation.

To get started, sign up here.

🛠 Installation and Setup

You can install the CleverTap Unity SDK using the .unitypackage Unity package or as a local package through Unity Package Manager (UPM).

Import the CleverTap Unity Package

  1. Download the latest version of the CleverTap Unity package. Import the .unitypackage into your Unity Project. Go to Assets > Import Package > Custom Package.
  2. Add the PlayServiceResolver and the ExternalDependencyManager folders. These folders will install the EDM4U plugin, which automatically adds all the Android and iOS dependencies when building your project.
  3. Ensure that the scripts inside the Editor folder are added (AndroidPostImport, CleverTapPostBuildProcessor. and the other scripts). The AndroidPostImport script sets up clevertap-android-wrapper library for Android. CleverTapPostBuildProcessor helps iOS setup.

Import the CleverTap Unity Package as a Local Dependency

Clone the latest release version of CleverTap Unity SDK. The SDK can be imported as a local package through the Unity Package Manager.

Set Up the Unity SDK

CleverTap API can be accessed anywhere in your project by simply calling the static CleverTap class. No need to create GameObject or attach any script. The SDK handles the following:

  • Instantiation of platform-specific binding (iOS, Android, Native)
  • Creation of GameObject
  • Script attachment.

You can view your CleverTap Account ID and CleverTap Account Token from the CleverTap Dashboard -> Settings.

// Initialize CleverTap
CleverTap.LaunchWithCredentialsForRegion({YOUR_CLEVERTAP_ACCOUNT_ID}, {YOUR_CLEVERTAP_ACCOUNT_TOKEN}, {CLEVERTAP_ACCOUNT_REGION});
// Enable personalization
CleverTap.EnablePersonalization();

Callbacks

Add an event listener for a callback directly through the CleverTap static events.

CleverTap.OnCleverTapDeepLinkCallback += YOUR_CALLBACK_METHOD;  
CleverTap.OnCleverTapProfileInitializedCallback += YOUR_CALLBACK_METHOD;  
CleverTap.OnCleverTapProfileUpdatesCallback += YOUR_CALLBACK_METHOD;

iOS Instructions

iOS specific setup is described in the iOS Instructions

Android Instructions

Android specific setup is described in the Android Instructions

WebGL Instructions

WebGL specific setup is described in the WebGL Instructions

💻 Example Usage

🆕 Changelog

Check out the CleverTap Unity plugin SDK Change Log here.

⁉️ Questions?

If you have questions or concerns, you can reach out to the CleverTap support team from the CleverTap Dashboard.

TroubleShooting Guide: Please refer here if you are facing common integration issue.