# Website viewer count embedding with new API

**URL:** <https://discuss.dev.twitch.com/t/website-viewer-count-embedding-with-new-api/9533>\
**Category:** API\
**Created:** [March 6, 2017, 5:20am UTC](https://discuss.dev.twitch.com/t/website-viewer-count-embedding-with-new-api/9533 "2017-03-06T05:20:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![crustyho](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/crustyho/32/2586_2.png) [@crustyho](https://discuss.dev.twitch.com/u/crustyho)\
**Post date:** [March 6, 2017, 5:20am UTC](https://discuss.dev.twitch.com/t/website-viewer-count-embedding-with-new-api/9533/1 "2017-03-06T05:20:11Z")

</div>

API change seems to have broke my viewer count embedding, any easy way to embed stream viewer count on a webpage? Anyone could mock up some some html for me, or an example would be appreciated!

---

<div class="post-metadata">

**Author:** ![3ventic](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/3ventic/32/298_2.png) [@3ventic](https://discuss.dev.twitch.com/u/3ventic)\
**Post date:** [March 6, 2017, 5:56am UTC](https://discuss.dev.twitch.com/t/website-viewer-count-embedding-with-new-api/9533/2 "2017-03-06T05:56:29Z")

</div>

This isn’t a coding service and you seem to have existing code that used to work. We can tell you what’s wrong with it. The only breaking change has been requiring client id, but that was months ago.

---

<div class="post-metadata">

**Author:** ![crustyho](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/crustyho/32/2586_2.png) [@crustyho](https://discuss.dev.twitch.com/u/crustyho)\
**Post date:** [March 6, 2017, 6:01am UTC](https://discuss.dev.twitch.com/t/website-viewer-count-embedding-with-new-api/9533/3 "2017-03-06T06:01:10Z")

</div>

In the amount of text you replied with you could have probably wrote a simple html code. If it was already covered in a wiki or somewhere else I wouldn’t have even bothered to ask, I was the original person to even ask about the code in the first place, and I do appreciate help that I originally got, just figured things like that might have gotten easier with a change of API.

---

<div class="post-metadata">

**Author:** ![3ventic](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/3ventic/32/298_2.png) [@3ventic](https://discuss.dev.twitch.com/u/3ventic)\
**Post date:** [March 6, 2017, 12:34pm UTC](https://discuss.dev.twitch.com/t/website-viewer-count-embedding-with-new-api/9533/4 "2017-03-06T12:34:01Z")

</div>

Give a man a fish and he’ll be covered for a day… Teach a man to fish and he’ll be covered for the rest of his life. Besides, I’m not going to be writing code on Android keyboard.

---

<div class="post-metadata">

**Author:** ![crustyho](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/crustyho/32/2586_2.png) [@crustyho](https://discuss.dev.twitch.com/u/crustyho)\
**Post date:** [March 6, 2017, 5:43pm UTC](https://discuss.dev.twitch.com/t/website-viewer-count-embedding-with-new-api/9533/5 "2017-03-06T17:43:42Z")

</div>

Give a man a smartphone and he’ll blab all day without being useful. Being as how I’m asking for a code it would mean I would have basic understanding of html, however I don’t with json, java, css, python, xml, and the millions of other sub-coding that goes along with making a webpage, all I needed was a simple basic short response, but instead we go back and forth about who should know what. This is exactly why some people just give up instead of actually doing something, rude useless people, instead of short concise answers. A topic of 200 replies of ass clowns with no useful information, and really what was the point, when sometimes things could be as simple as 1 short reply that takes a lot less typing, and actual thought. Tell you what I’ll look into it some more, and if I actually get a piece of code working for me i’ll leave it for others to use without spending 1/2 a day learning something you’ll forget anyways because you’re trying to do something simple that should only take 5 minutes.

---

<div class="post-metadata">

**Author:** ![3ventic](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/3ventic/32/298_2.png) [@3ventic](https://discuss.dev.twitch.com/u/3ventic)\
**Post date:** [March 6, 2017, 5:56pm UTC](https://discuss.dev.twitch.com/t/website-viewer-count-embedding-with-new-api/9533/6 "2017-03-06T17:56:38Z")

</div>

```auto
esl_csgo has <span id="viewers"></span> viewers
<script>
var ve = document.getElementById('viewers');
setInterval(_ => {
    fetch('https://api.twitch.tv/kraken/streams/31239503', {
        headers: new Headers({
            'Client-Id': '',
            'Accept': 'application/vnd.twitchtv.v5+json'
        })
    }).then(response => response.json()).then(data => {
        ve.textContent = data.stream.viewers;
    });
}, 10000);
</script>

```

For reference only, now that I’m at a computer.

---

<div class="post-metadata">

**Author:** ![crustyho](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/crustyho/32/2586_2.png) [@crustyho](https://discuss.dev.twitch.com/u/crustyho)\
**Post date:** [March 6, 2017, 6:05pm UTC](https://discuss.dev.twitch.com/t/website-viewer-count-embedding-with-new-api/9533/7 "2017-03-06T18:05:02Z")

</div>

Thanks exactly what I need, i’ll figure out the rest!

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [April 5, 2017, 6:05pm UTC](https://discuss.dev.twitch.com/t/website-viewer-count-embedding-with-new-api/9533/8 "2017-04-05T18:05:10Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
