Sign In Register

How can we help you today?

Start a new topic
Answered

How can I set event attributes in a Realtime call to createLogEventRequest ?

Hi,


How can I set my event attributes when I call RTSession.newRequest().createLogEventRequest() in a Realtime script ?


I have tried to use the setScriptData function but it does not work. In the Unity GameSpark SDK there is a "SetEventAttribute" method but not in the back end.

 

Thanks


Best Answer

Hi Regis,


Apologies for the delayed response. You can check the example below for how to do this.


  

var request = RTSession.newRequest().createLogEventRequest();
request.setEventKey(...);
request.attributeShortCode (); //use the shortCode from the configured event.
request.setPlayerId(...);
request.send(function(response){
    var scriptData = response.scriptData; 
}); 

  

Regards,

Liam


Answer

Hi Regis,


Apologies for the delayed response. You can check the example below for how to do this.


  

var request = RTSession.newRequest().createLogEventRequest();
request.setEventKey(...);
request.attributeShortCode (); //use the shortCode from the configured event.
request.setPlayerId(...);
request.send(function(response){
    var scriptData = response.scriptData; 
}); 

  

Regards,

Liam

The correct answer would be to use setAttributeName. If you have an attribute called 'myAttribute', you would use request.setMyAttribute, the first letter will always be taken in as a lowercase so it doesnt matter if you use setmyAttribute or setMyAttribute. There is an example of it here. https://docs.gamesparks.com/tutorials/real-time-services/calling-log-event-requests-in-rt-scripts.html

This is perhaps the least helpful response from a developer that I've ever seen.

Login to post a comment