Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • API and SDK Questions /
avatar image
Question by Michael · Apr 21, 2020 at 02:11 AM · CloudScriptPlayStreamscheduled tasks

Get Player Count In Segment From Cloud Script

I'm wanting to adjust one of my internal title data parameters using a scheduled task to trigger a cloud script function that references the amount of players in a segment (at this point, a count of the players who have logged in over the past 7 days).

This does seem overall possible, though from what I can see only by using the "Get Players In Segment" call that pulls down far more player data than I need and has some API limitations on it.

All I want is the total count of the players in that segment, not their data. Is there a way to do this with a single call (so I don't have to cycle through all of the player data just to count) or perhaps a better way to accomplish this? I'd like to avoid running my own azure instance to cover this.

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Brendan · Apr 21, 2020 at 02:37 AM

If all you want is the count, just call GetPlayersInSegment with MaxBatchSize set to 1. That'll minimize the amount of data returned. And you don't have to use the continuation token at all. In the response you get back, the ProfilesInSegment value is specifically the total number of players in the segment.

Please note that segment evaluation (which is triggered by this call) is very CPU intensive, so you do want to make sure not to call this too frequently. If you're thinking of more than once per hour, we should probably talk through your use case in more detail. And, of course, this should never be triggered from a user action.

Comment
Michael
Element808

People who like this

2 Show 1 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Michael · Apr 21, 2020 at 02:40 AM 0
Share

That'll work perfectly, I only plan to run this once a week so frequent calls won't be a problem. Thanks

avatar image

Answer by Pipeworks Truman · Aug 31, 2020 at 02:21 AM

Can I call this endpoint 12 times in one scheduled task, set to run every hour?

Comment

People who like this

0 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    2 People are following this question.

    avatar image avatar image

    Related Questions

    What is the execution time limit for a Cloud Script function called From a Task? 1 Answer

    CloudScript: How can I mark suspicious players? 1 Answer

    How to Subtract certain amount of virtual currency from all the players by using segment and automation of schedule task,How to Subtract certain amount of virtual currency from all the players ? 1 Answer

    Cloud Script Logs - Server/Events Only (don't send to client) 1 Answer

    Title exceeded limit when I want to grant leaderboard rewards 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges