Records some custom analytical data.

Simple analytics, where you just need to track the number of times something happened, just take a key parameter. We'll record the players id against the data to allow you to report on averages per user

Timed analytics allow you to send start and end timer requests, and with this data GameSparks can track the length of time something takes.

If an end request is sent without a matching start timer the request will fail silently and your analytics data might not contain what you expect.

If both start and end are supplied, the request will be treated as a start timer.

An additional data payload can be attached to the event for advanced reporting. This data can be a string, number or JSON object.

If a second start timer is created using a key that has already had a start timer created without an end, the previous one will be marked as abandoned.

View interactive version here

Request Parameters

Parameter Required Type Description
data No JSON Custom data payload
end No boolean Use the value true to indicate it's an end timer
key No string The key you want to track this analysis with.
language No string The player's language
start No boolean Use the value true to indicate it's a start timer

Response Parameters

A response to an analytics request

Parameter Type Description
scriptData ScriptData A JSON Map of any data added either to the Request or the Response by your Cloud Code

Nested types


A collection of arbitrary data that can be added to a message via a Cloud Code script.

Parameter Type Description
myKey string An arbitrary data key
myValue JSON An arbitrary data value.

Code Samples


    using GameSparks.Api;
    using GameSparks.Api.Requests;
    using GameSparks.Api.Responses;
    new AnalyticsRequest()
        .Send((response) => {
        GSData scriptData = response.ScriptData;

ActionScript 3

    import com.gamesparks.*;
    import com.gamesparks.api.requests.*;
    import com.gamesparks.api.responses.*;
    import com.gamesparks.api.types.*;

        .send(function(response:com.gamesparks.api.responses.AnalyticsResponse):void {
        var scriptData:ScriptData = response.getScriptData(); 


    #import "GS.h"
    #import "GSAPI.h"
    GSAnalyticsRequest* request = [[GSAnalyticsRequest alloc] init];
    [request setData:data;
    [request setEnd:end;
    [request setKey:key;
    [request setLanguage:language;
    [request setStart:start;
    [request setCallback:^ (GSAnalyticsResponse* response) {
    NSDictionary* scriptData = [response getScriptData]; 
    [gs send:request];


    #include <GameSparks/generated/GSRequests.h>
    using namespace GameSparks::Core;
    using namespace GameSparks::Api::Responses;
    using namespace GameSparks::Api::Requests;

    void AnalyticsRequest_Response(GS& gsInstance, const AnalyticsResponse& response) {
    GSData scriptData = response.getScriptData(); 

    AnalyticsRequest request(gsInstance);


import com.gamesparks.sdk.api.autogen.GSRequestBuilder.AnalyticsRequest;
import com.gamesparks.sdk.api.autogen.GSResponseBuilder.AnalyticsResponse;
import com.gamesparks.sdk.api.autogen.GSTypes.*;
import com.gamesparks.sdk.api.GSEventListener;

    .send(new GSEventListener<AnalyticsResponse>() {
        public void onEvent(AnalyticsResponse response) {

Cloud Code

    var request = new SparkRequests.AnalyticsRequest(); = ...;
    request.end = ...;
    request.key = ...;
    request.language = ...;
    request.start = ...;
    var response = request.Send();

var scriptData = response.scriptData;