Upsight logo Back to top

Getting Started

Import the Plugin


  1. Download the Upsight Unity Plugin and double-click the file to import it into your project.

  2. Open the demo scene in the Plugins/Upsight/demo folder.

    The plugin includes a demo scene to show you how all the features work. It is preconfigured with an Upsight test account so you can run it on your device.

  3. Switch to either the iOS or Android platform from the build settings menu.

  4. Build and run the demo scene to familiarize yourself with the plugin. You must run the demo scene on a physical device. You cannot test Upsight functionality from the Unity editor.

    Watch the logs while pressing buttons to see all the events the plugin offers and when they are fired. After exploring the demo scene you will be ready to add Upsight to your Unity project.

Disable Automatic Reference Counting

If you are building an iOS project in Unity 5, you will need to disable Automatic Reference Counting. To do this, in your Build Phases, under Compile Sources, add -fno-objc-arc as a Compiler Flag to all the files in the Libraries/Plugins/iOS directories.

Some files that require the compiler flag

You also have the option to add -fno-objc-arc in Unity. To do so, locate the Upsight plugin in the Assets/Plugins/iOS/ folder. In the Inspector for each file, you should see "Compile Flags" towards the bottom. Adding -fno-objc-arc to this will allow Unity to compile the Xcode project with ARC turned off.

Link AdSupport Framework

If you are getting a Apple Mach-O Linker Error, your Unity Project did not import the AdSupport.framework library to Xcode correctly. To fix this, you will need to manually delete the library in the Project and add it again.

  1. In your Frameworks folder, delete the AdSupport.framework file.

  2. In your Build Phases, under the Link Binary With Libraries section, click the + (plus) button to add a framework.

  3. In the window that appears, select AdSupport.framework and click Add.

Initialize the Plugin


You must do the following in your own script to initialize the plugin properly.

  1. Call Upsight.init and Upsight.requestAppOpen at app launch.
  2. Call Upsight.requestAppOpen every time your app is opened after being backgrounded.

The sample code below shows how this is done. The script would need to be attached to a GameObject in your Unity project.

public class MyUpsightPlugin : MonoBehaviour
{
    // These values are from the demo scene.
    // Replace them with your own.
#if UNITY_ANDROID
    public string appToken = "a0ae2f5cd6dc465aaeaf4b05692ac3be";
    public string appSecret = "0e6deaf6ff0040c0963848d534bf1cb3";
#else
    public string appToken = "39da36bd4be24e18a54b367dc5407647";
    public string appSecret = "8c52361b93664202a783487944cb7477";
#endif

    void Start()
    {
#if UNITY_IPHONE || UNITY_ANDROID
        Upsight.init( appToken, appSecret );

        // Make an open request at every app launch
        Upsight.requestAppOpen();
#endif
    }

    void OnApplicationPause( bool pauseStatus )
    {
#if UNITY_IPHONE || UNITY_ANDROID
        // Make an open request whenever app is resumed
        if( !pauseStatus )
            Upsight.requestAppOpen();
#endif
    }
}

Important If you are using the Enterprise and regular SDKs, make sure to call the startSession method before making an requestAppOpen Open Call.

Create a Placement


Placement are hooks within your app that can trigger any type of Upsight content that you have configured in the Upsight Marketing Dashboard. Placements are created from the Upsight Marketing Dashboard.

In this example, you will create an app_launch placement.

  1. Log in to the Upsight Marketing Dashboard.
  2. Click on your app on the dashboard home page.
  3. Click on the “App Settings” button.
  4. Click on the “Placements” link.
  5. Create a placement tag named app_launch.

Add a Content Unit to Your Placement


Placements must contain at least one content unit to display. Content units are created and added to placements from the Upsight Marketing Dashboard.

In this example, you will add an Internal Cross-Promotion to your app_launch placement.

  1. Click on your app on the Upsight Marketing Dashboard home page.
  2. Click on the “add content” button.
  3. Click on on the Add Internal Cross-Promotion button.
  4. Enter Test Ad for the Internal Cross-Promotion name.
  5. Enter name of app(s) for Internal Cross-Promotion.
  6. Upload image(s) associated with Internal Cross-Promotion.
  7. Under “Placement(s)”, check the box for the app_launch placement you created.
  8. Click the “publish” button.

Make a Content Request


Make content requests from your app for specific placements whenever you wish to trigger Upsight content to be displayed. This will add placement hooks within your app that correspond to placements that you have created from the Upsight Marketing Dashboard.

In this example, you will make a content request for the app_launch placement each time your app launches. Be sure to make this call after you have initialized the Upsight Unity Plugin.

void Start()
{
#if UNITY_ANDROID
    Upsight.init( androidAppToken, androidAppSecret );
#else
    Upsight.init( iosAppToken, iosAppSecret );
#endif

    // Make an open request at every app launch
    Upsight.requestAppOpen();

    // Make a content request at every app launch
    Upsight.sendContentRequest( "app_launch", true );
}

Test Integration


Build your app and install it onto a device to test the integration. Please note that you will not be able to see Upsight content from the Unity editor. You must test from a physical device in order to see content.

Integration Checklist


To help make the integration process easier, we've created a checklist with troubleshooting tips that you can follow. If you are not getting expected results after integration, consults the checklist to see if there are any steps that you are missing.

Integration Checklist