Sign In Register

How can we help you today?

Start a new topic
Answered

Creating and Querying Basic Analytics

I have started to hookup basic analytics for our game and my thought was start basic and work my way up from there so here is a snippet that records a key/value pair:

public void RecordAnalytic(string key, string value)
    {

        GSRequestData data = new GSRequestData();
        data.AddString("value", value);

        new AnalyticsRequest()
            .SetKey(key)
            .SetData(data)
            .Send((response =>
            {
                if(!response.HasErrors)
                {
                    Debug.Log(string.Format("Analytic Recorded - Key:{0} Value:{1}", key, value));
                }
                else
                {
                    Debug.Log(string.Format("Failed Recording Analytic - Key:{0} Value:{1}", key, value));
                }
            }));
    }

  It looks like it recorded it as here is my Request/Response:


GS: SEND:{"@class":".AnalyticsRequest","key":"MovesUsed","data":{"value":"26"},"requestId":"635540848857508858_150"}

GS: RECV:{"@class":".AnalyticsResponse","requestId":"635540848857508858_150","scriptData":null}


Looked at the NoSQL and Analytics interface for about 30 minutes trying to find a way to get this data back out and I seem to be at a loss.  Full disclosure, I have a relational database background so NoSQL concepts are a bit new to me, but what is the best way to get this up on my custom analytics dashboard and query it in the NoSQL interface?


Bonus Question:


Would it be easier/more efficient to send all of the data in one GSRequestData JSON object that I wanted to record at once instead of sending key/value pairs one at a time?


Best Answer

Im going to copy in an answer from a ticket i received recently describing how to access this data...


So that additional data is not directly accessible through NoSQL.
You will need to build a custom chart to view it.

You can see that charts tab to the right of 'Screens' and 'Snippets' tab...



When you go to edit the code of the chart you will get some query options instead of the fields for html and javascrip you would get from a normal snippet. If you select @type you will see your available analytics keys to the right.



Then click on the 'filter' button and you should see your data options available...



You can customize your chart and hit 'Test' so see the data for that key...



In my case ive only got one element with a count of 1, so i'll do more tests so i can show you more data tomorrow, but this should get you going.

Let me know if that works


Sean

 


2 people have this question

Hey Matt,

Have you tried testing the Analytics in the test harness. Generally they should update every 10 minutes. So if you can try it in the test harness when you get a chance and see if it works from there we can see if the fault lies with the system or with the code.

Let me know how you get on,
Jamie.

 

So I tried using just the Test Harness with pretty much the same results.  Here was my request in JSON:

{
 "@class": ".AnalyticsRequest",
 "data": {"value": "1"},
 "end": true,
 "key": "MovesUsed",
 "start": true,
}

 

And here is my test harness response back:

{
 "@class": ".AnalyticsResponse",
 "scriptData": null
}

 

Waited 10 minutes and didn't see anything in my custom analytics nor was I able to find anything in the NoSQL database.  I'm probably just missing some concept here.  Any help would be appreciated!


Thanks,


Matt


Hey Matt,

If you click the dashboard in Analytics you can create a chart configuration for your game which defines how it shows in the custom tab.

If you create one it should start to show up in the custom tab pretty much straight away now.

Edit: Just make sure to choose custom analytic from the type drop down.
Jamie

 

This is what I see:



Where would I go from here to create a chart configuration?

Also, is there a way to query it in the NoSQL interface?


Thanks Jamie!


Matt

Bump!

Matt, did you resolved this problem?

Lukasz,


I have it recording the analytics now, but for some reason the string value that I'm passing in is not saving.  I have attached the NoSQL query in a screenshot:




Thoughts?


Matt

Answer

Im going to copy in an answer from a ticket i received recently describing how to access this data...


So that additional data is not directly accessible through NoSQL.
You will need to build a custom chart to view it.

You can see that charts tab to the right of 'Screens' and 'Snippets' tab...



When you go to edit the code of the chart you will get some query options instead of the fields for html and javascrip you would get from a normal snippet. If you select @type you will see your available analytics keys to the right.



Then click on the 'filter' button and you should see your data options available...



You can customize your chart and hit 'Test' so see the data for that key...



In my case ive only got one element with a count of 1, so i'll do more tests so i can show you more data tomorrow, but this should get you going.

Let me know if that works


Sean

 

Hi, What if I don't want the count of requests but the value of the data I'm sending?

 


1 person likes this
Login to post a comment