-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathga4-eventparameter.html
More file actions
35 lines (35 loc) · 1.51 KB
/
ga4-eventparameter.html
File metadata and controls
35 lines (35 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!doctype html>
<html>
<head>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-P4VT7G54');</script>
<!-- End Google Tag Manager -->
<title>GA4イベントパラメータ書き出しテスト</title>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-P4VT7G54"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<h1>このページはGA4のイベントパラメータを書き出す</h1>
<h2>設定方法</h2>
<ol>
<li>このページからJavaScriptで値を書き出す<br>書き出す値は「fileName = 'ga4Training'」です</li>
<li>GTMでこのページから書き出す値を受け取る変数、GA4タグの追加フィールドを設定する</li>
<li>GA4からカスタムディメンションを設定する</li>
</ol>
<script>
// GTMの変数を定義して値をセット
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'fileName': 'test'
});
</script>
</body>
</html>