Getting Started

1. Installation

For a fresh installation

  1. Download the WebEngageUnityAndroid.unitypackage
  2. Import the downloaded unitypackage into your Unity project through Assets > Import Package > Custom Package....
  3. Replace the AAR file at Assets/Plugins/Android/webengage-android-unity-X.X.X.aar with the latest webengage-android-unity.aar.

Updating the native WebEngage SDK within the Unity wrapper

Replace the AAR file at Assets/Plugins/Android/webengage-android-unity-X.X.X.aar with the latest webengage-android-unity.aar.

2. Initialization

  1. Add the following meta-data tags in Assets/Plugins/Android/AndroidManifest.xml file of your Unity project.
<?xml version="1.0" encoding="utf-8"?>
<manifest
    ...>

    <application
    	...>

	    <meta-data android:name="com.webengage.sdk.android.key" android:value="YOUR-WEBENGAGE-LICENSE-CODE" />

	    <!-- true if development build else false -->
	    <meta-data android:name="com.webengage.sdk.android.debug" android:value="true" />

	    ...
	</application>
</manifest>

If AndroidManifest.xml file does not exist in Assets/Plugins/Android/ directory of your Unity project, then you can create a new AndroidManifest.xml file and copy the below content in it.

<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <application
        android:label="@string/app_name"
        android:icon="@drawable/app_icon">

        <meta-data android:name="com.webengage.sdk.android.key" android:value="YOUR-WEBENGAGE-LICENSE-CODE" />

        <meta-data android:name="com.webengage.sdk.android.debug" android:value="true" />

        <activity
            android:name="com.unity3d.player.UnityPlayerActivity"
            android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">

            <intent-filter>

                <action
                    android:name="android.intent.action.MAIN" />

                <category
                    android:name="android.intent.category.LAUNCHER" />

                <category
                    android:name="android.intent.category.LEANBACK_LAUNCHER" />
            </intent-filter>

            <meta-data
                android:name="unityplayer.UnityActivity"
                android:value="true" />
        </activity>
    </application>
</manifest>

Make sure you replace YOUR_WEBENGAGE_LICENSE_CODE with your WebEngage license code. As shown below, naviagte to the Account Setup section to find your license code.

1438

Locating your WebEngage license code

  1. Initialize the WebEngage SDK at start of your application.
using WebEngageBridge;
...

public class YourScript : MonoBehaviour
{
    private void Awake()
    {
        WebEngage.Engage();
        ...
    }
    ...
}

3. Attribution Tracking

Add the following receiver tag in the Assets/Plugins/Android/AndroidManifest.xml file for tracking app installs and user-acquisition attribute details.

<?xml version="1.0" encoding="utf-8"?>
<manifest
    ...>

    <application
        ...>

        ...

        <receiver
          android:name="com.webengage.sdk.android.InstallTracker"
          android:exported="true">
          <intent-filter>
             <action android:name="com.android.vending.INSTALL_REFERRER" />
          </intent-filter>
        </receiver>

        ...
    </application>
</manifest>

So, what's next?