question

John Peterson avatar image
John Peterson asked

Remove a tag from all users?

Dear PlayFab community,

I'm writing to learn if it's possible to easily remove a specified Tag from *all* players for a Title? We're using Tags to store some statistics/leaderboard metadata, and would like to update/refresh those Tags when the leaderboard gets reset.

Thanks for any help anyone cann provide!

Leaderboards and Statistics
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

·
Hernando avatar image
Hernando answered

If you configured leaderboard to reset on a pre-determined interval, you could create a Scheduled Task to execute functions(remove tags from the player by calling RemovePlayerTag) in CloudScript for all players at the same frequency.

If not, I recommend you to run the scheduled task manually in the Game Manager. Or build a new Segment and setup it to execute these functions when the Statistic value of the current player is equal to 0 (Entered segment). But you need to pay attention to the players whose statistic values have never updated.

Besides, if you reset leaderboard by calling Admin API, you could set up Scheduled Task and call Admin-RunTask to run it when refreshing statistic in the same context.

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

John Peterson avatar image John Peterson commented ·

Thanks @Hernando! I'm not even sure how I would go about removing Tags for all players as you suggest. Is there a CloudScript snippet you can point me to or share?

The Segment idea is interesting to me. Is it the kind of thing that everyone who qualifies in the Segment would then potentially have a CloudScript function executed against them?

Thanks for any clarification you can provide!

0 Likes 0 ·
Hernando avatar image Hernando John Peterson commented ·

Segment run action only when the player enters or leaves the segment. More information see this: https://api.playfab.com/docs/tutorials/landing-players/segments/segment-config

Configuring of the Segment you can refer to this:

CloudScript will be simple, you can write it base on this:

handlers.removeTagAfterResetLeaderBoard = function (args, context) {
    server.RemovePlayerTag({ PlayFabId: context.playerProfile.PlayerId, TagName: "yourTagName" });
};
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.