解説
analytics.js を使用してイベント トラッキングを実装する方法を説明する。更新日:2016年11月30日
使用方法
ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);
パラメタ
- send
- 送信時「send」固定。
- hitType
-
ヒット・タイプ。
イベントの場合には「event」固定。 - eventCategory
- イベントカテゴリー(任意文字列)
- eventAction
- イベントアクション(任意文字列)
- eventLabel
- イベント・ラベル(任意文字列)
- eventValue
- イベントの値を指定します。必ず負以外の値にしてください。
- fieldsObject
- フィールド・オブジェクト
サンプル・コード
例
イベントをインタラクション以外のイベントとして送信する場合、
nonInteraction フィールドを true に指定する(send コマンドの fieldsObject を使用)。
例アウトバウンドのリンクやフォーム送信のトラッキングする場合
ga
(
'send',
{
hitType: 'event',
eventCategory: 'Videos',
eventAction: 'play',
eventLabel: 'Fall Campaign',
{
nonInteraction: true
}
}
);
function handleOutboundLinkClicks( event )
{
ga
(
'send',
'event',
{
eventCategory: 'Outbound Link',
eventAction: 'click',
eventLabel: event.target.href
}
);
}
参考資料
情報
注意事項
なし。
更新履歴
- 2016/11/06 … 浅野 利博
- 新規作成