...

トラッキング設定系 ページトラッキング イベントトラッキング eコマース

by user

on
Category: Documents
31

views

Report

Comments

Transcript

トラッキング設定系 ページトラッキング イベントトラッキング eコマース
Universal Analytics Cheat Sheet
トラッキング設定系
Universal Analytics版
旧ga.js版
用途
ga('create', 'UA-XXXX-Y', 'yourdomains);
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
アカウントを指定する
ga('send', 'pageview');
ga('create', 'UA-XXXX-Y');
ga('create', 'UA-XXXX-Y', { 'name' :
'newTracker'});
ga('send', 'pageview');
ga('newTracker.send', 'pageview');
ga('set', 'anonymizeIP', true);
_gaq.push(['_trackPageview']);
トラッキング情報を取得する
window['ga-disable-UA-XXXX-Y'] = true;
―
対象ページのトラッキングを複数プロパティで管理
―
IPを匿名化して取得する
任意でトラッキングを無効にする
―
ページトラッキング
Universal Analytics版
ga('send', 'pageview', {
'page' : '/my-overridden-page?id=1',
'title' : my overridden page'
});
旧ga.js版
用途
<a onclick="_gaq.push(['_trackPageview',
仮想ページ’(PDFや動的生成ページ)に任意のタイトルを付
'/downloads/pdfs/corporateBrief.pdf']);">計測対象オブ
けてトラッキング
ジェクト</a>
イベントトラッキング
Universal Analytics版
旧ga.js版
用途
<a onclick="ga('send', 'event', 'category',
<a onclick="_gaq.push(['_trackEvent', 'category', 'action',
'action', 'opt_label', opt_value);">計測対象オブ
外部サイトへのリンククリック数などクリックそのものを取得
'opt_label', opt_value]);">計測対象オブジェクト</a>
ジェクト</a>
<a href="URL" onclick="ga('send', 'event',
<a href="URL" onclick="_gaq.push(['_trackEvent',
'category', 'action', {nonInteraction' : 1});">計測 'category', 'action', 'opt_label', opt_value,
opt_noninteraction]);">計測対象オブジェクト</a>
対象オブジェクト</a>
外部サイトへのクリック数を取得しつつ直帰率に影響を与えな
いようにしたい場合
eコマース
Universal Analytics版
<script>
ga('ecommerce:addTransaction', {
id: '$オーダー/決済ID$', // Transaction ID - this is
normally generated by your system.
affiliation: '$ショップ名$', // Affiliation or store name
revenue: '$オーダー金額総計$', // Grand Total
shipping: '$送料$' , // Shipping cost
tax: '$税金$' }); // Tax.
ga('ecommerce:addItem', {
id: '$オーダー/決済ID$', // Transaction ID.
sku: '$商品ID$', // SKU/code.
name: '$商品名$', // Product name.
category: '$商品カテゴリーorブランド$', // Category or
variation.
price: '$商品単価$', // Unit price.
quantity: '$個数$'}); // Quantity.
ga('ecommerce:send');
</script>
旧ga.js版
<script type=”text/javascript”>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxxxx-1']);
_gaq.push(['_trackPageview']);
_gaq.push(['_addTrans',
'$オーダーID$', // order ID - required
'$ショップ名$', // affiliation or store name
'$オーダー金額総計$', // total - required
'$税金$', // tax
'$送料$', // shipping
'$市区町村$', // city
'$県$', // state or province
'$日本$' // country
]);
// add item might be called for every item in the shopping cart
+A4// where your ecommerce engine loops through each item in the cart and
// prints out _addItem for each
_gaq.push(['_addItem',
'$オーダーID$', // order ID - required
'$商品ID$', // SKU/code - required
'$商品名$', // product name
'$商品カテゴリーorブランド$', // category or variation
'$商品単価$', // unit price - required
'$個数$' // quantity - required
]);
_gaq.push(['_trackTrans']); //submits transaction to the Analytics servers
(function() {
var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.googleanalytics.com/ga.js’;
var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
用途
カートの完了画面に入れることでEコマーストラッキングが可能
になる。※「$〇〇$」でくくられた部分はシステム側の変数に書
き換える必要があります。
ソーシャルトラッキング
Universal Analytics版
ga('send', 'social', 'socialNetwork',
'socialAction', 'socialtarget');
旧ga.js版
_gaq.push(['_trackSocial', network, socialAction,
opt_target, opt_pagePath]);
用途
TwitterやFacebookなどSNS経由のアクションを計測する
ユーザータイミング
Universal Analytics版
ga('send', 'timingCategory', timingVar',
timingValue, 'opt_timingLabel');
旧ga.js版
_gaq.push([‘_trackTiming’, category, variable, time,
opt_label, opt_sample]);
用途
特定コンテンツの読み込み時間を計測する
カスタムディメンション
旧ga.js版
用途
ga('send', 'pageview', {
'dimension_name' : 'opt_dimensionLavel'
});
Universal Analytics版
―
ページビューに対してカスタムディメンションの値を与える場合
ga('send', 'event', 'category', 'action', {
'metric_name' : 8000
});
―
イベントに対してカスタム指標の値を与える
ga('set', 'dimension_name', 'custom data');
―
カスタムディメンションを設定する(性別、購入履歴、会員種別
など)
ga('set', {
'dimension5' : 'custom dimension data',
'metric5' : 'custom metric data'
});
―
カスタムディメンションとカスタム指標を一気に設定する
Universal Analytics Cheat Sheet - Method & Field Reference
オブジェクトメソッド
create
getByName
getAll
send
set
get
ga('create', trackingId, opt_configObject);
ga.getByName(name);
ga.getAll();
トラッキング系オブジェクトメソッド
ga('send', hitType, opt_fieldObject);
ga('set', fieldName, value)
tracker.get(fieldName);
Tracker Name
計測フィールド作成系
optional
Client ID
required
Sample Rate
Site Speed Sample Rate
Always Send Referrer
Allow Anchor Parameters
Cookie Name
Cookie Domain
Cookie Expiration
optional
optional
optional
optional
optional
optional
optional
Legacy Cookie Domain
optional
Anonymize IP
Force SSL
optional
optional
Hit Callback
optional
Session Control
セッション取得系
optional
ga('send', 'pageview', {'sessionControl': 'start'});
Document Referrer
Campaign Name
Campaign Source
Campaign Medium
Campaign Keyword
Campaign Content
Campaign ID
トラフィックソース計測
optional
optional
optional
optional
optional
optional
optional
ga('set',
ga('set',
ga('set',
ga('set',
ga('set',
ga('set',
ga('set',
'referrer', 'http://example.com');
'campaignName', '(direct)');
'campaignSource', '(direct)');
'campaignMedium', 'organic');
'campaignKeyword', 'Blue Shoes');
'campaignContent', 'content');
'campaignId', 'ID');
Screen Resolution
Viewport size
Document Encoding
Screen Colors
User Language
Java Enabled
Flash Version
システム情報取得
optional
optional
optional
optional
optional
optional
optional
ga('set',
ga('set',
ga('set',
ga('set',
ga('set',
ga('set',
ga('set',
'screenResolution', '800x600');
'viewportSize', '123x456');
'encoding', 'UTF-16');
'screenColors', '8-bit');
'language', 'en-us');
'javaEnabled', true);
'flashVersion', '10 1 r103');
ga('create', 'UA-XXXX-Y',
ga('create', 'UA-XXXX-Y',
b876-2b884dof825b'});
ga('create', 'UA-XXXX-Y',
ga('create', 'UA-XXXX-Y',
ga('create', 'UA-XXXX-Y',
ga('create', 'UA-XXXX-Y',
ga('create', 'UA-XXXX-Y',
ga('create', 'UA-XXXX-Y',
ga('create', 'UA-XXXX-Y',
ga('create', 'UA-XXXX-Y',
'store.example.com'});
{'name' : 'myTracker'});
{'clientId' : '35009a79-1a05-49d7{'sampleRate': 5});
{'siteSpeedSampleRate': 50});
{'alwaysSendReferrer': true});
{'allowAnchor': false});
{'cookieName': 'gaCookie'});
{'cookieDomain': 'example.com'});
{'cookieExpires': 86400});
{'legacyCookieDomain':
一般設定
ga('set', 'anonymizeIp', true);
ga('set', 'forceSSL', true);
// Alerts the user when a hit is sent.
ga('send', 'pageview', {
'hitCallback': function() {
alert('hit sent');
}
});
ヒットタイプ
Hit type
required
Non-Interaction Hit
optional
ga('send', {
'hitType': 'pageview',
'page': '/home'
});
ga('set', 'nonInteraction', true);
Document
Document
Document
Document
コンテンツ情報取得
optional
optional
optional
optional
ga('set',
ga('set',
ga('set',
ga('set',
アプリケーショントラッキング
optional
optional
ga('set', 'appName', 'My App');
ga('set', 'appVersion', '1.2');
location URL
Host Name
Path
Title
Application Name
Application Version
'location', 'http://foo.com/home?a=b');
'hostname', 'foo.com');
'page', '/foo');
'title', 'Settings');
イベントトラッキング
Event Category
required
Event Action
required
Event Label
optional
Event Value
optional
ga('send', 'event', {
'eventCategory': 'Category',
'eventAction': 'Action'
});
ga('send', 'event', {
'eventCategory': 'Category',
'eventAction': 'Action'
});
ga('send', 'event', {
'eventCategory': 'Category',
'eventAction': 'Action',
'eventLabel': 'Label'
});
ga('send', 'event', {
'eventCategory': 'Category',
'eventAction': 'Action',
'eventValue': 55
});
ソーシャルトラッキング
Social Network
required
Social Action
required
Social Action Target
required
ga('send', 'social', {
'socialNetwork': 'facebook',
'socialAction': 'like',
'socialTarget': 'http://foo.com'
});
ga('send', 'social', {
'socialNetwork': 'facebook',
'socialAction': 'like',
'socialTarget': 'http://foo.com'
});
ga('send', 'social', {
'socialNetwork': 'facebook',
'socialAction': 'like',
'socialTarget': 'http://foo.com'
});
ユーザータイミング計測
User timing category
optional
User timing variable name
optional
User timing time
optional
User timing label
optional
Custom Dimension
Custom Metric
ga('send', 'timing', {
'timingCategory': 'category',
'timingVar': 'lookup',
'timingValue': 123
});
ga('send', 'timing', {
'timingCategory': 'category',
'timingVar': 'lookup',
'timingValue': 123
});
ga('send', 'timing', {
'timingCategory': 'category',
'timingVar': 'lookup',
'timingValue': 123
});
ga('send', 'timing', {
'timingCategory': 'category',
'timingVar': 'lookup',
'timingValue': 123,
'timingLabel': 'label'
});
カスタムディメンションメトリックス
optional
ga('set', 'dimension14', 'Sports');
optional
ga('set', 'metric7', 47);
Fly UP