Event Service

ShepHertz has added Event API to its broad gamut of services, which is a powerful analytics API and allows the developer to track app events as well as real time sessions of mobile & web apps. This also helps in tracking your page views/button clicks/downloads/App Open/App Close/Installs/DAU and user activity in your app.

App42 provides powerful management console to track and analyse these events in just few clicks. It also provides option to drill down your data based on custom and app properties like country/city/device model/OS etc. Also, it is not only just analysing the data, one can take action of sending push notification/email to target users who have done certain events. Segmentation features put more power in drilling option where one can see the individual list based on the query on events and property.

Following are the guidelines and steps to use it in your app.

Import Statement
  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
import com.shephertz.app42.paas.sdk.android.App42API;
import com.shephertz.app42.paas.sdk.android.App42Response;
import com.shephertz.app42.paas.sdk.android.App42Exception;
import com.shephertz.app42.paas.sdk.android.App42BadParameterException;
import com.shephertz.app42.paas.sdk.android.event.EventService;
Coming Soon  
#import "Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h"   
#import<Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h>
Not Available
using com.shephertz.app42.paas.sdk.csharp;  
using com.shephertz.app42.paas.sdk.csharp.app42Event;
<script type="text/javascript" src="App42-all-x.x.x.min.js"></script>
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Initialize

In order to use the various functions available in a specific API, the developer has to initialize with App42API by passing the apiKey and the secretKey which will become available after the app creation from AppHQ dashboard.

Required Parameters

apiKey - The Application key given when the application was created. secretKey - The secret key corresponding to the application key given when the application was created.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
App42API.Initialize("API_KEY","SECRET_KEY");
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; 
App42API.initializeWithAPIKey("API_KEY" andSecretKey:"SECRET_KEY")        
App42API.initialize("API_KEY","SECRET_KEY");
App42API.Initialize("API_KEY","SECRET_KEY");
App42.initialize("API_KEY","SECRET_KEY");
App42API:initialize("API_KEY","SECRET_KEY");
App42API::Initialize("API_KEY", "SECRET_KEY");
App42API.Initialize("API_KEY","SECRET_KEY");
App42API::initialize("API_KEY","SECRET_KEY"); 
App42API::Initialize("API_KEY", "SECRET_KEY");
api = App42::ServiceAPI.new("API_KEY","SECRET_KEY")   
App42API.initialize("API_KEY","SECRET_KEY");
Coming Soon
App42API.initialize("API_KEY","SECRET_KEY");
Build Service

After initialization, the developer will have to call the buildXXXService method on App42API to get the instance of the particular API that they wish to build. For example, to build an instance of EventService, buildEventService() method needs to be called.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
EventService eventService = App42API.buildEventService(); 
Coming Soon
EventService *eventService = [App42API buildEventService];
let eventService = App42API.buildEventService() as? EventService   
Not Available
EventService eventService = App42API.BuildEventService();  
var eventService  = new App42Event();
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Enable Event Service

You have to enable Event Service first in order to use it in the app using following statement.

Required Parameters

bool enable - Set True to Enable App42 Event/Analytics service.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
App42API.enableEventService(true);
Coming Soon
[App42API enableEventService:YES];
App42API.enableEventService(true) 
Not Available
App42API.EnableEventService(true);
App42.enableEventService(true);
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Enable App State Event Tracking

If you want to track app open/app close session, you have to enable it using following statement.

Required Parameters

bool enable - Set True to Enable App State (App Open/Close) Event Tracking.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
App42API.enableAppStateEventTracking(true);
Coming Soon
[App42API enableAppStateEventTracking:YES];
App42API.enableAppStateEventTracking(true) 
Not Available
App42API.EnableAppStateEventTracking(true);
App42.enableAppStateEventTracking(true)
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Start Activity

You can also track total time spend by user in completing specific activity/event. For example, you can track total/average time spend by app users in completing level x in your app. This can be achieved by putting API hook on start and end of level x in your game as shown in below snippet.

To start tracking the activity time, put following at the start of activity. For example, if user has started playing level X, you can pass name of activity as level X in method activityStrted.

Required Parameters

activityName - Name of event. properties - Properties of Event.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String activityName = "Level1";
JSONObject properties = new JSONObject ();
properties.put ("Name", "Level1");
properties.put ("State", "Started");
properties.put ("Score", 0);
properties.put ("Difficulty", "Easy");
properties.put ("IsCompletedSecretMission", false);
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
EventService eventService = App42API.buildEventService(); 
eventService.startActivity(activityName, properties, new App42CallBack() {
public void onSuccess(Object response) 
{
	App42Response app42Response = (App42Response) response;   
	System.out.println("App42Response Is : " + app42Response);
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});		
Coming Soon
NSString *activityName = @"Level1";
NSDictionary *properties = @{@"key": @"value"};
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
EventService *eventService = [App42API buildEventService];
[eventService startActivityWithName:activityName andProperties:properties completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
    if (success)
    {
        App42Response *response = (App42Response*)responseObj;
        NSLog(@"IsResponseSuccess is %d" , response.isResponseSuccess);
    }
    else
    {
        NSLog(@"Exception = %@",[exception reason]);
        NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
        NSLog(@"App Error Code = %d",[exception appErrorCode]);
        NSLog(@"User Info = %@",[exception userInfo]);
    }
}];
let activityName = "Level1"	
let properties = NSMutableDictionary(object:"Level1", forKey:"Name")
App42API.initializeWithAPIKey("API_KEY" andSecretKey:"SECRET_KEY")    
let eventService = App42API.buildEventService() as? EventService   
eventService?.startActivityWithName(activityName, andProperties:properties as [NSObject : AnyObject], completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let app42Response = response as! App42Response
		NSLog("App42Response is : %@", app42Response.strResponse)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
Not Available
String activityName = "Level1";
Dictionary<String,object> properties = new Dictionary<string, object> ();
properties.Add ("Name", "Level1");
properties.Add ("State", "Started");
properties.Add ("Score", 0);
properties.Add ("Difficulty", "Easy");
properties.Add ("IsCompletedSecretMission", false);
App42Log.SetDebug(true);		//Prints output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
EventService eventService = App42API.BuildEventService(); 
eventService.StartActivity(activityName, properties, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Response app42Response = (App42Response) response;   
		App42Log.Console("App42Response Is : " + app42Response);
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var activityName = "Level1";
var properties = {"Name":"Level1","State":"Started"};
App42.initialize("API_KEY","SECRET_KEY");
var eventService  = new App42Event();
eventService.startActivity(activityName, properties, {
	success: function (object) {
		var eventObj = JSON.parse(object)
		console.log("Success is :: " + eventObj);
	},
	error: function (error) {
		console.log("Exception is: " + error);
	}
});
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available 
Not Available
End Activity

At the finish of activity, use following to mark the finish. You have to pass same name of activity which was used to start.

Required Parameters

activityName - Name of event. properties - Properties.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String activityName = "Level1";
JSONObject properties = new JSONObject ();
properties.put ("Name", "Level1");
properties.put ("State", "Ended");
properties.put ("Score", 40000);
properties.put ("Difficulty", "Easy");
properties.put ("IsCompletedSecretMission", true);
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
EventService eventService = App42API.buildEventService(); 
eventService.endActivity(activityName, properties, new App42CallBack() {
public void onSuccess(Object response) 
{
	App42Response app42Response = (App42Response) response;   
	System.out.println("App42Response Is : " + app42Response);
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});		
Coming Soon
NSString *activityName = @"Level1";
NSDictionary *properties = @{@"key": @"value"};
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
EventService *eventService = [App42API buildEventService];
[eventService endActivityWithName:activityName andProperties:properties completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
    if (success)
    {
        App42Response *response = (App42Response*)responseObj;
        NSLog(@"IsResponseSuccess is %d" , response.isResponseSuccess);
    }
    else
    {
        NSLog(@"Exception = %@",[exception reason]);
        NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
        NSLog(@"App Error Code = %d",[exception appErrorCode]);
        NSLog(@"User Info = %@",[exception userInfo]);
    }
}];
let activityName = "Level1"	
let properties = NSMutableDictionary(object:"Level1", forKey:"Name")
App42API.initializeWithAPIKey("API_KEY" andSecretKey:"SECRET_KEY")    
let eventService = App42API.buildEventService() as? EventService   
eventService?.endActivityWithName(activityName, andProperties:properties as [NSObject : AnyObject], completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let app42Response = response as! App42Response
		NSLog("App42Response is : %@", app42Response.strResponse)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
Not Available
String activityName = "Level1";
Dictionary<String,object> properties = new Dictionary<string, object> ();
properties.Add ("Name", "Level1");
properties.Add ("State", "Ended");
properties.Add ("Score", 40000);
properties.Add ("Difficulty", "Easy");
properties.Add ("IsCompletedSecretMission", true);
App42Log.SetDebug(true);		//Prints output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
EventService eventService = App42API.BuildEventService(); 
eventService.EndActivity(activityName, properties, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Response app42Response = (App42Response) response;   
		App42Log.Console("App42Response Is : " + app42Response);
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var activityName = "Level1";
var properties = {"Name":"Level1","State":"Started"};
App42.initialize("API_KEY","SECRET_KEY");
var eventService  = new App42Event();
eventService.endActivity(activityName, properties, {
	success: function (object) {
		var eventObj = JSON.parse(object)
		console.log("Success is :: " + eventObj);
	},
	error: function (error) {
		console.log("Exception is: " + error);
	}
});
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available 
Not Available 
Track Event

Using App42 platform, one can track app events and analyze those events. At occurrence of an event(for example, the user clicked on a Add To Cart button inside your app), one can log events using trackEvent method available in Event Service as shown below.

Required Parameters

eventName - Name of event. properties - Properties.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String eventName = "Purchase";
JSONObject properties = new JSONObject ();
properties.put ("Name", "Nick");
properties.put ("Revenue", 5000);
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
EventService eventService = App42API.buildEventService(); 
eventService.trackEvent(eventName, properties, new App42CallBack() {
public void onSuccess(Object response) 
{
	App42Response app42Response = (App42Response) response;   
	System.out.println("App42Response Is : " + app42Response);
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});		
Coming Soon
NSString *eventName = @"Purchase";
NSDictionary *properties = @{@"key": @"value"};
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
EventService *eventService = [App42API buildEventService];
[eventService trackEventWithName:eventName andProperties:properties completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
    if (success)
    {
        App42Response *response = (App42Response*)responseObj;
        NSLog(@"IsResponseSuccess is %d" , response.isResponseSuccess);
    }
    else
    {
        NSLog(@"Exception = %@",[exception reason]);
        NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
        NSLog(@"App Error Code = %d",[exception appErrorCode]);
        NSLog(@"User Info = %@",[exception userInfo]);
    }
}];
let eventName = "Purchase"
let properties = NSMutableDictionary(object:"Nick", forKey:"Name")
App42API.initializeWithAPIKey("API_KEY" andSecretKey:"SECRET_KEY")    
let eventService = App42API.buildEventService() as? EventService   
eventService?.trackEventWithName(eventName, andProperties:properties as [NSObject : AnyObject], completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let app42Response = response as! App42Response
		NSLog("App42Response is : %@", app42Response.strResponse)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
Not Available
String eventName = "Purchase";
Dictionary<String,object> properties = new Dictionary<string, object> ();
properties.Add ("Name", "Nick");
properties.Add ("Revenue", 5000);
App42Log.SetDebug(true);		//Prints output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
EventService eventService = App42API.BuildEventService(); 
eventService.TrackEvent(eventName, properties, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Response app42Response = (App42Response) response;   
		App42Log.Console("App42Response Is : " + app42Response);
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var eventName = "Purchase"
var properties = {"key":"value"};
App42.initialize("API_KEY","SECRET_KEY");
var eventService  = new App42Event();
eventService.trackEvent(eventName, properties, {      
	success: function (object) {
		var eventObj = JSON.parse(object)
		console.log("Success is : " + eventObj);
	},
	error: function (error) {
		console.log("Exception is : " + error);
	}
});
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available 
Not Available 
Set Logged In User Properties

If you want to set user property that you want to track with your app events, use the following statement to set it.

Required Parameters

properties - Properties.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
JSONObject properties = new JSONObject ();
properties.put ("Plan", "Free");
properties.put ("Country", "India");
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
EventService eventService = App42API.buildEventService(); 
eventService.setLoggedInUserProperties(properties, new App42CallBack() {
public void onSuccess(Object response) 
{
	App42Response app42Response = (App42Response) response;   
	System.out.println("App42Response Is : " + app42Response);
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});		
Coming Soon
NSDictionary *properties = [NSDictionary dictionaryWithObjectsAndKeys:@"Free",@"UserType", nil];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
EventService *eventService = [App42API buildEventService];
[eventService setLoggedInUserProperties:properties completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
    if (success)
    {
        App42Response *response = (App42Response*)responseObj;
        NSLog(@"IsResponseSuccess is %d" , response.isResponseSuccess);
    }
    else
    {
        NSLog(@"Exception = %@",[exception reason]);
        NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
        NSLog(@"App Error Code = %d",[exception appErrorCode]);
        NSLog(@"User Info = %@",[exception userInfo]);
    }
}];
let properties = NSMutableDictionary(object:"Nick", forKey:"Name")
App42API.initializeWithAPIKey("API_KEY" andSecretKey:"SECRET_KEY")    
let eventService = App42API.buildEventService() as? EventService   
eventService?.setLoggedInUserProperties(properties as [NSObject : AnyObject], completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let app42Response = response as! App42Response
		NSLog("App42Response is : %@", app42Response.strResponse)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
Not Available
Dictionary<String,object> properties = new Dictionary<string, object> ();
properties.Add ("Plan", "Free");
properties.Add ("Country", "India");
App42Log.SetDebug(true);		//Prints output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
EventService eventService = App42API.BuildEventService(); 
eventService.SetLoggedInUserProperties(properties, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Response app42Response = (App42Response) response;   
		App42Log.Console("App42Response Is : " + app42Response);
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var properties = {"Plan":"Free"};
App42.initialize("API_KEY","SECRET_KEY");
var eventService  = new App42Event();
eventService.setLoggedInUserProperties(properties, {
	success: function (object) {
		var eventObj = JSON.parse(object)
		console.log("Success is : " + eventObj);
	},
	error: function (error) {
		console.log("Exception is : " + error);
	}
}); 
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available 
Not Available 
Update Logged In User Properties

You can update logged in user property using following snippet.

Required Parameters

properties - Properties.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
JSONObject properties = new JSONObject ();
properties.put ("Plan", "Paid");
properties.put ("Gender", "Male");
properties.put ("Age", 24);
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
EventService eventService = App42API.buildEventService(); 
eventService.updateLoggedInUserProperties(properties, new App42CallBack() {
public void onSuccess(Object response) 
{
	App42Response app42Response = (App42Response) response;   
	System.out.println("App42Response Is : " + app42Response);
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});		
Coming Soon
NSDictionary *properties = [NSDictionary dictionaryWithObjectsAndKeys:@"Premium",@"UserType",@"Admin",@"UserRole", nil];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
EventService *eventService = [App42API buildEventService];
[eventService updateLoggedInUserProperties:properties completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
    if (success)
    {
        App42Response *response = (App42Response*)responseObj;
        NSLog(@"isResponseSuccess is %d" , response.isResponseSuccess);
    }
    else
    {
        NSLog(@"Exception = %@",[exception reason]);
        NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
        NSLog(@"App Error Code = %d",[exception appErrorCode]);
        NSLog(@"User Info = %@",[exception userInfo]);
    }
}];
let properties = NSMutableDictionary(object:"John", forKey:"Name")
App42API.initializeWithAPIKey("API_KEY" andSecretKey:"SECRET_KEY")    
let eventService = App42API.buildEventService() as? EventService   
eventService?.updateLoggedInUserProperties(properties as [NSObject : AnyObject], completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let app42Response = response as! App42Response
		NSLog("App42Response is : %@", app42Response.strResponse)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
Not Available
Dictionary<String,object> properties = new Dictionary<string, object> ();
properties.Add ("Plan", "Paid");
properties.Add ("Gender", "Male");
properties.Add ("Age", 24);
App42Log.SetDebug(true);		//Prints output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
EventService eventService = App42API.BuildEventService(); 
eventService.UpdateLoggedInUserProperties(properties, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Response app42Response = (App42Response) response;   
		App42Log.Console("App42Response Is : " + app42Response);
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var properties = {"Plan":"Free",  "Gender":"Male"};
App42.initialize("API_KEY","SECRET_KEY");
var eventService  = new App42Event();
eventService.updateLoggedInUserProperties(properties, {
	success: function (object) {
		var eventObj = JSON.parse(object)
		console.log("Success is : " + eventObj);
	},
	error: function (error) {
		console.log("Exception is : " + error);
	}
}); 
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available 
Not Available 
Exception Handling

The functions available under Event API can throw some exceptions in abnormal conditions. For example, if a developer has not set the properties is trying to update the current loggedIn user properties, the function will throw an App42Exception (as shown below) with the message as “Bad Request” and the appErrorCode as “1600” and the details as “The Request parameters are invalid. The parameter ‘app42_userUpdatedOn’ cannot be null or empty.”

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
 
JSONObject properties = new JSONObject ();
properties.put ("Plan", "Paid");
properties.put ("Gender", "Male");
properties.put ("Age", 24);
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
EventService eventService = App42API.buildEventService(); 
eventService.updateLoggedInUserProperties(properties, new App42CallBack() {
public void onSuccess(Object response) 
{
	App42Response app42Response = (App42Response) response;   
	System.out.println("App42Response Is : " + app42Response);
}
public void onException(Exception ex) 
{
	App42Exception exception = (App42Exception)ex;
	int appErrorCode = exception.getAppErrorCode();
	int httpErrorCode = exception.getHttpErrorCode();
	if(appErrorCode == 1600)
	{
	// Handle here for Bad Request (The Request parameters are invalid. The parameter 'app42_userUpdatedOn' cannot be null or empty.)
	}
	else if(appErrorCode == 1401)
	{
	// handle here for Client is not authorized
	}
	else if(appErrorCode == 1500)
	{
	// handle here for Internal Server Error
	}
	String jsonText = exception.getMessage(); 
}                         	   
});                        
Coming Soon
					
NSDictionary *properties = [NSDictionary dictionaryWithObjectsAndKeys:@"Premium",@"UserType",@"Admin",@"UserRole", nil];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
EventService *eventService = [App42API buildEventService];
[eventService updateLoggedInUserProperties:properties completionBlock:^(BOOL success, id responseObj, App42Exception *exception)  
{
	if (success)
	{
		App42Response *response = (App42Response*)responseObj;	
		NSLog(@"IsResponseSuccess = %d",response.isResponseSuccess);
	}
	else
	{
		int appErrorCode = exception.appErrorCode;
		int httpErrorCode = exception.httpErrorCode;
		if(appErrorCode == 1600)
		{
			// Handle here for Bad Request (The Request parameters are invalid. The parameter 'app42_userUpdatedOn' cannot be null or empty.)
		}
		else if(appErrorCode == 1401){
			// handle here for Client is not authorized
		}
		else if(appErrorCode == 1500){
			// handle here for Internal Server Error
		}
		NSString *jsonText = exception.reason; 	
	}  
}];
coming soon
Not Available   
Dictionary<String,object> properties = new Dictionary<string, object> ();
properties.Add ("Plan", "Paid");
properties.Add ("Gender", "Male");
properties.Add ("Age", 24);
App42Log.SetDebug(true);		//Prints output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
EventService eventService = App42API.BuildEventService(); 
eventService.UpdateLoggedInUserProperties(properties, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnException(Exception e)
	{  
	    App42Exception exception = (App42Exception)e;
		int appErrorCode = exception.GetAppErrorCode();
		int httpErrorCode = exception.GetHttpErrorCode();
		if(appErrorCode == 1600)
		{
			// Handle here for Bad Request (The Request parameters are invalid. The parameter 'app42_userUpdatedOn' cannot be null or empty.)
		}
		else if(appErrorCode == 1401)
		{
			// handle here for Client is not authorized
		}
		else if(appErrorCode == 1500)
		{
			// handle here for Internal Server Error
		}
		String jsonText = exception.GetMessage(); 
	} 
	
	public void OnSuccess(object response)
	{
		App42Response app42Response = (App42Response) response;   
		App42Log.Console("App42Response Is : " + app42Response);
	}
}   
var properties = {"Plan":"Free", "Gender":"Male"};
App42.initialize("API_KEY","SECRET_KEY");
var eventService  = new App42Event();
eventService.updateLoggedInUserProperties(properties, {
    success: function(object) {
    },
    error: function(error) 
    {
        var eventObj = JSON.parse(object);  
        appErrorCode = eventObj.app42Fault.appErrorCode;
        if(appErrorCode == 1600)
		{
			// Handle here for Bad Request (The Request parameters are invalid. The parameter 'app42_userUpdatedOn' cannot be null or empty.)
		}
		else if(appErrorCode == 1401)
        {
            // handle here for Client is not authorized
        }
        else if(appErrorCode == 1500)
        {
            // handle here for Internal Server Error
        }
    }
});
Not Available
Not Available
Not Available       
Not Available
Not Available
Not Available
Not Available
Not Available
Not Available
Error Codes

Functions in Achievement API might throw exceptions with following HTTP and Application Error Codes (along with their descriptions):

1400 - BAD REQUEST - The requested parameters are invalid. 1401 - UNAUTHORIZED - The client is not authorized. 1500 - INTERNAL SERVER ERROR - Internal Server Error. Please try again. 1600 - BAD REQUEST - The Request parameters are invalid. The parameter 'app42_userUpdatedOn' cannot be null or empty.