This repository has been archived by the owner on Feb 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.tpl
210 lines (178 loc) · 11.7 KB
/
template.tpl
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
___TERMS_OF_SERVICE___
By creating or modifying this file you agree to Google Tag Manager's Community
Template Gallery Developer Terms of Service available at
https://developers.google.com/tag-manager/gallery-tos (or such other URL as
Google may provide), as modified from time to time.
___INFO___
{
"type": "TAG",
"id": "cvt_temp_public_id",
"version": 1,
"securityGroups": [],
"displayName": "Qwarry ID persistence",
"categories": [
"SESSION_RECORDING"
],
"brand": {
"id": "brand_dummy",
"displayName": "",
"thumbnail": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMkAAADECAYAAAFCXzVNAAAACXBIWXMAABcRAAAXEQHKJvM/AAAUtklEQVR4nO2dzXEbOxKAx1N7XzuCtSJYuYp32xFYPuvw5AhsR6CnCCRHIPnAs/QikHxXlegIrI3AjEDeGlYPNRwCmAbQDTQw/VW9ejZNEjPENNDo3xeNB0/3x1+apvnQfaJdLN/7fHZyoKf74z+YL2oXS+d3Wf8RO8CIr+1ieYEeKHCQLaa723shdhDbYK3nIG+6L5iaD9N3vbD9g+vqRl/4smma31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BX8kAOtVbhJAMmVGYi5KPi3axRBc6ESckPWBevNbdRSFkFZLjLlZIhkBCzrWeXZRAoqroFCEkQ6D9wqUKTBF0kcd/Z4y+ICkxVZyQDIEd5lxVMjGswddgDMlPuMCR1l8rWkiGgIXsC+RO6C6TjivYMdDRxIwBkCzFCasRkjFw8D/V0H1yuvyZbxRRw7CwnRPMUdCBHEu1QjIGJuSo8rgjarrd4TuYTFkLZQSa/jdnHqZL2jIbITExEJwPFefqY1mBQNzkTE9GWDKTJIsNmbWQ2BgIz1tEOmxJrKFf+Y/cwjDFyE+2hnTaLK3UVUgCgAnsU2nfgvqWW4XrU4W7/35CL0AtvkeACkliQMCwAjWZC68w0zTN/wFr4/pRsvqvJwAAAABJRU5ErkJggg\u003d\u003d"
},
"description": "Try to persist a Qwarry ID from url params to localStorage",
"containerContexts": [
"WEB"
]
}
___TEMPLATE_PARAMETERS___
[]
___SANDBOXED_JS_FOR_WEB_TEMPLATE___
const localStorage = require("localStorage");
const getQueryParameters = require("getQueryParameters");
const getTimestampMillis = require("getTimestampMillis");
const QWARRY_ID_URL_QUERY_PARAM_NAME = "qwarryid";
const QWARRY_ID_STORAGE_KEY_NAME = "qwarry_id";
const QWARRY_ID_CREATED_AT_STORAGE_KEY_NAME = "qwarry_id_created_at";
const urlQwarryId = getQueryParameters(QWARRY_ID_URL_QUERY_PARAM_NAME);
if (urlQwarryId) {
localStorage.setItem(QWARRY_ID_STORAGE_KEY_NAME, urlQwarryId);
localStorage.setItem(QWARRY_ID_CREATED_AT_STORAGE_KEY_NAME, getTimestampMillis());
}
data.gtmOnSuccess();
___WEB_PERMISSIONS___
[
{
"instance": {
"key": {
"publicId": "access_local_storage",
"versionId": "1"
},
"param": [
{
"key": "keys",
"value": {
"type": 2,
"listItem": [
{
"type": 3,
"mapKey": [
{
"type": 1,
"string": "key"
},
{
"type": 1,
"string": "read"
},
{
"type": 1,
"string": "write"
}
],
"mapValue": [
{
"type": 1,
"string": "qwarry_id"
},
{
"type": 8,
"boolean": true
},
{
"type": 8,
"boolean": true
}
]
},
{
"type": 3,
"mapKey": [
{
"type": 1,
"string": "key"
},
{
"type": 1,
"string": "read"
},
{
"type": 1,
"string": "write"
}
],
"mapValue": [
{
"type": 1,
"string": "qwarry_id_created_at"
},
{
"type": 8,
"boolean": true
},
{
"type": 8,
"boolean": true
}
]
}
]
}
}
]
},
"clientAnnotations": {
"isEditedByUser": true
},
"isRequired": true
},
{
"instance": {
"key": {
"publicId": "get_url",
"versionId": "1"
},
"param": [
{
"key": "urlParts",
"value": {
"type": 1,
"string": "any"
}
},
{
"key": "queriesAllowed",
"value": {
"type": 1,
"string": "any"
}
}
]
},
"clientAnnotations": {
"isEditedByUser": true
},
"isRequired": true
}
]
___TESTS___
scenarios:
- name: Qwarry ID URL param value should exist in the localStorage with key qwarry_id
code: |-
mock("getQueryParameters", "123456789");
runCode();
const sessionQwarryId = localStorage.getItem("qwarry_id");
assertThat(sessionQwarryId).isStrictlyEqualTo("123456789");
assertApi('gtmOnSuccess').wasCalled();
- name: Qwarry ID key should not be present in the localStorage if Qwarry ID URL param
is absent
code: |-
mock("getQueryParameters", "");
runCode();
const sessionQwarryId = localStorage.getItem("qwarry_id");
assertThat(sessionQwarryId).isNull();
assertApi('gtmOnSuccess').wasCalled();
setup: |-
const localStorage = require("localStorage");
localStorage.removeItem("qwarry_id");
localStorage.removeItem("qwarry_id_created_at");
___NOTES___
Created on 08/09/2020 à 18:44:59