The YouTube Subscribe Button lets you add a Subscribe button to any page. The button links to a YouTube channel. Upon clicking the button, the YouTube channel page opens in a new window so that the user can confirm the subscription.

To add a button, your application needs to load this JavaScript file:


You can then add a button by using an element, such as a <div>, that sets its class to g-ytsubscribe and uses other attributes to customize the button. The following code shows a simple integration that displays a Subscribe button for the GoogleDevelopers channel.

<script src="https://apis.google.com/js/platform.js"></script>
<div class="g-ytsubscribe" data-channel="GoogleDevelopers"></div>

You can also use the Google+ JavaScript API to render a button dynamically.

Configuration options

The buttons below show different layout and configuration options for subscription buttons. Buttons for standard channels are shown with and without subscriber counts.

The button language defaults to the user's language settings or is set based on the user's location for logged-out users.

Standard channels