Skip to content

Commit 1e4b85a

Browse files
committed
migrate readme to zendesk
1 parent 9a6f41e commit 1e4b85a

File tree

3 files changed

+56
-188
lines changed

3 files changed

+56
-188
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## April 24, 2017
2+
* Migrate setup instructions and plugin documentation in README to Zendesk
3+
14
## April 17, 2017
25
* Updated Android to v2.13.3 [release notes](https://github.com/amplitude/Amplitude-Android/blob/master/CHANGELOG.md)
36
* Updated iOS to v3.14.1 [release notes](https://github.com/amplitude/Amplitude-iOS/blob/master/CHANGELOG.md)

LICENSE

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Amplitude
2+
3+
The MIT License (MIT)
4+
5+
Copyright (c) 2014 Amplitude
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy
8+
of this software and associated documentation files (the "Software"), to deal
9+
in the Software without restriction, including without limitation the rights
10+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
copies of the Software, and to permit persons to whom the Software is
12+
furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in
15+
all copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
THE SOFTWARE.

README.md

Lines changed: 30 additions & 188 deletions
Original file line numberDiff line numberDiff line change
@@ -1,202 +1,44 @@
11
Amplitude Unity Plugin
22
============
33

4-
This plugin simplifies the integration of Amplitude iOS and Android SDKs into your Unity project. This respository also contains a sample project with the Unity plugin integrated. Open the project and replace the API key in AmplitudeDemo.cs with your key to see how the integration works.
4+
A plugin to simplify the integration of [Amplitude](https://www.amplitude.com) iOS and Android SDKs into your Unity project. This respository also contains a sample project with the Unity plugin integrated.
55

6-
For iOS and Android specific documentation, see [iOS README](https://github.com/amplitude/Amplitude-iOS/blob/master/README.md) and [Android README](https://github.com/amplitude/Amplitude-Android/blob/master/README.md)
6+
# Setup and Documentation #
7+
Please see our [installation guide](https://amplitude.zendesk.com/hc/en-us/articles/115002991968-Unity-Plugin-Installation) for instructions on installing and using our Unity Plugin.
78

8-
# Setup #
9+
# Other Helpful Documentation #
10+
* [iOS](https://amplitude.zendesk.com/hc/en-us/articles/115002278527-iOS-SDK-Installation)
11+
* [Android](https://amplitude.zendesk.com/hc/en-us/articles/115002935588-Android-SDK-Installation)
912

10-
1. If you haven't already, go to https://amplitude.com and register for an account. You will receive an API Key.
13+
# Changelog #
14+
Click [here](https://github.com/amplitude/unity-plugin/blob/master/CHANGELOG.md) to view the Unity Plugin Changelog.
1115

12-
2. [Download the plugin package](https://github.com/amplitude/unity-plugin/raw/master/amplitude-unity.unitypackage).
16+
# Questions? #
17+
If you have questions about using or installing our Unity Plugin, you can send an email to [Amplitude Support](mailto:[email protected]).
1318

14-
3. Import the package into your Unity project. Select 'Import Package > Custom Package' from the 'Assets' menu.
19+
# License #
20+
```text
21+
Amplitude
1522
16-
4. In the Awake method in your main script, initialize and enable the Amplitude plugin in the:
23+
The MIT License (MIT)
1724
18-
```C#
19-
void Awake () {
20-
Amplitude amplitude = Amplitude.Instance;
21-
amplitude.logging = true;
22-
amplitude.init("YOUR_API_KEY_HERE");
23-
}
24-
```
25+
Copyright (c) 2014 Amplitude
2526
26-
5. To track an event anywhere in your app, call:
27+
Permission is hereby granted, free of charge, to any person obtaining a copy
28+
of this software and associated documentation files (the "Software"), to deal
29+
in the Software without restriction, including without limitation the rights
30+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
31+
copies of the Software, and to permit persons to whom the Software is
32+
furnished to do so, subject to the following conditions:
2733
28-
```C#
29-
Amplitude.Instance.logEvent("EVENT_IDENTIFIER_HERE");
30-
```
34+
The above copyright notice and this permission notice shall be included in
35+
all copies or substantial portions of the Software.
3136
32-
6. Events are saved locally. Uploads are batched to occur every 30 events and every 30 seconds. After calling `logEvent()` in your app, you will immediately see data appear on the Amplitude website.
33-
34-
NOTE if you are building your Unity project as an iOS app: Amplitude's iOS SDK requires the SQLite library, which is included in iOS but may require an additional build flag to enable. In Xcode, in your project's `Build Settings` and your Target's `Build Settings`, under `Linking` -> `Other Linker Flags`, add the flag `-lsqlite3.0`.
35-
36-
# Tracking Events #
37-
38-
It's important to think about what types of events you care about as a developer. You should aim to track between 20 and 100 types of events within your app. Common event types are different screens within the app, actions a user initiates (such as pressing a button), and events you want a user to complete (such as filling out a form, completing a level, or making a payment). Contact us if you want assistance determining what would be best for you to track.
39-
40-
# Tracking Sessions #
41-
42-
A session is a period of time that a user has the app in the foreground. Events that are logged within the same session will have the same `session_id`. Sessions are handled automatically now; you no longer have to manually call `startSession()` or `endSession()`.
43-
44-
You can also log events as out of session. Out of session events have a `session_id` of `-1` and are not considered part of the current session, meaning they do not extend the current session (useful for things like push notifications). You can log events as out of session by setting input parameter `outOfSession` to `true` when calling `logEvent()`:
45-
46-
```C#
47-
Amplitude.Instance.logEvent("EVENT", null, true);
48-
```
49-
50-
By default start and end session events are no longer sent. To renable add this line before initializing the SDK:
51-
```C#
52-
Amplitude amplitude = Amplitude.Instance;
53-
amplitude.trackSessionEvents(true);
54-
amplitude.init("YOUR_API_KEY_HERE");
55-
```
56-
57-
# Setting Custom User IDs #
58-
59-
If your app has its own login system that you want to track users with, you can call `setUserId()` at any time:
60-
61-
```C#
62-
Amplitude.Instance.setUserId("USER_ID_HERE");
63-
```
64-
65-
A user's data will be merged on the backend so that any events up to that point on the same device will be tracked under the same user.
66-
67-
You can also add a user ID as an argument to the `init()` call:
68-
69-
```C#
70-
Amplitude.Instance.init("YOUR_API_KEY_HERE", "USER_ID_HERE");
71-
```
72-
73-
# Setting Event Properties #
74-
75-
You can attach additional data to any event by passing a JSONObject as the second argument to `logEvent()`:
76-
77-
```C#
78-
Dictionary<string, object> demoOptions = new Dictionary<string, object>() {
79-
{"Bucket" , "A" },
80-
{"Credits" , 9001}
81-
};
82-
Amplitude.Instance.logEvent("Sent Message", demoOptions);
83-
```
84-
85-
# User Properties and User Property Operations #
86-
87-
The Amplitude Unity Plugin supports the operations `set`, `setOnce`, `unset`, and `add` on individual user properties. Each operation is performed on a single user property, and updates its value accordingly. The method names follow this format: [operation]UserProperty. For example the set operation allows you to set a given user property to a boolean, double, int, float, etc, and you would call setUserProperty to do so. The provided method signatures will tell you what value types are allowed for each operation.
88-
89-
1. `set`: this sets the value of a user property.
90-
91-
```C#
92-
Amplitude.Instance.setUserProperty("gender", "female"); // string value
93-
Amplitude.Instance.setUserProperty("age", 20); // int value
94-
Amplitude.Instance.setUserProperty("some float values", new float[]{20f, 15.3f, 4.8f}); // float array
95-
```
96-
97-
2. `setOnce`: this sets the value of a user property only once. Subsequent `setOnce` operations on that user property will be ignored. In the below example, `sign_up_date` will be set once to `08/24/2015`, and the following setOnce to `09/14/2015` will be ignored:
98-
99-
```C#
100-
Amplitude.Instance.setOnceUserProperty("sign_up_date", "08/24/2015");
101-
Amplitude.Instance.setOnceUserProperty("sign_up_date", "09/14/2015");
102-
```
103-
104-
3. `unset`: this will unset and remove a user property.
105-
106-
```C#
107-
Amplitude.Instance.unsetUserProperty("sign_up_date");
108-
Amplitude.Instance.unsetUserProperty("age");
109-
```
110-
111-
4. `add`: this will increment a user property by some numerical value. If the user property does not have a value set yet, it will be initialized to 0 before being incremented.
112-
113-
```C#
114-
Amplitude.Instance.addUserProperty("karma", 1.5);
115-
Amplitude.Instance.addUserProperty("friends", 1);
116-
```
117-
118-
Note: string values are allowed as they will be convered to their numerical equivalent. Dictionary values are also allowed as they will be flattened during processing.
119-
120-
5. `append`: this will append a value or values to a user property. If the user property does not have a value set yet, it will be initialized to an empty list before the new values are appended. If the user property has an existing value and it is not a list, it will be converted into a list with the new value appended.
121-
122-
```C#
123-
Amplitude.Instance.appendUserProperty("ab-tests", "new_user_tests");
124-
Amplitude.Instance.appendUserProperty("some_list", new int[]{1, 2, 3, 4});
125-
```
126-
127-
### Arrays in User Properties ###
128-
129-
The Amplitude Unity Plugin supports arrays in user properties. Any of the user property operations above (with the exception of `add`) can accept arrays and lists. You can directly `set` arrays, or use `append` to generate an array.
130-
131-
```C#
132-
List<double> list = new List<double>();
133-
list.add(2.5);
134-
list.add(6.8);
135-
Amplitude.Instance.appendUserProperty("my_list", list);
136-
```
137-
138-
### Setting Multiple Properties with `setUserProperties` ###
139-
140-
You may use `setUserProperties` shorthand to set multiple user properties at once. This method is simply a wrapper around `Identify.set` and `identify`.
141-
142-
```C#
143-
Dictionary<string, object> userProperties = new Dictionary<string, object>() {
144-
{"float_gprop", 1.0}
145-
};
146-
Amplitude.Instance.setUserProperties(userProperties);
147-
```
148-
149-
### Clearing User Properties ###
150-
151-
You may use `clearUserProperties` to clear all user properties at once. **Note: the result is irreversible!**
152-
153-
```C#
154-
Amplitude.Instance.clearUserProperties();
155-
```
156-
157-
158-
# Tracking Revenue #
159-
160-
To track revenue from a user, call `logRevenue()` each time a user generates revenue. For example:
161-
162-
```C#
163-
Amplitude.Instance.logRevenue("com.company.productid", 1, 3.99);
164-
```
165-
166-
`logRevenue()` takes a takes a string to identify the product (the product ID from Google Play), an int with the quantity of product purchased, and a double with the dollar amount of the sale. This allows us to automatically display data relevant to revenue on the Amplitude website, including average revenue per daily active user (ARPDAU), 1, 7, 14, 30, 60, and 90 day revenue, lifetime value (LTV) estimates, and revenue by advertising campaign cohort and daily/weekly/monthly cohorts.
167-
168-
The logRevenue method also supports revenue validation. See the iOS and Android specific docs for more details. Here is a simple example:
169-
170-
```C#
171-
if (Application.platform == RuntimePlatform.IPhonePlayer) {
172-
Amplitude.Instance.logRevenue("sku", 1, 1.99, "cmVjZWlwdA==", null);
173-
} else if (Application.platform == RuntimePlatform.Android) {
174-
Amplitude.Instance.logRevenue("sku", 1, 1.99, "receipt", "receiptSignature");
175-
}
176-
```
177-
178-
The logRevenue method also allows for tracking revenueType and event properties on the revenue event.
179-
```C#
180-
Dictionary<string, object> eventProperties = new Dictionary<string, object>() {
181-
{"Bucket" , "A" },
182-
{"color" , "blue"}
183-
};
184-
185-
if (Application.platform == RuntimePlatform.IPhonePlayer) {
186-
Amplitude.Instance.logRevenue("sku", 1, 1.99, "cmVjZWlwdA==", null, "purchase", eventProperties);
187-
} else if (Application.platform == RuntimePlatform.Android) {
188-
Amplitude.Instance.logRevenue("sku", 1, 1.99, "receipt", "receiptSignature", "purchase", eventProperties);
189-
}
190-
```
191-
192-
# Allowing Users to Opt Out
193-
194-
To stop all event and session logging for a user, call setOptOut:
195-
196-
```C#
197-
Amplitude.Instance.setOptOut(true);
37+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
40+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
41+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
42+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
43+
THE SOFTWARE.
19844
```
199-
200-
Logging can be restarted by calling setOptOut again with enabled set to false.
201-
No events will be logged during any period opt out is enabled.
202-

0 commit comments

Comments
 (0)