InBrain Surveys Unity SDK allows to present native web view with surveys from within your Unity app and receive rewards for their completion.
Download latest version of InBrain Surveys Unity SDK (.unitypackage). In Unity editor right click inside Project pane and select Import package -> Custom package. Select file you've downloaded and confirm. Now InBrain Surveys Unity SDK should be ready to use.
There are some prerequisites for InBrain Surveys Unity SDK:
- API ClientID (Provided in inBrain.ai dashboard)
- API Secret (Provided in inBrain.ai dashboard)
- Server to Server (flag indicating whether your app using S2S callbacks for inBrain rewards)
In Unity editor go to Window -> InBrain -> Edit Settings and enter those values in corresponding input fields.
In order to access SDK functionality InBrain singleton object required. One will be instantiated automatically after referencing its 'Instance' method for the first time. Also, provide unique user ID before calling any other methods to specify which player should receive rewards.
Set global callback that will be triggered every time when new rewards received or surveys web view dismissed.
Optionally you can specify whether to confirm received rewards automatically (by default they are not).
Present surveys web view with the following call:
There are two ways to receive rewards that user earned during surveys completion:
- use global callback (described above)
- request rewards manually with GetRewards method
Processed rewards should be confirmed in order to avoid receiving them repeatedly.
This call should always be made following rewards data processing.
In order to change surveys web view language
SetLanguage method should be called before it is opened.
Accepted languages: "en-us", "fr-fr", "en-gb", "en-ca", "en-au", "en-in". System language is used by default.
SDK provides additional means that allow surveys wall UI customization.
There is a possibility to open only one specific survey in a web view. In order to that list of available surveys should be requested first by calling a
Each recieved survey has its own
id value that should be passed to