Unity.iOS

This Unity Package is only for iOS and will not work on any other platform

1. Installation

For a fresh Installation

Step 1: Download the WebEngageUnityiOS.unitypackage

Step 2: Import the downloaded unitypackage into your Unity project through Assets > Import Package > Custom Package....

Step 3: Replace the framework file at Assets/Plugins/iOS/WebEngage.framework with the latest WebEngage framework. Unzip the downloaded zip file to get the framework.

Updating the native WebEngage SDK within the Unity wrapper

Replace the framework file at Assets/Plugins/iOS/WebEngage.framework with the latest WebEngage framework. Unzip the downloaded zip file to get the framework.

2. Initialization

Step 1: Add the following values in /Assets/Editor/WebEngagePostProcessBuild.cs file.

...

public class WebEngagePostProcessBuild
{
   [PostProcessBuild]
   public static void EditXcodePlist(BuildTarget buildTarget, string pathToBuiltProject)
   {
       if (buildTarget == BuildTarget.iOS)
       {
       	// Add your WebEngage license code
       	string WEBENGAGE_LICENSE_CODE = "YOUR-WEBENGAGE-LICENSE-CODE";

       	// Set debug log level
           string logLevel = "VERBOSE";
       	...
       }
   }
}

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.

Locating license code in your WebEngage account

Locating license code in your WebEngage account

Step 2: Initialize the WebEngage SDK in your AppDelegate.m class.

#import <WebEngage/WebEngage.h>
...

-(BOOL)application:(UIApplication*) application didFinishLaunchingWithOptions:(NSDictionary*) options
{
    [[WebEngage sharedInstance] application:application didFinishLaunchingWithOptions:options];
    
    ...
}

If you are not already implementing AppDelegate.m in your Unity app, then create a new file at /Assets/Plugins/iOS/OverrideAppDelegate.m and copy the content below in that file.

#import "UnityAppController.h"
#import <WebEngage/WebEngage.h>


@interface OverrideAppDelegate : UnityAppController
@end


IMPL_APP_CONTROLLER_SUBCLASS(OverrideAppDelegate)

@implementation OverrideAppDelegate

-(BOOL)application:(UIApplication*) application didFinishLaunchingWithOptions:(NSDictionary*) options
{
    [[WebEngage sharedInstance] application:application didFinishLaunchingWithOptions:options];
    
    return [super application:application didFinishLaunchingWithOptions:options];
}

@end

Congratulations!

You have successfully integrated WebEngage with your app and are sending user session data to WebEngage. Please note that it may take up to a few minutes for data to reflect in your dashboard.

Please feel free to drop in a few lines at [email protected] in case you have any further queries. We're always just an email away!

Updated 2 months ago


So, what's next?

We recommend that you implement the following integrations with your app before releasing it with WebEngage for the first time:

Track User Properties as User Attributes
Track User Actions as Events
Configure Push Messaging
Configure In-app Messaging

Unity.iOS


This Unity Package is only for iOS and will not work on any other platform

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.