カスタマイズ
連携
Googleアナリティクス
仕様
パラメーター名 | 型 | 値 | 設定 | デフォルト値 |
---|---|---|---|---|
ga | object | category,label | 任意 | - |
説明
Googleアナリティクスにビデオグプレイヤーの視聴データを送信するか設定します。ga{}
と設定すると、デフォルト値で視聴データがGoogleアナリティクスに送信されます。また現在対応しているプレイヤーイベントはplay
、complete
、pause
、seek
になります。
ga.object
仕様
パラメーター名 | 型 | 値 | 設定 | デフォルト値 |
---|---|---|---|---|
category | string | text | 任意 | Videog Player Video |
label | string | text | 任意 | sources[]の最初のfileURL |
説明
パラメーター名 | 説明 |
---|---|
category | Googleアナリティクスのイベントトラッキングのカテゴリ名を設定します。 |
label | Googleアナリティクスのイベントトラッキングのラベル名を設定します。 |
コードサンプル
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!-- Global site tag (gtag.js) - Google Analytics -->
async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxx-xx"
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'UA-xxxxxxx-xx');
const options = {
ga: {
category:"custom_category",
label:"custom_label"
},
...
};
const player = videogplayer('video_tag_id', options);