Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Igi4 committed Mar 13, 2015
1 parent b113462 commit 6facef4
Showing 1 changed file with 94 additions and 0 deletions.
94 changes: 94 additions & 0 deletions README.md
Expand Up @@ -57,6 +57,100 @@ properties.put("age", 34);
// Store customer's age
infinario.update(properties);
</code></pre>

<h2>Automatic events</h2>
<p>
INFINARIO Android SDK automatically tracks some events on its own. Automatic events ensure that basic user data gets tracked with as little effort as just including the SDK into your game. Automatic events include sessions, installation, identification and payments tracking.
</p>

<h3>Sessions</h3>
<p>
Session is a time spent in the game, it starts when the game is launched and ends when the game gets dismissed from recent apps or is freed from memory in another way. Automatic tracking of sessions produces two events, <code>session_start</code> and <code>session_end</code>. Both events contain the timestamp of the occurence together with basic attributes about the device (OS, OS version, SDK, SDK version and device model). Event <code>session_end</code> contains also the duration of the session in seconds. Example of <code>session_end</code> event attributes in <em>JSON</em> format:
</p>

<pre><code>{
"duration": 125,
"device_model": "LGE Nexus 5",
"ip": "10.0.1.58",
"os_name": "Android",
"os_version": "5.0.1",
"sdk": "AndroidSDK",
"sdk_version": "1.0.4"
}
</code></pre>

<h3>Installation</h3>

<p>
Installation event is fired <strong>only once</strong> for the whole lifetime of the game on one device when the game is launched for the first time. Besides the basic information about the device (OS, OS version, SDK, SDK version and device model), it also contains additional attribute called <strong>campaign_id</strong> which identifies the source of the installation. For more information about this topic, please refer to the <a href="http://guides.infinario.com/user-guide/acquisition/">aquisition documentation</a>. Please note that <code>com.android.vending.INSTALL_REFERRER</code> intent is used to acquire the source of the installation. Example of installation event:
</p>

<pre><code>{
"campaign": "Advertisement on my website",
"campaign_id": "ui9fj4i93jf9083094fj9043",
"link": "https://play.google.com/store/...",
"device_model": "LGE Nexus 5",
"ip": "10.0.1.58",
"os_name": "Android",
"os_version": "5.0.1",
"sdk": "AndroidSDK",
"sdk_version": "1.0.4"
}
</code></pre>

<h3>Identification</h3>

<p>
Identification event is tracked each time the <code>identify()</code> method is called. It contains all basic information regarding the device (OS, OS version, SDK, SDK version and device model) as well as <strong>registered</strong> attribute which identifies the player. Example of an identification event:
</p>

<pre><code>{
"registered": "player@email.com",
"device_model": "LGE Nexus 5",
"ip": "10.0.1.58",
"os_name": "Android",
"os_version": "5.0.1",
"sdk": "AndroidSDK",
"sdk_version": "1.0.4"
}
</code></pre>

<h3>Payments</h3>

<p>
In order to use the automatic payment tracking, the INFINARIO Android SDK needs to know when a purchase flow has finished. After the player goes through the whole purchase process, Android calls <code>onActivityResult</code> method on the activity which started the purchase flow. That is the place in the game code where INFINARIO Android SDK instance needs to get notified about the purchase using the <code>trackPurchases()</code> method. For more details, please refer to the sample code below:
</p>

<pre><code>// override this method in each activity which starts the purchase flow
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// first check if the infinario instance has been initialized
if (infinario != null) {
// pass resultCode and the intent, INFINARIO Android SDK automatically
// determines whether this is a purchase intent or not
infinario.trackPurchases(resultCode, data);
}
}
</code></pre>

<p>
Purchase events (called <code>hard_purchase</code>) contain all basic information about the device (OS, OS version, SDK, SDK version and device model) combined with additional purchase attributes <strong>brutto</strong>, <strong>currency</strong>, <strong>item_id</strong> and <strong>item_title</strong>. <strong>Brutto</strong> attribute contains price paid by the player. Attribute <strong>item_title</strong> consists of human-friendly name of the bought item (e.g. Silver sword) and <strong>item_id</strong> corresponds to the product ID for the in-app purchase as defined in your Google Play Developer Console. Example of purchase event:
</p>

<pre><code>{
"brutto": 0.911702,
"currency": "EUR",
"item_id": "android.test.purchased",
"item_title": "Silver sword",
"device_model": "LGE Nexus 5",
"ip": "10.0.1.58",
"os_name": "Android",
"os_version": "5.0.1",
"sdk": "AndroidSDK",
"sdk_version": "1.0.4"
}
</code></pre>

<h2>Push notifications</h2>
Infinario web application allows you to easily create complex scenarios which you can use to send push notifications directly to your customers. The following section explains how to enable receiving push notifications in the Infinario Andriod SDK.

Expand Down

0 comments on commit 6facef4

Please sign in to comment.