pull-icon
logo-mobile

Embedding Chat on your website (Member sites)

Home/Forums/Embedding Chat on your website (Member sites)

Bronze Member
Bronze Member

EmmaS

yesterday

Adding SCS chatroom to your website is quick and simple.
All you need to do is copy the embed code from your dashboard and place it where you want the chat to appear.

<div id="scs-chat"></div>
<script>
window.SCS_CHAT = {
key: "YOUR-CHAT-KEY",
room: "lobby",
username: "Username",
title: "Lobby"
};
</script>
<script src="https://chat.streamcodestudio.com/embed.js"></script>

What each option does:
key
Your unique chat key (shown in the SCS dashboard). This authorises your website.
room
The room name users will join (for example: lobby, support, dj-chat).
username
The display name shown in chat.
title
An optional title shown at the top of the chatroom.

Using your website’s member system
If your website already has user accounts, you can dynamically pass the logged-in username to SCS Chat.
For example, instead of a fixed username:
username: "Username",
You can use your site’s login variable:
username: "<?php echo $logged_in_username; ?>",
This ensures users appear in chat using the same name they use on your website.

Using multiple chat rooms (recommended)
If you want more than one chatroom (for example: Lobby, Support, DJ Chat, General Chat, etc), the easiest way is to store rooms in your database and load them dynamically.

Example chat_rooms table:
CREATE TABLE `chat_rooms` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(100) NOT NULL,
  `slug` VARCHAR(60) NOT NULL,
  `topic` VARCHAR(255) DEFAULT NULL,
  `category` VARCHAR(50) DEFAULT NULL,
  `sort_order` INT NOT NULL DEFAULT 0,
  `is_official` TINYINT(1) NOT NULL DEFAULT 0,
  `is_private` TINYINT(1) NOT NULL DEFAULT 0,
  `owner_id` INT UNSIGNED NOT NULL,
  `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,

  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_slug` (`slug`),
  KEY `idx_category` (`category`),
  KEY `idx_sort` (`sort_order`)
) ENGINE=InnoDB
  DEFAULT CHARSET=utf8mb4
  COLLATE=utf8mb4_0900_ai_ci;

Using database values in the embed code
If you load a room from the database, you can pass its values directly into the chat configuration:
room: "<?php echo $slug; ?>",
title: "<?php echo $name; ?>",

This allows you to:
generate chatrooms dynamically
link rooms to categories or pages
control visibility (public / private rooms)
reuse the same embed code across your site

If you don’t need multiple rooms, you can:
use one embed
keep the room name fixed (for example lobby) and just echo the logged in user.

SCS Chat will handle everything else automatically.

Leave a Comment

You must be logged in to post a reply.

Thank you ??

Thanks for supporting this station!

We've sent a download link to your email {}
Please check your inbox (and spam folder just in case).
The link will be valid for 24 hours.



BellOnline offers fast, reliable UK hosting with strong security and excellent uptime - perfect for modern radio and web projects.
MixStream provides broadcast-grade streaming with crystal-clear audio and rock-solid stability, ideal for both hobby and professional stations.

Goto BellOnline Now!

Close