question

Daxay avatar image
Daxay asked

Access treatment variables of player in cloudscript

I want to access all variables assigned using Experiments feature of playfab to player in cloudscript.


Is there any way?

CloudScript
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

·
Seth Du avatar image
Seth Du answered

You may monitor the TreatmentAssignment property in the callback result of any login API.

In addition, according to the documentation, any APIs that includes ProfileConstraints configuration in the request will be able to retrieve Experiments variables. For example in GetPlayerProfile API, you may call it in the Cloud Script via:

{ 
"PlayFabId": xxxxxx", 
  "ProfileConstraints":{ 
  "ShowExperimentVariants": true  

  }
}

Please feel free to tell us if you have any questions on the usage.

4 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.

Daxay avatar image Daxay commented ·
@SethDu

Thanks for the help.
I know about the TreatmentAssignment property in login API.

Yes you are right about the experiment variants, they are presents in GetPlayerProfile API.


But i want all the experiment variables that not the variants.
Just like TreatmentAssignement.Variables.

So is there any way to access them in cloudscript?

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Daxay commented ·

Since there is no documentation, here is my solution. You will need to get the Variant ID from the GetPlayerProfile or GetProfile API, then call GetExperiments API and find corresponding variables according to VariantID.

0 Likes 0 ·
Daxay avatar image Daxay Seth Du ♦ commented ·

Yes, thought so.
all of the Experiments variables using this API GetTreatmentAssignment.
Both of these APIS requires entity token.
how should i fetch that token in cloudscript?

0 Likes 0 ·
Show more comments

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.