-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.tpl
193 lines (164 loc) · 8.38 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
___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___
{
"displayName": "Amazon",
"description": "This is an unofficial Google Tag Manager template for Amazon Advertising",
"categories": [ "ADVERTISING","REMARKETING"],
"securityGroups": [],
"id": "cvt_temp_public_id",
"type": "TAG",
"version": 1,
"brand": {
"thumbnail": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEmBAMAAAAqyLAgAAAAJFBMVEX0qUPtpkbhoUrdn0tKRDw8NzExMTErKyslJSUeHh4aGhr7rEHsZRNdAAAACnRSTlPcllwlEAA/g7/t5QXfrgAADEZJREFUeNrtnc9SI7cTx2U4+mJD5cRlySb3Hx58ymnXHrPXxGP2BYwNvzOLIWcCZh8AsF8gzJyGs18umrGB+SO1WpqWhgOqVGq3ajEft1qt1lctiY0qtX5/MpvN5oukzfmfLsb9EUVjlaAm0/ndYhG9tITtdjKuFSsYTC/vFsuo0Bbh7Wzs14UVDGZ3i0jcwsfbSb8WrP70bh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Q36v02bSz93NTT3pvF3eXAEkYFMwD4Da6At/NbOhVYAV7ANKiomH9bwWJButZ5Ev+T4UbEWB2jQ3mKfn6AeApZIP/JxXcOJDCRawRbQGQ6v4Qa+z3wKhXqSYt5G27kPhxh28w8DBdjFgPuhSLxTdwtJ1k3ky/S0GvqPcaHuewqE67VZTBZXGhpyW+tyVY6m5EpMV1KnXxhW0TrvN1Eyc6uW7veaA2yMAS5x6FcHiRDfz+L6in9L5/A8cyfu1xdgK1d40vj8zsyOAFRw0UZ8bx0nxQjvB20//0GKFjXqQyi9ibXVBLMV2X9nZeFtptmQD/6Vtomn8Kskws501grbVLckijZEKSxG9qrdGt5QhZPRk+abwQdMiVNzIz65fWV59Z4BwYZGruJ7igjjL7u0AW+iabq9FVZZdPC9rP2hnf9hqurFVuYEFBz07wxGx8mQKWcUGFUIwVpRn0IeJuI3JJFVVI9Rc8RYq71bemE7Lhd3hVZfxU3KhdTxE6Q8dF14lxryLQcQVa2jXqArwDkWcYDqFA7j6LYL4pSeuIMvKvIrzUNzWk3yw1W7DfVYB6llXscYX4XWYua9ry68az6N1zDqSr3b1hQudkkWTjoyfjSr89CoptT2fGZYdahZ49vb38GAxH3+GEqL2I5geFqzJpR1jHVi/HFauzeahdqvsfphU6Splq7Sqp5IubVhqnehETCaYVGUaVXnqmKshRW2myZhMXnKFlWiQXDVayzRpwVpaIkbBxNt/cZvuU4NosukAAAAASUVORK5CYII\u003d",
"displayName": "Custom template created by Luratic",
"id": "brand_dummy"
},
"containerContexts": [
"WEB"
]
}
___TEMPLATE_PARAMETERS___
[
{
"alwaysInSummary": true,
"simpleValueType": true,
"name": "d",
"type": "TEXT",
"displayName": "d:",
"valueValidators": [
{
"type": "NON_EMPTY"
}
]
},
{
"alwaysInSummary": true,
"simpleValueType": true,
"name": "exFargs",
"type": "TEXT",
"displayName": "ex-fargs:",
"valueValidators": [
{
"type": "NON_EMPTY"
}
]
},
{
"alwaysInSummary": true,
"simpleValueType": true,
"name": "exFch",
"type": "TEXT",
"displayName": "ex-fch",
"valueValidators": [
{
"type": "NON_EMPTY"
}
]
},
{
"alwaysInSummary": true,
"simpleValueType": true,
"name": "exSrc",
"type": "TEXT",
"displayName": "ex-src",
"valueValidators": [
{
"type": "NON_EMPTY"
}
]
},
{
"alwaysInSummary": true,
"simpleValueType": true,
"name": "exHargs",
"type": "TEXT",
"displayName": "ex-hargs",
"valueValidators": [
{
"type": "NON_EMPTY"
}
]
}
]
___SANDBOXED_JS_FOR_WEB_TEMPLATE___
// Introduzca aquí su código de plantilla.
//var log = require('logToConsole');
const sendPixel = require('sendPixel');
const getTimestamp = require('getTimestamp');
const encodeUriComponent = require('encodeUriComponent');
const dParameter = encodeUriComponent(data.d);
const exFargs = encodeUriComponent(data.exFargs);
const exFch = encodeUriComponent(data.exFch);
const exSrc = encodeUriComponent(data.exSrc);
const exHargs = encodeUriComponent(data.exHargs);
var trackingUrl = 'https://aax-eu.amazon-adsystem.com/s/iui3?d=' + dParameter + '&ex-fargs=' + exFargs + '&ex-fch=' + exFch + '&ex-src=' + exSrc + '&ex-hargs=' + exHargs;
sendPixel(trackingUrl,data.gtmOnSuccess,data.gtmOnFailure);
___WEB_PERMISSIONS___
[
{
"instance": {
"key": {
"publicId": "send_pixel",
"versionId": "1"
},
"param": [
{
"key": "allowedUrls",
"value": {
"type": 1,
"string": "specific"
}
},
{
"key": "urls",
"value": {
"type": 2,
"listItem": [
{
"type": 1,
"string": "https://aax-eu.amazon-adsystem.com/"
}
]
}
}
]
},
"clientAnnotations": {
"isEditedByUser": true
},
"isRequired": true
}
]
___TESTS___
scenarios:
- name: gtmOnSuccess is invoked on sendPixel success
code: |-
// test that gtmOnSuccess() is called when sendPixel succeeds
mock('sendPixel', (url, onSuccess, onFailure) => {
onSuccess();
});
// Call runCode to run the template's code.
runCode();
// Verify that the tag finished successfully.
assertApi('gtmOnSuccess').wasCalled();
- name: gtmOnFailure is invoked when sendPixel fails
code: |-
// test gtmOnFailure() is called when sendPixel fails
mock('sendPixel', (url, onSuccess, onFailure) => {
onFailure();
});
// Call runCode to run the template's code.
runCode();
// Verify onFailure was called
assertApi('gtmOnFailure').wasCalled();
___NOTES___
Developed with ❤ by: Alfonso, Txema and Brais.
Web: www.luratic.com
Linkedin:
https://www.linkedin.com/in/braiscalvo/
https://www.linkedin.com/in/alfonsorc/
https://www.linkedin.com/in/txema-s%C3%A1nchez-a48482ba/