-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.html
205 lines (177 loc) · 12.6 KB
/
index.html
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<html><head>
<title>GA4MP - Demo</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="dist/ga4mp.umd.min.js"></script>
<script>
window.ga4track = ga4mp(["G-THYNGSTER"], {
user_id: '',
non_personalized_ads: true,
endpoint: 'https://region1.google-analytics.com/g/collect',
debug: true,
});
ga4track.setEventsParameter('playground', 'yes')
ga4track.setEventsParameter('page_path', document.location.pathname)
ga4track.trackEvent('page_view')
function setUserProperty() {
ga4track.setUserProperty('is_premium_user', 'yes')
}
function setEventsParameter() {
ga4track.setEventsParameter('logged_in', 'no')
}
function eec() {
ga4track.trackEvent('view_item', {items: [{
id: '123123',
name: 'Demo Product',
brand: 'Analytics Debugger',
item_id: '123123',
item_name: 'Demo Product',
item_brand: 'Analytics Debugger',
item_category: 'demo',
item_category2: '1',
item_category3: undefined,
item_category4: undefined,
item_category5: undefined,
item_variant: undefined,
discount: undefined,
quantity: undefined,
price: '180.00',
currency: 'EUR',
coupon: undefined,
item_list_name: undefined,
item_list_id: undefined,
index: undefined,
custom_item_parameter: 'no data'
}]});
}
// ga4track.setEventParameter('logged_in', 1)
function sendPageview () {
ga4track.trackEvent('page_view', {})
}
function sendPageview_custom () {
ga4track.trackEvent('page_view', {
page_location: 'https://www.google.es'
})
}
function sendPageview_2 () {
ga4track.trackEvent('page_view', {
is_session_start: true,
is_first_visit: true,
})
}
function sendPageview_3 () {
ga4track.trackEvent('page_view', {
is_session_start: true,
campaign_medium: 'cpc',
campaign_source: 'google',
campaign_name: 'gclid'
})
}
function sendEvent () {
ga4track.trackEvent('click_outgoing', { clicked_url: 'https://www.thyngster.com', time: 12323 })
}
function setUserId(){
ga4track.setUserId('92932837723')
}
</script>
<style>/* ! tailwindcss v3.2.1 | MIT License | https://tailwindcss.com */*,::after,::before{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}::after,::before{--tw-content:''}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*, ::before, ::after{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::-webkit-backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.my-5{margin-top:1.25rem;margin-bottom:1.25rem}.my-2{margin-top:0.5rem;margin-bottom:0.5rem}.mt-3{margin-top:0.75rem}.mt-2{margin-top:0.5rem}.rounded{border-radius:0.25rem}.border{border-width:1px}.border-black{--tw-border-opacity:1;border-color:rgb(0 0 0 / var(--tw-border-opacity))}.bg-slate-200{--tw-bg-opacity:1;background-color:rgb(226 232 240 / var(--tw-bg-opacity))}.bg-yellow-300{--tw-bg-opacity:1;background-color:rgb(253 224 71 / var(--tw-bg-opacity))}.p-5{padding:1.25rem}.p-2{padding:0.5rem}.px-2{padding-left:0.5rem;padding-right:0.5rem}.font-mono{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace}.text-xl{font-size:1.25rem;line-height:1.75rem}</style></head>
<body class="p-5">
<p> </p>
<h1 class="text-xl my-5">GA4MP Library 0.0.3 [2023-03-05] ( David Vallejo @thyng )</h1>
<h2 class="my-2"><a href="https://ga4mp.dev">Official Website :: https://ga4mp.dev</a></h2>
<hr>
<h2 class="text-xl mt-3">Initializing the tracker</h2>
<div class="bg-slate-200 p-2 rounded">
<pre class="font-mono"><script src="https://cdn.jsdelivr.net/npm/@analytics-debugger/ga4mp@latest/dist/ga4mp.umd.min.js"></script>
<script>
const ga4track = ga4mp(["G-THYNGSTER"], {
// client_id: '123123123.123123123123', // autogenerate
user_id: undefined,
non_personalized_ads: true,
debug: true
});
</script>
</pre>
</div>
<h2 class="text-xl mt-3">Setting an User Property the tracker</h2>
<div class="bg-slate-200 p-2 rounded">
<pre class="font-mono">ga4track.setUserProperty('is_premium_user', 'yes')</pre>
<button class="mt-2 px-2 border bg-yellow-300 border-black rounded" onclick="setUserProperty()">SET USER PROPERTY ON TRACKER</button>
</div>
<h2 class="text-xl mt-3">Setting a persistent Event Parameter</h2>
<div class="bg-slate-200 p-2 rounded">
<pre class="font-mono">ga4track.setEventParameter('page_type', 'home', true)</pre>
<button class="mt-2 px-2 border bg-yellow-300 border-black rounded" onclick="setEventsParameter()">SET PERSISTENT EVENT PARAMETER</button>
</div>
<h2 class="text-xl mt-3">Set the userId a persistent Event Parameter</h2>
<div class="bg-slate-200 p-2 rounded">
<pre class="font-mono">ga4track.setUserId('92932837723')</pre>
<button class="mt-2 px-2 border bg-yellow-300 border-black rounded" onclick="setUserId()">SET USER ID</button>
</div>
<h2 class="text-xl mt-3">Sending a page_view</h2>
<div class="bg-slate-200 p-2 rounded">
<pre class="font-mono">ga4track.trackEvent('page_view', {})
</pre>
<button class="mt-2 px-2 border bg-yellow-300 border-black rounded" onclick="sendPageview_2()">SEND PAGE_VIEW</button>
</div>
<h2 class="text-xl mt-3">Send a pageview that trigger a new session and a first visit</h2>
<div class="bg-slate-200 p-2 rounded">
<pre class="font-mono">ga4track.trackEvent('page_view', {
is_session_start: true,
is_first_visit: true,
}) </pre>
<button class="mt-2 px-2 border bg-yellow-300 border-black rounded" onclick="sendPageview_3()">SEND PAGE_VIEW ( FIRST VISIT, SESSION START</button>
</div>
<h2 class="text-xl mt-3">Send a pageview that trigger a new session and set the campaign attribution</h2>
<div class="bg-slate-200 p-2 rounded">
<pre class="font-mono">ga4track.trackEvent('page_view', {
is_session_start: true,
campaign_medium: 'cpc',
campaign_source: 'google',
campaign_name: 'gclid'
}) </pre>
<button class="mt-2 px-2 border bg-yellow-300 border-black rounded" onclick="sendPageview()">SEND PAGE_VIEW ( SESSION START; ATTRIBUTION DATA</button>
</div>
<h2 class="text-xl mt-3">Virtual PageView</h2>
<div class="bg-slate-200 p-2 rounded">
<pre class="font-mono">ga4track.trackEvent('page_view', {
page_location: 'https://www.google.es'
}) </pre>
<button class="mt-2 px-2 border bg-yellow-300 border-black rounded" onclick="sendPageview_custom()">SEND Virtual</button>
</div>
<h2 class="text-xl mt-3">Sending Ecommerce</h2>
<div class="bg-slate-200 p-2 rounded">
<pre class="font-mono">ga4track.trackEvent('view_item', {items: [{
id: '123123',
name: 'Demo Product',
brand: 'Analytics Debugger',
item_id: '123123',
item_name: 'Demo Product',
item_brand: 'Analytics Debugger',
item_category: 'demo',
item_category2: '1',
item_category3: undefined,
item_category4: undefined,
item_category5: undefined,
item_variant: undefined,
discount: undefined,
quantity: undefined,
price: '180.00',
currency: 'EUR',
coupon: undefined,
item_list_name: undefined,
item_list_id: undefined,
index: undefined,
custom_item_parameter: 'no data'
}]});
</pre>
<button class="mt-2 px-2 border bg-yellow-300 border-black rounded" onclick="eec()">SEND EEC</button>
</div>
<h2 class="text-xl mt-3">Sending an event</h2>
<div class="bg-slate-200 p-2 rounded">
<pre class="font-mono">ga4track.trackEvent('click_outgoing', {
clicked_url: 'https://www.thyngster.com',
time: 12323
})</pre>
<button class="mt-2 px-2 border bg-yellow-300 border-black rounded" onclick="sendEvent()">SEND CUSTOM EVENT</button>
</div>
</body></html>