|
3 | 3 | This is the [Unity](http://unity3d.com/) SDK of AdjustIo. You can read more about AdjustIo at
|
4 | 4 | [adjust.io](http://adjust.io).
|
5 | 5 |
|
6 |
| -Use of the Plugin |
7 |
| ------------------------------ |
8 |
| -1. Import all files into your project. |
9 |
| -2. Read this file completely. |
10 |
| -3. Add the prefab Assets/AdjustIo/AdjustIo.prefab to the first scene of the app (only to the first scene!). |
11 |
| -4. Change the app token on the AdjustIo object in your hierachy. You can find your app token on the AdjustIo dashboard. |
12 |
| -5. Change the log level, environment and buffering settings to the desired settings. For more info on these settings, go to https://github.com/adeven/adjust_android_sdk/ or https://github.com/adeven/adjust_ios_sdk/ . |
13 |
| -6. If you already have an AndroidManifest.xml file in your project, please adapt the manifest according to instructions found on https://github.com/adeven/adjust_android_sdk/ . |
14 |
| -7. Add the desired tracking functions to your code. |
15 |
| - - Warning: AdjustIo is started in the Awake event. This means that all functions below may not work when called in the Awake event of the first scene. |
16 |
| - - Below you can find a list of all availabe functions (these are all static functions in the AdjustIo class): |
17 |
| - - AdjustIo.TrackEvent(string eventToken); |
18 |
| - - AdjustIo.TrackEvent(string eventToken, Dictionary<string,string> parameters); |
19 |
| - - AdjustIo.TrackRevenue(double cents); |
20 |
| - - AdjustIo.TrackRevenue(double cents, string eventToken); |
21 |
| - - AdjustIo.TrackRevenue(double cents, string eventToken, Dictionary<string,string> parameters); |
22 |
| - |
23 |
| -Use of Example Scene |
24 |
| --------------------------------- |
25 |
| -1. Open the scene Assets/AdjustIo/Example/ExampleScene. |
26 |
| -2. You will see the AdjustIo object in the Hiearchy tab. Change the app token parameter of this object to your app token. You can find your app token on the AdjustIo dashboard. |
27 |
| -3. In the Hierarchy tab you will also find the ExampleUI object. Change the event token parameter of this object to an event token of an event you have created for this app. This information can be found on the AdjustIo dashboard. The example will use this event token when tracking events or when tracking revenue. |
28 |
| -4. You can now run the example in the editor. You should see some buttons which will send events. While running in the Unity Editor the events will not be sent to the AdjustIo server (see below for more information). |
29 |
| -5. Build the example scene to an Android or iOS device so you can test if you receive any events on the dashboard. Be sure read the build instructions below first. |
30 |
| - |
31 |
| -Notes on Running the App in the Unity Editor |
32 |
| --------------------------------------------------------- |
33 |
| -The AdjustIo will not throw any errors when testing the app in the Editor. However most of the |
34 |
| -code will not be called while testing in the Editor. This means that the AdjustIo server will |
35 |
| -not receive any messages while testing in the Unity Editor. |
36 |
| - |
37 |
| - |
38 |
| -Android Build Instructions |
39 |
| --------------------------------------- |
40 |
| -1. Open the scene containing the AdjustIo object. |
41 |
| -2. Check the app token, log level, environment and buffering settings. |
42 |
| -3. Go to the menu and select AdjustIo > Check AndroidManifest.xml This will update the AndroidManifest to use the app token, log level, environment and buffering settings chosen on the AdjustIo object. |
43 |
| -4. You are now ready to build using the 'Build' or 'Build And Run' options from the 'Build Settings' menu. |
44 |
| - |
45 |
| -iOS Build Instructions |
46 |
| --------------------------------------- |
47 |
| -1. Open the scene containing the AdjustIo object. |
48 |
| -2. Check the app token, log level, environment and buffering settings. |
49 |
| -3. You are now ready to build using the Build or Build And Run from the Build Settings menu. |
50 |
| - - Warning: when you use File > Build and Run, the plugin may not be included correctly. |
51 |
| -4. When you notice that the plugin is not added to the Xcode project, be sure to check the file permissions on the file Assets/AdjustIo/Data/PostBuildScripts/PostBuildAdjustIoScript. You should have the execute permission on this file. |
52 |
| - |
53 |
| -License notes |
54 |
| -------------- |
| 6 | +## Basic Installation |
| 7 | + |
| 8 | +### 1. Get the SDK |
| 9 | + |
| 10 | +Download the latest version from our [releases page][releases]. Extract the |
| 11 | +archive in a folder of your choice. |
| 12 | + |
| 13 | +### 2. Add it to your project |
| 14 | + |
| 15 | +Open your project in the Unity Editor and navigate to Assets, Import Package. Click on Custom Package and locate the AdjustIoPlugin_..._.unityPackage file. Don't download the AndroidManifest.xml file if you already have it in your project. |
| 16 | + |
| 17 | +![][import] |
| 18 | + |
| 19 | +### 3. Integrate AdjustIo into your app |
| 20 | + |
| 21 | +1. Add the prefab Assets/AdjustIo/AdjustIo.prefab to the first scene of the app (only to the first scene!). |
| 22 | + |
| 23 | +2. Change the app token on the AdjustIo object in your hierachy. You can find your app token on your [dashboard]. |
| 24 | + |
| 25 | +3. Change the log level, environment and buffering settings to the desired settings. For more info on these settings, go to https://github.com/adeven/adjust_android_sdk/ or https://github.com/adeven/adjust_ios_sdk/ . On Android the log level is defined in AndroidManifest.xml file. |
| 26 | + |
| 27 | +![][settings] |
| 28 | + |
| 29 | +### 4. Adjust Android manifest |
| 30 | + |
| 31 | +Ignore this step if you imported the AndroidManifest.xml file from this package. |
| 32 | + |
| 33 | +1. Add or uncomment the ```<uses-permission>``` tags for ```INTERNET``` and ```ACCESS_WIFI_STATE``` if they aren't present already: |
| 34 | + |
| 35 | +![][permissions] |
| 36 | + |
| 37 | +2. Add broadcast receiver: |
| 38 | + |
| 39 | +![][receiver] |
| 40 | + |
| 41 | +3. Add AdjustIo settings |
| 42 | + |
| 43 | +Still in the `AndroidManifest.xml`, add the following `meta-data` tags inside |
| 44 | +the `application` tag. |
| 45 | + |
| 46 | +```xml |
| 47 | +<meta-data android:name="AdjustIoLogLevel" android:value="info" /> |
| 48 | +``` |
| 49 | + |
| 50 | +![][metadata] |
| 51 | + |
| 52 | +You can increase or decrease the amount of logs you see by changing the value |
| 53 | +of `AdjustIoLogLevel` to one of the following: |
| 54 | + |
| 55 | +- `verbose` - enable all logging |
| 56 | +- `debug` - enable more logging |
| 57 | +- `info` - the default |
| 58 | +- `warn` - disable info logging |
| 59 | +- `error` - disable warnings as well |
| 60 | +- `assert` - disable errors as well |
| 61 | + |
| 62 | +## Additional features |
| 63 | + |
| 64 | +Once you integrated the AdjustIo SDK into your project, you can take advantage |
| 65 | +of the following features. |
| 66 | + |
| 67 | +### Add tracking of custom events. |
| 68 | + |
| 69 | +You can tell AdjustIo about every event you want. Suppose you want to track |
| 70 | +every tap on a button. You would have to create a new Event Token in your |
| 71 | +[dashboard]. Let's say that Event Token is `abc123`. In your button's |
| 72 | +click handler method you could then add the following line to track the click: |
| 73 | + |
| 74 | +```actionscript |
| 75 | +AdjustIo.TrackEvent("abc123"); |
| 76 | +``` |
| 77 | + |
| 78 | +You can also register a callback URL for that event in your [dashboard] and we |
| 79 | +will send a GET request to that URL whenever the event gets tracked. In that |
| 80 | +case you can also put some key-value-pairs in an object and pass it to the |
| 81 | +`trackEvent` method. We will then append these named parameters to your |
| 82 | +callback URL. |
| 83 | + |
| 84 | +For example, suppose you have registered the URL |
| 85 | +`http://www.adeven.com/callback` for your event with Event Token `abc123` and |
| 86 | +execute the following lines: |
| 87 | + |
| 88 | +<pre><code> |
| 89 | +Dictionary<string,string> parameters = new Dictionary<string, string>(); |
| 90 | +parameters.Add("key","value"); |
| 91 | +parameters.Add("foo","bar"); |
| 92 | + |
| 93 | +AdjustIo.TrackEvent("abc123", parameters); |
| 94 | +</code></pre> |
| 95 | + |
| 96 | +In that case we would track the event and send a request to: |
| 97 | + |
| 98 | + http://www.adeven.com/callback?key=value&foo=bar |
| 99 | + |
| 100 | +It should be mentioned that we support a variety of placeholders like `{idfa}` |
| 101 | +that can be used as parameter values. In the resulting callback this |
| 102 | +placeholder would be replaced with the ID for Advertisers of the current |
| 103 | +device. Also note that we don't store any of your custom parameters, but only |
| 104 | +append them to your callbacks. If you haven't registered a callback for an |
| 105 | +event, these parameters won't even be read. |
| 106 | + |
| 107 | +### Add tracking of revenue |
| 108 | + |
| 109 | +If your users can generate revenue by clicking on advertisements or making |
| 110 | +in-app purchases you can track those revenues. If, for example, a click is |
| 111 | +worth one cent, you could make the following call to track that revenue: |
| 112 | + |
| 113 | +```actionscript |
| 114 | +AdjustIo.TrackRevenue(1.0); |
| 115 | +``` |
| 116 | + |
| 117 | +The parameter is supposed to be in cents and will get rounded to one decimal |
| 118 | +point. If you want to differentiate between different kinds of revenue you can |
| 119 | +get different Event Tokens for each kind. Again, you need to create those Event |
| 120 | +Tokens in your [dashboard]. In that case you would make a call like this: |
| 121 | + |
| 122 | +```actionscript |
| 123 | +AdjustIo.TrackRevenue(1.0, "abc123"); |
| 124 | +``` |
| 125 | + |
| 126 | +Again, you can register a callback and provide a dictionary of named |
| 127 | +parameters, just like it worked with normal events. |
| 128 | + |
| 129 | +<pre><code> |
| 130 | +Dictionary<string,string> parameters = new Dictionary<string, string>(); |
| 131 | +parameters.Add("key","value"); |
| 132 | +parameters.Add("foo","bar"); |
| 133 | + |
| 134 | +AdjustIo.TrackRevenue(1.0, "abc123", parameters); |
| 135 | +</code></pre> |
| 136 | + |
| 137 | +[import]: https://raw.github.com/adeven/adjust_sdk/master/Resources/unity/UnityImport.png |
| 138 | +[settings]: https://raw.github.com/adeven/adjust_sdk/master/Resources/unity/AdjustIoSettings.png |
| 139 | +[adjust.io]: http://adjust.io |
| 140 | +[dashboard]: http://adjust.io |
| 141 | +[releases]: https://github.com/adeven/adjust_unity_sdk/releases |
| 142 | +[permissions]: https://raw.github.com/adeven/adjust_sdk/master/Resources/unity/UnityPermissions.png |
| 143 | +[receiver]: https://raw.github.com/adeven/adjust_sdk/master/Resources/unity/UnityReceiver.png |
| 144 | +[metadata] : https://raw.github.com/adeven/adjust_sdk/master/Resources/unity/UnityMetaData.png |
| 145 | + |
| 146 | +## License |
55 | 147 |
|
56 | 148 | The file mod_pbxproj.py is licensed under the Apache License, Version 2.0 (the "License");
|
57 | 149 | you may not use this file except in compliance with the License.
|
58 | 150 | You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
| 151 | + |
| 152 | +The adjust-sdk is licensed under the MIT License. |
| 153 | + |
| 154 | +Copyright (c) 2012-2013 adeven GmbH, |
| 155 | +http://www.adeven.com |
| 156 | + |
| 157 | +Permission is hereby granted, free of charge, to any person obtaining a copy of |
| 158 | +this software and associated documentation files (the "Software"), to deal in |
| 159 | +the Software without restriction, including without limitation the rights to |
| 160 | +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
| 161 | +of the Software, and to permit persons to whom the Software is furnished to do |
| 162 | +so, subject to the following conditions: |
| 163 | + |
| 164 | +The above copyright notice and this permission notice shall be included in all |
| 165 | +copies or substantial portions of the Software. |
| 166 | + |
| 167 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 168 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 169 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 170 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 171 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 172 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 173 | +SOFTWARE. |
0 commit comments