-
Notifications
You must be signed in to change notification settings - Fork 1
/
GTM-ImportContainer.json
370 lines (370 loc) · 27.7 KB
/
GTM-ImportContainer.json
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
{
"exportFormatVersion": 2,
"exportTime": "2019-02-22 11:05:21",
"containerVersion": {
"path": "accounts/136157975/containers/10605599/versions/0",
"accountId": "136157975",
"containerId": "10605599",
"containerVersionId": "0",
"container": {
"path": "accounts/136157975/containers/10605599",
"accountId": "136157975",
"containerId": "10605599",
"name": "GTM_elements",
"publicId": "GTM-M9XHZ37",
"usageContext": [
"WEB"
],
"fingerprint": "1550833369912",
"tagManagerUrl": "https://tagmanager.google.com/#/container/accounts/136157975/containers/10605599/workspaces?apiLink=container"
},
"tag": [
{
"accountId": "136157975",
"containerId": "10605599",
"tagId": "1",
"name": "GTM_elements",
"type": "html",
"parameter": [
{
"type": "TEMPLATE",
"key": "html",
"value": "<script id=\"GTM_elements_v03\">\n /**\n * GTM_elements Version 0.3 is the basepart of alls GTM_elements\n *\n * avilable GTM_elements\n * - GTM_elements.session: Data object with Session relevant Informations\n * - GTM_elements.page_performance: Additional Page-Performace Data\n * - GTM_elements.info_layer: Individual Info-Layer for GTM DebugMode\n * - GTM_elements.ec_cart: Passive cart interaction tracking [in progress...]\n * - GTM_elements.ec_checkout: Passive checkout step tracking [in progress...]\n * - GTM_elements.ec_promotions: Promotion impression and click tracking [in progress...]\n * - GTM_elements.ec_produclist: Product-List tracking for impressions, Klicks,\n cart interactions and checkout steps [in progress...]\n * - GTM_elements.crossdomain: [in progress...]\n *\n */\n (function(document) {\n window.dataLayer = window.dataLayer || [];\n \n // setup GTM_elements as empty object\n var GTM_elements = {};\n \n // Load GTM_elements.session SCRIPT as object from a custom JavaScript Variable\n GTM_elements.session = {{GTM_elements.session SCRIPT}}();\n // Init GTM_elements.session script\n GTM_elements.session.Init('YOUR_PAGE_TYPE_IF_AVAILABLE');\n \n // Load GTM_elements.page_performance SCRIPT as object from a custom JavaScript Variable\n GTM_elements.page_performance = {{GTM_elements.page_performance SCRIPT}}();\n // Init GTM_elements.page_performance script\n GTM_elements.page_performance.Init();\n \n // check GTM Debug Mode and draw Info Layer\n if(1 || {{Debug Mode}}){\n \n // Load GTM_elements.info_layer SCRIPT as object from a custom JavaScript Variable\n GTM_elements.info_layer = {{GTM_elements.info_layer SCRIPT}}(); \n \n // prepare date info\n var sDate = '-';\n \n // check cached session data\n if(GTM_elements.session.data && GTM_elements.session.data.start){\n var aDate = new Date(GTM_elements.session.data.start);\n sDate = aDate.toLocaleString('de-DE');\n }\n \n // Init GTM_elements.info_layer script\n GTM_elements.info_layer.Init();\n \n // prepare information layer data\n GTM_elements.info_layer.infoVars = {\n 'Session Start' : sDate,\n 'Session Source' : GTM_elements.session.data.source,\n 'Session Medium' : GTM_elements.session.data.medium,\n 'Performance redirectCount' : GTM_elements.page_performance.data.redirectCount,\n 'Performance navigationType' : GTM_elements.page_performance.data.navigationType,\n 'Performance TTFB' : GTM_elements.page_performance.data.TTFB,\n 'Performance FP' : GTM_elements.page_performance.data.FP,\n 'Performance FCP' : GTM_elements.page_performance.data.FCP,\n };\n // draw information layer\n GTM_elements.info_layer.UpdateInfoLayer();\n }\n \n })(document);\n\n</script>"
},
{
"type": "BOOLEAN",
"key": "supportDocumentWrite",
"value": "false"
}
],
"fingerprint": "1550791149246",
"firingTriggerId": [
"2147479553"
],
"parentFolderId": "5",
"tagFiringOption": "ONCE_PER_EVENT"
},
{
"accountId": "136157975",
"containerId": "10605599",
"tagId": "3",
"name": "UA Event Data",
"type": "ua",
"parameter": [
{
"type": "BOOLEAN",
"key": "nonInteraction",
"value": "true"
},
{
"type": "BOOLEAN",
"key": "overrideGaSettings",
"value": "false"
},
{
"type": "TEMPLATE",
"key": "eventValue",
"value": "{{UA EventValue}}"
},
{
"type": "TEMPLATE",
"key": "eventCategory",
"value": "{{UA EventCategory}}"
},
{
"type": "TEMPLATE",
"key": "trackType",
"value": "TRACK_EVENT"
},
{
"type": "TEMPLATE",
"key": "gaSettings",
"value": "{{UA Settings}}"
},
{
"type": "TEMPLATE",
"key": "eventAction",
"value": "{{UA EventAction}}"
},
{
"type": "TEMPLATE",
"key": "eventLabel",
"value": "{{UA EventLabel}}"
}
],
"fingerprint": "1550587035049",
"firingTriggerId": [
"25"
],
"tagFiringOption": "ONCE_PER_EVENT"
}
],
"trigger": [
{
"accountId": "136157975",
"containerId": "10605599",
"triggerId": "25",
"name": "UA Data",
"type": "CUSTOM_EVENT",
"customEventFilter": [
{
"type": "EQUALS",
"parameter": [
{
"type": "TEMPLATE",
"key": "arg0",
"value": "{{_event}}"
},
{
"type": "TEMPLATE",
"key": "arg1",
"value": "uaData"
}
]
}
],
"fingerprint": "1550587009165"
}
],
"variable": [
{
"accountId": "136157975",
"containerId": "10605599",
"variableId": "3",
"name": "GTM_elements.info_layer SCRIPT",
"type": "jsm",
"parameter": [
{
"type": "TEMPLATE",
"key": "javascript",
"value": "function() {\n return function(action) {\n var info_layer = {};\n info_layer.Config = function() {\n info_layer.layerName = 'GTM.elements Debug InfoLayer';\n info_layer.bgColor = '#a1c2fa';\n };\n \n info_layer.Init = function(infoVars) {\n info_layer.infoVars = info_layer.infoVars || { 'notice':'no infoVars to show' };\n info_layer.Config();\n info_layer.AddInfoLayer();\n setInterval(info_layer.UpdateInfoLayer, 3000);\n };\n \n info_layer.AddInfoLayer = function(){\n if(info_layer.bgColor){\n //document.body.style.backgroundColor = info_layer.bgColor;\n //document.body.style.borderLeft = '50px solid ' info_layer.bgColor;\n //document.body.style.borderRight = '50px solid ' info_layer.bgColor;\n }\n\n var elem = document.createElement('div');\n elem.id = 'GTM_debugInfo';\n elem.style.cssText = 'position:fixed;top:0;right:0;width:300px;z-index:100;background:#4285f4;color:#fff;padding:10px;font-size:12px;font-family: Arial, Helvetica, sans-serif;z-index:99999';\n document.body.appendChild(elem);\n };\n \n info_layer.UpdateInfoLayer = function(){\n\n var elem = document.getElementById('GTM_debugInfo');\n elem.innerHTML = '<b>' info_layer.layerName '</b>';\n elem.innerHTML = '<a href=\"#\" onMouseUp=\"javascript:document.getElementById(\\'GTM_debugInfo\\').style.display= \\'none\\';\" style=\"font-size:16px;padding:5px;position:absolute;top:0;right:0;color:#fff;text-decoration:none;\">X</a>';\n \n for(var index in info_layer.infoVars) {\n elem.innerHTML = '<br>' index ': ' info_layer.infoVars[index];\n }\n };\n \n return info_layer;\n\n };\n \n}"
}
],
"fingerprint": "1544475763776",
"parentFolderId": "5",
"formatValue": {}
},
{
"accountId": "136157975",
"containerId": "10605599",
"variableId": "2",
"name": "GTM_elements.page_performance SCRIPT",
"type": "jsm",
"parameter": [
{
"type": "TEMPLATE",
"key": "javascript",
"value": "function() {\n return function() {\n \n var page_performance = {};\n \n page_performance.Config = function() {\n page_performance.data = {};\n page_performance.data.redirectCount = '-'; // \n page_performance.data.navigationType = '-'; // \"navigate\", \"reload\", \"back_forward\" or \"prerender\n page_performance.data.TTFB = '-'; // Time to first Byte\n page_performance.data.FP = '-'; // First Paint, better as Event: (https://www.sitepen.com/blog/2017/10/06/improving-performance-with-the-paint-timing-api/)\n page_performance.data.FCP = '-'; // First Contentful Paint\n page_performance.data.FID = ''; // First Input Delay, better as Event: (https://github.com/GoogleChromeLabs/first-input-delay)\n };\n \n page_performance.Init = function(uaEventName) {\n page_performance.uaEventName = uaEventName || 'uaData';\n page_performance.Config();\n \n if (!!window.PerformanceNavigation) {\n // https://developer.mozilla.org/en-US/docs/Web/API/PerformanceNavigationTiming\n \n var perfEntries = performance.getEntriesByType(\"navigation\");\n var perfEntry = perfEntries[0].toJSON();\n \n page_performance.data.redirectCount = perfEntry.redirectCount;\n page_performance.data.navigationType = perfEntry.type;\n page_performance.data.TTFB = page_performance.convertTimestamp(perfEntry.responseStart);\n \n page_performance.trackPaint(window.performance);\n \n if(page_performance.data.FP == '-' || page_performance.data.FCP == '-'){\n var observer = new PerformanceObserver(function(list, obj) {\n page_performance.trackPaint(list);\n });\n observer.observe({entryTypes: [\"paint\"]});\n }\n }\n };\n \n page_performance.trackPaint = function(list) {\n var perfEntries = list.getEntries();\n for (var i=0; i < perfEntries.length; i ) {\n var perfEntry = perfEntries[i].toJSON();\n if(perfEntry.name == 'first-paint'){\n page_performance.data.FP = page_performance.convertTimestamp(perfEntry.startTime);\n }\n if(perfEntry.name == 'first-contentful-paint'){\n page_performance.data.FCP = page_performance.convertTimestamp(perfEntry.startTime);\n }\n }\n if(page_performance.data.FP != '-' && page_performance.data.FCP != '-'){\n window.dataLayer = window.dataLayer || [];\n \n var aInfo = ['redirectCount', 'navigationType', 'TTFB', 'FP', 'FCP'];\n var aAction = [];\n var aLabel = [];\n for (var i=0; i < aInfo.length; i ) {\n aAction.push(aInfo[i]);\n aLabel.push(page_performance.data[aInfo[i]]);\n }\n \n window.dataLayer.push({\n 'event' : page_performance.uaEventName,\n 'eventCategory':'Performance',\n 'eventAction':aAction.join('|'),\n 'eventLabel':aLabel.join('|'),\n 'eventValue':page_performance.data.FCP\n });\n // console.log(aAction.join('|') ' ~ ' aLabel.join('|'));\n }\n };\n \n page_performance.convertTimestamp = function(iTime) {\n return Math.round(iTime);\n };\n \n \n return page_performance;\n\n };\n \n}"
}
],
"fingerprint": "1548858280944",
"parentFolderId": "5",
"formatValue": {}
},
{
"accountId": "136157975",
"containerId": "10605599",
"variableId": "1",
"name": "GTM_elements.session SCRIPT",
"type": "jsm",
"parameter": [
{
"type": "TEMPLATE",
"key": "javascript",
"value": "function() {\n return function() {\n \n var session = {};\n \n session.Config = function() {\n session.getUrlParams = session.GetUrlParams();\n session.newSession = undefined;\n session.newSessionType = undefined;\n session.utmOverwriteMedium = false;\n session.timeout = 30; // minutes\n session.timeNow = new Date().getTime();\n \n session.data = {};\n session.data.start = undefined;\n session.data.source = '(direct)';\n session.data.medium = '(none)';\n session.data.utm = {};\n session.data.sessionType = '-';\n session.data.lastNonDirect = {};\n \n session.oRef = session.GetDomainData(document.referrer);\n //session.oLocation = session.GetDomainData(document.location.hostname);\n session.oLocation = session.GetDomainData(document.location.href);\n var sCurrentDomain = session.oLocation.domain;\n \n session.oRefExclude = {};\n session.oRefExclude[sCurrentDomain] = 'self';\n \n session.oRefInclude = {\n // organic\n 'google' : 'organic',\n 'bing.com' : 'organic',\n 'msn.com' : 'organic',\n 't-online.de' : 'organic',\n 'yahoo.com' : 'organic',\n 'zapmeta.de' : 'organic',\n 'freenet.de' : 'organic',\n 'duckduckgo.com' : 'organic',\n 'ecosia.org' : 'organic',\n 'metager.de' : 'organic',\n 'wow.de' : 'organic',\n 'avira.com' : 'organic',\n 'web.de' : 'organic',\n // social\n 'facebook.com' : 'social',\n 'twitter.com' : 'social',\n 'instagram.com' : 'social',\n 'youtube.com' : 'social',\n 'pinterest.com' : 'social',\n 'linkedin.com' : 'social',\n 'xing.com' : 'social',\n // display\n 'criteo' : 'display',\n };\n \n session.aPageTypeExclude = [];\n };\n \n session.Init = function(sPageType) {\n sPageType = sPageType || \"\";\n session.Config();\n \n session.previousData = session.BrowserDataRead('GTM_elements.session.data');\n if(session.previousData){\n session.data.lastInteraction = session.previousData.lastInteraction || \"\";\n session.data.start = session.previousData.start || \"\";\n }\n session.newSession = session.CheckNewSession(sPageType);\n \n if(!session.previousData){\n session.newSessionType = 'new visitor';\n session.newSession = true;\n }\n \n if(session.newSession){\n session.data.start = session.timeNow;\n session.data.pageType = sPageType;\n session.data.landingPage = document.location.href;\n session.data.sessionType = session.newSessionType;\n session.ProcessSourceMediumCampaign();\n }else{\n session.data = session.previousData;\n }\n session.data.lastInteraction = session.timeNow;\n if(session.newSession && session.data.source != '(direct)' && session.data.medium != '(none)'){\n session.data.lastNonDirect.source = session.data.source;\n session.data.lastNonDirect.medium = session.data.medium;\n session.data.lastNonDirect.date = session.data.start;\n }else if(session.previousData){\n session.data.lastNonDirect = session.previousData.lastNonDirect || \"\";\n }\n session.BrowserDataWrite('GTM_elements.session.data', session.data);\n \n };\n \n session.CheckNewSession = function(sPageType){\n var bNewSession = false;\n \n if(session.oRef){\n if(session.oRefExclude[session.oRef.hostname] || session.oRefExclude[session.oRef.domain] || session.oRefExclude[session.oRef.main_domain]){\n session.newSessionType = 'referral exclude';\n }else{\n session.newSessionType = 'referral';\n bNewSession = true;\n }\n }\n \n if(sPageType){\n for(var i = 0; i < session.aPageTypeExclude; i ) {\n if(sPageType == session.aPageTypeExclude[i]){\n session.newSessionType = 'pagetype exclude';\n }\n }\n }\n \n if(session.getUrlParams.utm_source && session.getUrlParams.utm_medium){\n session.newSessionType = 'utm';\n bNewSession = true;\n }else if(!session.data.lastInteraction || session.timeNow - session.data.lastInteraction > session.timeout*1000*60){\n if(!session.data.lastInteraction){\n session.newSessionType = 'last interaction missing';\n }else{\n session.newSessionType = 'last interaction timeout';\n }\n bNewSession = true;\n }\n\n return bNewSession;\n };\n \n session.ProcessSourceMediumCampaign = function(){\n session.data.utm.source = (session.getUrlParams.utm_source || undefined);\n session.data.utm.medium = (session.getUrlParams.utm_medium || undefined);\n session.data.utm.campaign = (session.getUrlParams.utm_campaign || undefined);\n session.data.utm.term = (session.getUrlParams.utm_term || undefined);\n session.data.utm.content = (session.getUrlParams.utm_content || undefined);\n \n if (session.getUrlParams.gclid || session.getUrlParams.dclid) {\n session.data.source = 'google';\n session.data.medium = session.getUrlParams.gclid ? 'cpc' : 'cpm';\n }else if(session.data.utm.source && session.data.utm.medium){\n if(session.utmOverwriteMedium && session.oRefInclude[session.data.utm.source]){\n session.data.source = session.data.utm.source;\n session.data.medium = session.oRefInclude[session.data.utm.source];\n }else{\n session.data.source = session.data.utm.source;\n session.data.medium = session.data.utm.medium;\n }\n }else if(session.oRef){\n if(session.oRefExclude[session.oRef.hostname] || session.oRefExclude[session.oRef.domain] || session.oRefExclude[session.oRef.main_domain]){\n // leave at the default values\n \n }else if(session.oRefInclude[session.oRef.hostname]){\n session.data.source = session.oRef.hostname;\n session.data.medium = session.oRefInclude[session.oRef.hostname];\n }else if(session.oRefInclude[session.oRef.domain]){\n session.data.source = session.oRef.domain;\n session.data.medium = session.oRefInclude[session.oRef.domain]; \n }else if(session.oRefInclude[session.oRef.main_domain]){\n session.data.source = session.oRef.main_domain;\n session.data.medium = session.oRefInclude[session.oRef.main_domain];\n }else{\n session.data.source = session.oRef.hostname;\n session.data.medium = 'referral';\n }\n }\n }\n \n session.GetDomainData = function(sUrl) {\n if (!sUrl) return;\n var a = document.createElement('a');\n a.href = sUrl;\n var aHostParts = a.hostname.split(\".\");\n \n var oRefData = {};\n oRefData.url = sUrl;\n oRefData.hostname = a.hostname;\n oRefData.domain = aHostParts[aHostParts.length-2] '.' aHostParts[aHostParts.length-1];\n oRefData.main_domain = aHostParts[aHostParts.length-2];\n return oRefData;\n };\n \n // read persisted information\n session.BrowserDataRead = function(dataName){\n var returnData = localStorage.getItem(dataName);\n return JSON.parse(returnData);\n };\n\n // persist information\n session.BrowserDataWrite = function(dataName, data){\n var jsonData = JSON.stringify(data);\n localStorage.setItem(dataName, jsonData);\n return true;\n };\n\n // delete persisted data\n session.BrowserDataDelete = function(dataName){\n localStorage.removeItem(dataName);\n };\n\n session.GetUrlParams = function() {\n var oGetParams = {};\n var query = window.location.search.substring(1);\n var vars = query.split('&');\n for (var i = 0; i < vars.length; i ) {\n var pair = vars[i].split('=');\n oGetParams[pair[0]] = pair[1];\n }\n return oGetParams;\n };\n \n return session;\n\n };\n \n}"
}
],
"fingerprint": "1550833348772",
"parentFolderId": "5",
"formatValue": {}
},
{
"accountId": "136157975",
"containerId": "10605599",
"variableId": "4",
"name": "GTM_elements.session.data",
"type": "jsm",
"parameter": [
{
"type": "TEMPLATE",
"key": "javascript",
"value": "function() {\n var returnData = localStorage.getItem('GTM_elements.session.data');\n return JSON.parse(returnData);\n}"
}
],
"fingerprint": "1549384046750",
"parentFolderId": "5",
"formatValue": {}
},
{
"accountId": "136157975",
"containerId": "10605599",
"variableId": "5",
"name": "GTM_elements.session.data.medium",
"type": "jsm",
"parameter": [
{
"type": "TEMPLATE",
"key": "javascript",
"value": "function() {\n var returnData = localStorage.getItem('GTM_elements.session.data');\n returnData = JSON.parse(returnData);\n return (returnData.medium || '');\n}"
}
],
"fingerprint": "1549384059132",
"parentFolderId": "5",
"formatValue": {}
},
{
"accountId": "136157975",
"containerId": "10605599",
"variableId": "8",
"name": "UA EventAction",
"type": "v",
"parameter": [
{
"type": "INTEGER",
"key": "dataLayerVersion",
"value": "2"
},
{
"type": "BOOLEAN",
"key": "setDefaultValue",
"value": "false"
},
{
"type": "TEMPLATE",
"key": "name",
"value": "eventAction"
}
],
"fingerprint": "1550586825650",
"formatValue": {}
},
{
"accountId": "136157975",
"containerId": "10605599",
"variableId": "7",
"name": "UA EventCategory",
"type": "v",
"parameter": [
{
"type": "INTEGER",
"key": "dataLayerVersion",
"value": "2"
},
{
"type": "BOOLEAN",
"key": "setDefaultValue",
"value": "false"
},
{
"type": "TEMPLATE",
"key": "name",
"value": "eventCategory"
}
],
"fingerprint": "1550586807095",
"formatValue": {}
},
{
"accountId": "136157975",
"containerId": "10605599",
"variableId": "9",
"name": "UA EventLabel",
"type": "v",
"parameter": [
{
"type": "INTEGER",
"key": "dataLayerVersion",
"value": "2"
},
{
"type": "BOOLEAN",
"key": "setDefaultValue",
"value": "false"
},
{
"type": "TEMPLATE",
"key": "name",
"value": "eventLabel"
}
],
"fingerprint": "1550586850920",
"formatValue": {}
},
{
"accountId": "136157975",
"containerId": "10605599",
"variableId": "10",
"name": "UA EventValue",
"type": "v",
"parameter": [
{
"type": "INTEGER",
"key": "dataLayerVersion",
"value": "2"
},
{
"type": "BOOLEAN",
"key": "setDefaultValue",
"value": "false"
},
{
"type": "TEMPLATE",
"key": "name",
"value": "eventValue"
}
],
"fingerprint": "1550586864847",
"formatValue": {}
}
],
"folder": [
{
"accountId": "136157975",
"containerId": "10605599",
"folderId": "5",
"name": "GTM_elements",
"fingerprint": "1544457015403"
}
],
"builtInVariable": [
{
"accountId": "136157975",
"containerId": "10605599",
"type": "PAGE_URL",
"name": "Page URL"
},
{
"accountId": "136157975",
"containerId": "10605599",
"type": "PAGE_HOSTNAME",
"name": "Page Hostname"
},
{
"accountId": "136157975",
"containerId": "10605599",
"type": "PAGE_PATH",
"name": "Page Path"
},
{
"accountId": "136157975",
"containerId": "10605599",
"type": "REFERRER",
"name": "Referrer"
},
{
"accountId": "136157975",
"containerId": "10605599",
"type": "EVENT",
"name": "Event"
},
{
"accountId": "136157975",
"containerId": "10605599",
"type": "DEBUG_MODE",
"name": "Debug Mode"
}
],
"fingerprint": "0",
"tagManagerUrl": "https://tagmanager.google.com/#/versions/accounts/136157975/containers/10605599/versions/0?apiLink=version"
}
}