question

corporate avatar image
corporate asked

Incrementing statistics from PlayStream events doesn't seem to work?

Hi there -

I just started experimenting with PlayStream events - loved the functionality, but seem to be running into issues incrementing statistics? In the example in the screenshot, the "player_watched_ad" event correctly fires in the PlayStream following this call in Unity:

PlayFab.PlayFabClientAPI.WritePlayerEvent(new PlayFab.ClientModels.WriteClientPlayerEventRequest { EventName = "player_watched_ad" }, null, null);

However, even though the rule is set up and the event fires, the "totalsAdsWatched" statistic doesn't get incremented. What am I doing wrong?

Leaderboards and StatisticsPlayStream
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
pfnathan avatar image
pfnathan answered

You would need to change your namespace on your “custom event name” to;

EventName = “title.YourTitleID.Player_watched_ad”

PlayFab.PlayFabClientAPI.WritePlayerEvent(new PlayFab.ClientModels.WriteClientPlayerEventRequest { EventName = "player_watched_ad" }, null, null);

Add " title.TitleID.Player_watched_ad" on Rule in the Automation

Apologies for inconveniences, our tutorial on this link https://api.playfab.com/docs/tutorials/custom-events did not get updated correctly.

3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

corporate avatar image corporate commented ·

Thanks! But it then returns the following error:

Field contains invalid characters. Allowable values are ASCII alphanumeric and underscore characters.
0 Likes 0 ·
corporate avatar image corporate commented ·

I fixed it! It seems I did not need to add title.12345 to the code calling the event (as it was anyway included in the JSON data) but I did need to add it to the rule under the Automation section.

0 Likes 0 ·
pfnathan avatar image pfnathan ♦ commented ·

You are correct, thanks for catching this and apologies for somewhat not clear on the guide. You do not need to put TitleID in the write. As you have mentioned, however, you do need to put it in the evaluation of the event. (Automation/Rule)

thank you.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.