Upsight logo Back to top

Method Reference

deregisterForPushNotifications

Description


This method deregisters the current device for push notifications.

deregisterForPushNotifications

Signature


public static void deregisterForPushNotifications()

deregisterForPushNotifications

Required Parameters


No Required Parameters

deregisterForPushNotifications

Optional Parameters


No Optional Parameters

getContentBadgeNumber

Description


This method sends a request to get the badge count for the given placement.

getContentBadgeNumber

Signature


public static void getContentBadgeNumber( string placement )

getContentBadgeNumber

Required Parameters


NameTypeDescription
placementstringThis parameter is the placement tag configured in the dashboard. This placement should contain a More Games Widget in order for this method to return a badge count.

getContentBadgeNumber

Optional Parameters


No Optional Parameters

getOptOutStatus

Description


This method returns the opt-out status. By default, the opt-out status is false.

getOptOutStatus

Signature


public static bool getOptOutStatus()

getOptOutStatus

Required Parameters


No Required Parameters

getOptOutStatus

Optional Parameters


No Optional Parameters

getPluginVersion

Description


This method returns the plugin version.

getPluginVersion

Signature


public static string getPluginVersion()

getPluginVersion

Required Parameters


No Required Parameters

getPluginVersion

Optional Parameters


No Optional Parameters

init

Description


This method initializes the plugin. This must be called at app launch.

init

Signature


public static void init( string appToken, string appSecret, string gcmProjectNumber = null )

init

Required Parameters


NameTypeDescription
appTokenstringThe App Token.
appSecretstringThe App Secret.

init

Optional Parameters


NameTypeDescription
gcmProjectNumberstring The Google Cloud Messaging Project Number.

Note This parameter is Android only and optional. It is only required if you are using push notifications on Android.

preloadContentRequest

Description


This method preloads a content request. Results in the contentPreloadSucceededEvent and contentPreloadFailedEvent firing. You can later call sendContentRequest to send it.

preloadContentRequest

Signature


public static void preloadContentRequest( string placement, Dictionary<string,object> dimensions = null )

preloadContentRequest

Required Parameters


NameTypeDescription
placementstringThis parameter is the placement tag configured in the dashboard.

preloadContentRequest

Optional Parameters


NameTypeDescription
dimensionsDictionary<String, object> This parameter is a dictionary that contains Custom Dimensions assigned to the content request. When setting a dimension, remember the following:
  • Dimension value must be string, numeric, or boolean type.
  • The Upsight server stores all custom dimensions received from each device.
  • You can remove a dimension for a given key on the server, by passing null as a dimension value.
  • Sending the same key with a different value will update the custom dimensions stored server-side.

registerForPushNotifications

Description


This method registers the current device for push notifications. This must be called at app launch in order to correctly handle pending notifications received after your app has been killed.

registerForPushNotifications

Signature


public static void registerForPushNotifications()

registerForPushNotifications

Required Parameters


No Required Parameters

registerForPushNotifications

Optional Parameters


No Optional Parameters

reportCustomEvent

Description


This method reports a custom event.

reportCustomEvent

Signature


public static void reportCustomEvent( Dictionary<string,object> properties )

reportCustomEvent

Required Parameters


NameTypeDescription
propertiesDictionary<string,object>A Dictionary containing the keys/values of the event.

Note The dictionary must conform to a specific structure in order for your events to be tracked correctly. Please use the Upsight Event Designer to construct your event data.

reportCustomEvent

Optional Parameters


No Optional Parameters

requestAppOpen

Description


This method requests an app open. This must be called every time your app is opened, at launch and when resumed from the background. It will automatically check for any received push notifications and fire off the appropriate event if your app was launched from a push.

The openRequestSucceededEvent and openRequestFailedEvent events will also fire letting you know if the operation succeeded or failed.

requestAppOpen

Signature


public static void requestAppOpen()

requestAppOpen

Required Parameters


No Required Parameters

requestAppOpen

Optional Parameters


No Optional Parameters

sendContentRequest

Description


This method sends a content request for a given placement tag.

There are display options to show the loading overlay immediately and to animate the display. There is also the option to include custom dimensions.

sendContentRequest

Signature


public static void sendContentRequest( string placement, bool showsOverlayImmediately, bool shouldAnimate = true, Dictionary<string,object> dimensions = null)

sendContentRequest

Required Parameters


NameTypeDescription
placementstringThis parameter is the placement tag configured in the dashboard.
showsOverlayImmediatelyboolIf set to true, the method will show the content overlay immediately.

sendContentRequest

Optional Parameters


NameTypeDescription
shouldAnimateboolIf set to true the content request will be animated.
dimensionsDictionary<String, object> This parameter is a dictionary that contains Custom Dimensions assigned to the content request. When setting a dimension, remember the following:
  • Dimension value must be string, numeric, or boolean type.
  • The Upsight server stores all custom dimensions received from each device.
  • You can remove a dimension for a given key on the server, by passing null as a dimension value.
  • Sending the same key with a different value will update the custom dimensions stored server-side.

sendContentRequestWithContentUnitID

Description


This method sends a content request with the contentUnitID and messageID received from a push notification (pushNotificationWithContentReceivedEvent). In addition, you can specify custom dimensions to the content request.

Note This method is for iOS only.

sendContentRequestWithContentUnitID

Signature


public static void sendContentRequestWithContentUnitID( string contentUnitID, string messageID, bool showsOverlayImmediately, bool shouldAnimate = true, Dictionary<string,object> dimensions = null )

sendContentRequestWithContentUnitID

Required Parameters


NameTypeDescription
contentUnitIDstringThis parameter is the ID of the Content Unit.
messageIDstringThis parameter is the ID of the message.
showsOverlayImmediatelyboolIf set to true, the method will show the content overlay immediately.

sendContentRequestWithContentUnitID

Optional Parameters


NameTypeDescription
shouldAnimateboolIf set to true the content request will be animated.
dimensionsDictionary<String, object> This parameter is a dictionary that contains Custom Dimensions assigned to the content request. When setting a dimension, remember the following:
  • Dimension value must be string, numeric, or boolean type.
  • The Upsight server stores all custom dimensions received from each device.
  • You can remove a dimension for a given key on the server, by psasing null as a dimension value.
  • Sending the same key with a different value will update the custom dimensions stored server-side.

setLogLevel

Description


This method sets the log level for the Upsight SDK.

Note This method is for Android only.

setLogLevel

Signature


public static void setLogLevel( UpsightLogLevel logLevel )

setLogLevel

Required Parameters


NameTypeDescription
logLevelUpsightLogLevelThis is an enum that has the value of SUPPRESS, VERBONE, DEBUG, INFO, WARN, ERROR, or ASSERT.

setLogLevel

Optional Parameters


No Optional Parameters

setOptOutStatus

Description


This method sets the opt-out status.

setOptOutStatus

Signature


public static void setOptOutStatus( bool optOutStatus )

setOptOutStatus

Required Parameters


NameTypeDescription
optOutStatusboolIf set to true the opt-out status of the Upsight Unity Plugin will be updated.

setOptOutStatus

Optional Parameters


No Optional Parameters

setShouldOpenContentRequestsFromPushNotifications

Description


This method sets a flag indicating whether a push notification with content should be automatically opened.

Note This method is for iOS only.

setShouldOpenContentRequestsFromPushNotifications

Signature


public static void setShouldOpenContentRequestsFromPushNotifications( bool shouldOpen )

setShouldOpenContentRequestsFromPushNotifications

Required Parameters


NameTypeDescription
shouldOpenboolIf set to true content units from push notifications will be automatically opened when received.

setShouldOpenContentRequestsFromPushNotifications

Optional Parameters


No Optional Parameters

setShouldOpenUrlsFromPushNotifications

Description


This method sets a flag indicating whether a push notification with a URL should be automatically opened.

Note This method is for iOS only.

setShouldOpenUrlsFromPushNotifications

Signature


public static void setShouldOpenContentRequestsFromPushNotifications( bool shouldOpen )

setShouldOpenUrlsFromPushNotifications

Required Parameters


NameTypeDescription
shouldOpenboolIf set to true URLs from push notifications will be automatically opened when received.

setShouldOpenUrlsFromPushNotifications

Optional Parameters


No Optional Parameters

trackInAppPurchase [iOS]

Description


This method tracks an In-App Purchase on iOS.

Note This method is for iOS only.

trackInAppPurchase [iOS]

Signature


public static void trackInAppPurchase( string productID, int quantity, UpsightIosPurchaseResolution resolutionType, byte[] receiptData = null )

trackInAppPurchase [iOS]

Required Parameters


NameTypeDescription
productIDstringThis is the Product ID of the purchase.
quantityintThis is the quantity purchased.
resolutionTypeUpsightIosPurchaseResolutionThis is an enum that has the value of Buy, Cancel, Error, or Failure.

trackInAppPurchase [iOS]

Optional Parameters


NameTypeDescription
receiptDatabyte[]This is the receipt from the In-App Purchase used for receipt verification..

trackInAppPurchase [Android]

Description


This method tracks an In-App Purchase on Android.

Note This method is for Android only.

trackInAppPurchase [Android]

Signature


public static void trackInAppPurchase( string sku, int quantity, UpsightAndroidPurchaseResolution resolutionType, double price, string orderId, string store )

trackInAppPurchase [Android]

Required Parameters


NameTypeDescription
skustringThis is the SKU of the purchase.
quantityintThis is the quantity purchased.
resolutionTypeUpsightAndroidPurchaseResolutionThis is an enum that has the value of Unset, Bought, Cancelled, Invalid, Owned, or Error.
pricedoubleThis is the total price of the purchase.
storestringThe name of the App Store (e.g. "Google").

trackInAppPurchase [Android]

Optional Parameters


No Optional Parameters

trackInAppPurchase [Android VGP]

Description


This method tracks In-App Purchases on Android with a provided UpsightPurchase object. Use this for tracking VGP Purchases.

Note This method is for Android only.

trackInAppPurchase [Android VGP]

Signature


public static void trackInAppPurchase( int quantity, UpsightAndroidPurchaseResolution resolutionType, double price, string orderId, string store, UpsightPurchase purchase )

trackInAppPurchase [Android VGP]

Required Parameters


NameTypeDescription
quantityintThis is the quantity purchased.
resolutionTypeUpsightAndroidPurchaseResolutionThis is an enum that has the value of Unset, Bought, Cancelled, Invalid, Owned, or Error.
pricedoubleThis is the total price of the purchase.
storestringThe name of the App Store (e.g. "Google").
purchaseUpsightPurchaseThe `UpsightPurchase` object returned from the `makePurchaseEvent` callback.

trackInAppPurchase [Android VGP]

Optional Parameters


No Optional Parameters