Tracking viewers - approaches, cons and pros

Hi!

I’m interested in doing app. That app will require to track user if they watch stream. First I had idea that I will be pinging API to check current viewers of specific channel (by TwitchID or something) and compare if they were there 5 minutes ago. If so - cool, green for that. If they are gone, meaning stopped watching.

So I was pretty sure it will work without a fuss but then I’ve started doing API research and now I know it is not simple.

So I wonder about different approaches.

  1. is tracking with IRC users - I can current chat users. Works pretty well if I do not spam endpoint and if there are not thousands of users.
  2. there’s also JOIN/PARTS but they also throttled
  3. ??

I understand that Twitch does not want external app to track users without their permission, I’m fine with that.
Is there then a way to have this ‘properly’ done once they ‘ack’ my app on twitch site?

I guess it would not work for twitch app then thou, right?

Let’s say there’s app that track my presence on Twitch channel, I’m watching Twitch sometimes on browser on PC, sometimes on ipad. Sometimes chat on, sometimes off. But I want this app to see me that I’m there. I allow that app to do that. Is this possible anyhow? (bonus points if that app will still know me even if I change username in Twitch)

It’s not possible to know what streams a user is viewing. The closest you can get is knowing if a user is in chat for a specific channel using the Get Chatters endpoint, which requires the broadcaster or a mod connecting to your app with the appropriate scopes..

Using joins/parts is also not viable as if there’s more than 1,000 users on a channel Twitch simply stops sending joins/parts.

The downsides you will find is that it’s impossible to know if the user is actually watching a stream, or just has a chat app open, or if they actually are watching the stream but for whatever reason don’t have chat (it could be closed, on mobile or a console app, or a Twitch embed without chat). As for the legal downsides of tracking, you should consult a legal expert as to what legal restrictions or obligations there may be.

1 Like

Yeah, I meant to see for specific channel after asking for appropriate scopes. I need yet to understand stuff, but I’m kind of familiar with other marketplaces, especially with Atlassian for over 6 yuears doing apps there. So I understand scopes and more.
Anyway, so is this endpoint chatters - I get all chatters, there is no throttling like I can get only 1k of them right?
I see proper pagination there. Everything seems like it does. So no need to use IRC. Great

This endpoint seems like everything I need if it is not throttled at all

You can get up to 1000 users per page, and then use the cursor provided to get the next page, and keep going until there are no more pages.

Twitch does have a Rate Limit, https://dev.twitch.tv/docs/api/guide/#twitch-rate-limits, which is a default of 800 requests per minute, so for your use case should not be an issue. One thing to keep in mind is that all API endpoints use caching so there’s no point requesting the same data more frequently than once per minute.

1 Like