Libring Events API
Our Events API gives you access to user-level data. It allows you to track the LTV or any event that takes place in your app at user-level in real time.
You can use it to identify “whales” and understand how your monetization influences user retention, among other things.
Our RESTful API has other two methods:
Request
https://api.libring.com/v1/events/new
Method
POST
Required Authorization
| Name | Example |
|---|---|
| token | ‘Authorization’=>”Token TOKEN_CODE” |
Required Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| Unique Identifier | String | Any unique id from your database to identify individual contacts: IMEI, Unique numbers (PK), Contact Id’s, emails, etc. | “VqQGAfdeTNAKYgwOFiaoqGk” |
| App Name | String | Name of the app | “My Game 1” |
| Platform | String | Predefined platforms: iOS, Android, Facebook, Windows Phone, Windows, Linux, Mac OSX, Black Berry, Others | “Mac OSX” |
| Event Timestamp | DateTime | Time the event occurred. | “2014-04-21 09:57:40 -0400” |
| Event Type | String | Predefined types: level start, level end, init session, end session, inapp purchase, ad impression, ad click, ad completion, ad request or custom | “ad click”,”ad impression” |
Optional Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| Amount | Decimal | If the event generated some earning, enter the amount. | 100.45 |
| Ad Type | String | if this event was generated from advertising, enter the type of the ad. | “Banner” |
| Ad Format | String | If this event was generated from advertising, enter the format of the ad. | “900×70” |
| Ad Network | String | If this event was generated from advertising, enter the network. | “AdMob” |
| Ad | String | If this event was generated from advertising, enter the ad name. | “Ad number 2” |
| Ad URL | String | If this event was generated from advertising, enter the ad URL. | “http://www.advertiser.com/Ad_number_2” |
| User IP | String | Information about contact’s IP address. | “127.0.0.1” |
| User Device | String | Information about contact’s device. | “iPhone 6” |
| User Name | String | Information about contact’s name. | “John Maclane” |
| User Email | String | Information about contact’s email. | “my@email.com” |
| User Country | String | Information about contact’s country. Either ISO 3166 alpha-2 or ISO 3166 numeric can be used. | “US” or 840 for United States |
| Metadata** (Event’s or contact’s additional information) |
Hash | Additional information about the event. Ex: item purchased, operacional system used, etc. Use JSON: { “name”: “value”, “name”: “value”, … } | { “items”: “Coin 100, Coin 200”, “card”: “VISA” } |
**Metadata is a field to add extra information associated to the events. Your metadata can have any information specific to your business – ‘Photo filetype’ makes sense for Instagram, but it likely doesn’t apply to your events. You might have metadata like ‘visits_per_month’ or ‘phase’… A variety of metadata means more description for you events, which allows for deeper analysis with Libring.
Strategies
Thinking about strategies, there are two ways to use Libring LTV API:
1. Make one call per action
You can call our API every time your user executes an action. For example:
- one call when the user starts a session;
- one call when the user views an ads;
- one call when the user starts a new level in your game;
- one call when the user finishes this level;
- one call when the user ends a session.
5 calls to our API, no problem. Just be sure that it will not decrease the performance of your app.
Or…
2. Make just one call per session
You can store all your user’s actions inside your app (local variables) and when the user ends a session (close the app, put it in background or logout), you can send all actions with just one call.
That means there are 5 actions in just one call with 5.
JSON Structure Example
{
"libring": {
"VqQGAfdeTNAKYgwOFiaoqGkgCrrI": {
"app_name": "My Game 1",
"contact" : {
"name": "John Maclane",
"email": "john@email.com",
"country": "France",
"metadata": {
"ip": "204.194.200.10",
"device": "iPhone 6s"
}
},
"events": {
"2014-04-21 09:57:40 -0400": [ {
"type": "init session",
"platform": "iOS"
},
{
"type": "ad impression",
"ad_type": "banner",
"ad_format": "100x100",
"ad_network": "AdMob",
"platform": "iOS",
"metadata": {
"place": "game view 1",
"times_tried": "2"
}
} ],
"2014-04-21 10:00:20 -0400": [ {
"type": "level start",
"platform": "iOS"
} ],
"2014-04-21 10:03:20 -0400": [ {
"type": "inapp purchase",
"amount": 0.05,
"platform": "iOS"
} ],
"2014-04-23": [ {
"type": "end session",
"platform": "iOS"
} ]
}
}
}
}
Response
| HTTP Status | |
|---|---|
| 200 OK | Positive response, all fine |
| 400 Bad Request | If required parameter (did) is not passed |
| 401 Unauthorized | When an api_token fails to pass or the wrong api_token does pass |
Examples
let parameters = [ "libring": [ "PLAYER11111": [ "app_name": "My game 1", "contact": [ "name": "Player John",
"email": "john@email.com" ], "events":[ "2015-04-27": [ [ "type": "ad impression", "platform": "Android"
] ] ] ] ] ] Alamofire.Manager.sharedInstance.session.configuration.HTTPAdditionalHeaders = ["Authorization":
"Token eFvAQALQpFeaedstLnuh3xZBL"] var request = Alamofire.request(.POST, "https://api.libring.com/v1/events/new",
parameters: parameters, encoding: .JSON) request.responseJSON{ (request,response,JSON,error)
in println("The Result: ") println(JSON) println("response status code :\\(response?.statusCode)")
println("error:\\(error)") }import com.koushikdutta.ion.Ion; import com.google.gson.JsonObject; import com.koushikdutta.async.future.Future;
import com.koushikdutta.async.future.FutureCallback;
Call Code:
JsonObject json = new JsonObject(); json.addProperty("libring", "{ 'contact_1': { 'app_name': 'My Game 1',
'contact': { 'name':'John', 'age': '31', 'country': 'Brazil' }, 'events': { '2015-05-18 09:57:40 -0400':
[{ 'type': 'ad impression', 'ad_type': 'banner', 'platform': 'iOS', 'ad_format': '100x100','ad_network':
'AdMob', 'metadata':{'device':'iPhone 6', 'level':'1'} }] } } }");
Ion.with(this) .load("https://api.libring.com/v1/events/new") .setHeader("Authorization",
"Token eFvAQALQpFeaedstLnuh3xZBL") .setJsonObjectBody(json) .asJsonObject() .setCallback(new FutureCallback<
JsonObject >() { @Override public void onCompleted(Exception e, JsonObject result)
{ System.out.println("Success!"); } });Libring LTV API
Our LTV API gives you access to user-level data. It allows you to track the LTV of your app and game users in real time in order to identify the “whales” and understand how your monetization influences user retention.
Our RESTful API has other two methods:
Request
https://api.libring.com/v1/events/new
Method
POST
Required Authorization
| Name | Example |
|---|---|
| token | ‘Authorization’=>”Token TOKEN_CODE” |
Required Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| Unique Identifier | String | Any unique id from your database to identify individual contacts: IMEI, Unique numbers (PK), Contact Id’s, emails, etc. | “VqQGAfdeTNAKYgwOFiaoqGk” |
| App Name | String | Name of the app | “My Game 1” |
| Platform | String | Predefined platforms: iOS, Android, Facebook, Windows Phone, Windows, Linux, Mac OSX, Black Berry, Others | “Mac OSX” |
| Event Timestamp | DateTime | Time the event occurred. | “2014-04-21 09:57:40 -0400” |
| Event Type | String | Predefined types: level start, level end, init session, end session, inapp purchase, ad impression, ad click, ad completion, ad request or custom | “ad click”,”ad impression” |
Optional Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| Amount | Decimal | If the event generated some earning, enter the amount. | 100.45 |
| Ad Type | String | if this event was generated from advertising, enter the type of the ad. | “Banner” |
| Ad Format | String | If this event was generated from advertising, enter the format of the ad. | “900×70” |
| Ad Network | String | If this event was generated from advertising, enter the network. | “AdMob” |
| Ad | String | If this event was generated from advertising, enter the ad name. | “Ad number 2” |
| Ad URL | String | If this event was generated from advertising, enter the ad URL. | “http://www.advertiser.com/Ad_number_2” |
| User IP | String | Information about contact’s IP address. | “127.0.0.1” |
| User Device | String | Information about contact’s device. | “iPhone 6” |
| User Name | String | Information about contact’s name. | “John Maclane” |
| User Email | String | Information about contact’s email. | “my@email.com” |
| User Country | String | Information about contact’s country. | “USA” |
| Metadata** (Event’s or contact’s additional information) |
Hash | Additional information about the event. Ex: item purchased, operacional system used, etc. Use JSON: { “name”: “value”, “name”: “value”, … } | { “items”: “Coin 100, Coin 200”, “card”: “VISA” } |
**Metadata is a field to add extra information associated to the events. Your metadata can have any information specific to your business – ‘Photo filetype’ makes sense for Instagram, but it likely doesn’t apply to your events. You might have metadata like ‘visits_per_month’ or ‘phase’… A variety of metadata means more description for you events, which allows for deeper analysis with Libring.
Strategies
Thinking about strategies, there are two ways to use Libring LTV API:
1. Make one call per action
You can call our API every time your user executes an action. For example:
- one call when the user starts a session;
- one call when the user views an ads;
- one call when the user starts a new level in your game;
- one call when the user finishes this level;
- one call when the user ends a session.
5 calls to our API, no problem. Just be sure that it will not decrease the performance of your app.
Or…
2. Make just one call per session
You can store all your user’s actions inside your app (local variables) and when the user ends a session (close the app, put it in background or logout), you can send all actions with just one call.
That means there are 5 actions in just one call with 5.
JSON Structure Example
{
"libring": {
"VqQGAfdeTNAKYgwOFiaoqGkgCrrI": {
"app_name": "My Game 1",
"contact" : {
"name": "John Maclane",
"email": "john@email.com",
"country": "France",
"metadata": {
"ip": "204.194.200.10",
"device": "iPhone 6s"
}
},
"events": {
"2014-04-21 09:57:40 -0400": [ {
"type": "init session",
"platform": "iOS"
},
{
"type": "ad impression",
"ad_type": "banner",
"ad_format": "100x100",
"ad_network": "AdMob",
"platform": "iOS",
"metadata": {
"place": "game view 1",
"times_tried": "2"
}
} ],
"2014-04-21 10:00:20 -0400": [ {
"type": "level start",
"platform": "iOS"
} ],
"2014-04-21 10:03:20 -0400": [ {
"type": "inapp purchase",
"amount": 0.05,
"platform": "iOS"
} ],
"2014-04-23": [ {
"type": "end session",
"platform": "iOS"
} ]
}
}
}
}
Response
| HTTP Status | |
|---|---|
| 200 OK | Positive response, all fine |
| 400 Bad Request | If required parameter (did) is not passed |
| 401 Unauthorized | When an api_token fails to pass or the wrong api_token does pass |
Examples
let parameters = [ "libring": [ "PLAYER11111": [ "app_name": "My game 1", "contact": [ "name": "Player John",
"email": "john@email.com" ], "events":[ "2015-04-27": [ [ "type": "ad impression", "platform": "Android"
] ] ] ] ] ] Alamofire.Manager.sharedInstance.session.configuration.HTTPAdditionalHeaders = ["Authorization":
"Token eFvAQALQpFeaedstLnuh3xZBL"] var request = Alamofire.request(.POST, "https://api.libring.com/v1/events/new",
parameters: parameters, encoding: .JSON) request.responseJSON{ (request,response,JSON,error)
in println("The Result: ") println(JSON) println("response status code :\\(response?.statusCode)")
println("error:\\(error)") }import com.koushikdutta.ion.Ion; import com.google.gson.JsonObject; import com.koushikdutta.async.future.Future;
import com.koushikdutta.async.future.FutureCallback;
Call Code:
JsonObject json = new JsonObject(); json.addProperty("libring", "{ 'contact_1': { 'app_name': 'My Game 1',
'contact': { 'name':'John', 'age': '31', 'country': 'Brazil' }, 'events': { '2015-05-18 09:57:40 -0400':
[{ 'type': 'ad impression', 'ad_type': 'banner', 'platform': 'iOS', 'ad_format': '100x100','ad_network':
'AdMob', 'metadata':{'device':'iPhone 6', 'level':'1'} }] } } }");
Ion.with(this) .load("https://api.libring.com/v1/events/new") .setHeader("Authorization",
"Token eFvAQALQpFeaedstLnuh3xZBL") .setJsonObjectBody(json) .asJsonObject() .setCallback(new FutureCallback<
JsonObject >() { @Override public void onCompleted(Exception e, JsonObject result)
{ System.out.println("Success!"); } });Contact Us
210 Broadway #201,
Cambridge, MA 02139
+1 617 858 6051
contact@libring.com