概要
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
YouTube Subscribe Button を使用すると、任意のページに Subscribe
ボタンを追加できます。ボタンは YouTube チャンネルにリンクしています。ボタンをクリックすると、YouTube チャンネル ページが新しいウィンドウで開き、ユーザーは登録を確認できます。
ボタンを追加するには、アプリケーション側でこの JavaScript ファイルを読み込む必要があります。
https://apis.google.com/js/platform.js
次に、<div>
などの要素を使用してボタンを追加します。この要素では、class
を g-ytsubscribe
に設定し、他の属性を使用してボタンをカスタマイズします。次のコードは、GoogleDevelopers チャンネルの Subscribe
ボタンを表示する簡単な統合を示しています。
<script src="https://apis.google.com/js/platform.js"></script>
<div class="g-ytsubscribe" data-channel="GoogleDevelopers"></div>
このほか、ボタンを動的にレンダリングする場合は、Google+ JavaScript API を使用します。
設定オプション
下記にチャンネル登録ボタンの各種レイアウトおよび設定オプションを示します。標準チャンネルのボタンは、チャンネル登録者数が表示されている場合と表示されていない場合の両方で表示されます。
ボタンの言語はユーザーの言語設定がデフォルトとなります。ログインしていないユーザーについては、そのユーザーの地域に基づいて設定されます。
標準チャンネル
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-21 UTC。
[null,null,["最終更新日 2025-08-21 UTC。"],[],[],null,["# Overview\n\nThe 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.\n\nTo add a button, your application needs to load this JavaScript file: \n\n```\nhttps://apis.google.com/js/platform.js\n```\n\nYou can then add a button by using an element, such as a `\u003cdiv\u003e`, 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. \n\n```\n\u003cscript src=\"https://apis.google.com/js/platform.js\"\u003e\u003c/script\u003e\n\u003cdiv class=\"g-ytsubscribe\" data-channel=\"GoogleDevelopers\"\u003e\u003c/div\u003e\n```\n\nYou can also use the [Google+ JavaScript API](/+/web/api/javascript) to render a button dynamically.\n\nConfiguration options\n---------------------\n\nThe buttons below show different layout and configuration options for subscription buttons. Buttons for standard channels are shown with and without subscriber counts.\n\nThe button language defaults to the user's language settings or is set based on the user's location for logged-out users.\n\n### Standard channels\n\n| Buttons ||\n|-------------------------------|---|\n| Default button | |\n| Default button | |\n| Full layout (includes avatar) | |\n| Full layout (includes avatar) | |\n| Full layout, dark theme | |\n| Full layout, dark theme | |"]]