forked from pinterest/ws-gtm-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.tpl
695 lines (658 loc) · 26.1 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
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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
___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": "pntr",
"version": 1.4,
"securityGroups": [
"NON_GOOGLE_SCRIPTS"
],
"displayName": "Pinterest Tag",
"categories": [
"CONVERSIONS",
"TAG_MANAGEMENT"
],
"brand": {
"thumbnail": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYC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YwQVzABPE9Joj/ZYJYyATxBBPEM92ez5+Vr68WyTn8fflJ7MSB+DeP/G8AiLllTCtHBPYAAAAASUVORK5CYII\u003d",
"displayName": "Pinterest",
"id": "brand_pinterest"
},
"description": "Tag to fire Pinterest events.",
"containerContexts": [
"WEB"
]
}
___TEMPLATE_PARAMETERS___
[
{
"notSetText": "Not set (Required)",
"help": "Enter your tag ID. You can find your tags at https://ads.pinterest.com/conversion_tags/",
"valueValidators": [
{
"type": "NON_EMPTY"
},
{
"args": [
"26\\d{11}"
],
"type": "REGEX"
}
],
"displayName": "Tag ID",
"name": "tagId",
"type": "TEXT",
"valueHint": "Pinterest Tag ID"
},
{
"notSetText": "Not set (required for Enhanced Match)",
"help": "Optional, but required for Enhanced Match. This is the user\u0027s email address, stripped of whitespace, lower-cased, then hashed with MD5, SHA1, or SHA-256. As a fallback, a raw email address can also be used. In this case, we will hash the email address for you, in the browser. (The email address *never* leaves the browser, and Pinterest never sees it.) See https://help.pinterest.com/en/business/article/enhanced-match for more information.",
"displayName": "Hashed Email",
"name": "em",
"type": "TEXT",
"valueHint": "{{email}}"
},
{
"notSetText": "Not set (recommended for Enhanced Match)",
"help": "Optional, but recommended at least on checkout event. This is the sha256 hashes of user's phone numbers, only digits with country code, area code, and number.",
"displayName": "Hashed Phone",
"name": "ph",
"type": "TEXT",
"valueHint": "{{phone}}"
},
{
"macrosInSelect": false,
"selectItems": [
{
"displayValue": "Base Code Only (no event)",
"value": ""
},
{
"displayValue": "Page Visit",
"help": "Track visits to specific pages on your website.",
"value": "pagevisit"
},
{
"displayValue": "Add to Cart",
"value": "addtocart"
},
{
"displayValue": "Checkout",
"value": "checkout"
},
{
"displayValue": "Signup",
"value": "signup"
},
{
"displayValue": "Watch Video",
"value": "watchvideo"
},
{
"displayValue": "Lead",
"value": "lead"
},
{
"displayValue": "Search",
"value": "search"
},
{
"displayValue": "View Category",
"value": "viewcategory"
},
{
"displayValue": "Custom",
"value": "custom"
}
],
"displayName": "Event to Fire",
"name": "eventName",
"type": "SELECT"
},
{
"help": "Enter optional order information here. Setting these values is highly recommended to improve conversions and reporting.",
"enablingConditions": [
{
"paramName": "eventName",
"type": "EQUALS",
"paramValue": "checkout"
},
{
"paramName": "eventName",
"type": "EQUALS",
"paramValue": "addtocart"
}
],
"displayName": "Cart Parameters",
"name": "checkout",
"groupStyle": "NO_ZIPPY",
"type": "GROUP",
"subParams": [
{
"help": "Make sure to set a currency code to ensure proper currency conversion; otherwise, we\u0027ll default to USD.",
"displayName": "Order Value",
"name": "value",
"type": "TEXT"
},
{
"help": "Must be one of USD, GBP, CAD, EUR, AUD or NZD. If you don\u0027t set a currency code, we\u0027ll default to USD.",
"valueValidators": [
{
"args": [
3,
3
],
"errorMessage": "Please enter a valid currency.",
"type": "STRING_LENGTH"
}
],
"displayName": "Currency",
"name": "currency",
"type": "TEXT"
},
{
"valueValidators": [
{
"type": "NUMBER"
}
],
"displayName": "Order Quantity",
"name": "order_quantity",
"type": "TEXT"
},
{
"displayName": "Order ID",
"simpleValueType": true,
"name": "order_id",
"type": "TEXT"
}
]
},
{
"help": "These fields are required for dynamic retargeting on Pinterest. Optional otherwise.",
"enablingConditions": [
{
"paramName": "eventName",
"type": "EQUALS",
"paramValue": "pagevisit"
},
{
"paramName": "eventName",
"type": "EQUALS",
"paramValue": "addtocart"
},
{
"paramName": "eventName",
"type": "EQUALS",
"paramValue": "checkout"
}
],
"displayName": "Line Items",
"name": "line_items",
"groupStyle": "NO_ZIPPY",
"type": "GROUP",
"subParams": [
{
"displayName": "Product ID",
"simpleValueType": true,
"name": "product_id",
"type": "TEXT"
},
{
"displayName": "Product Category",
"simpleValueType": true,
"name": "product_category",
"type": "TEXT"
}
]
},
{
"help": "Optional field to set the lead type.",
"enablingConditions": [
{
"paramName": "eventName",
"type": "EQUALS",
"paramValue": "lead"
},
{
"paramName": "eventName",
"type": "EQUALS",
"paramValue": "signup"
}
],
"displayName": "Lead Type",
"name": "lead_type",
"type": "TEXT"
},
{
"help": "Search Keywords",
"enablingConditions": [
{
"paramName": "eventName",
"type": "EQUALS",
"paramValue": "search"
}
],
"displayName": "Search Query",
"name": "search_query",
"type": "TEXT"
},
{
"enablingConditions": [
{
"paramName": "eventName",
"type": "NOT_EQUALS",
"paramValue": ""
}
],
"name": "setCustomParams",
"checkboxText": "Custom Parameters",
"type": "CHECKBOX",
"subParams": [
{
"enablingConditions": [
{
"paramName": "setCustomParams",
"type": "EQUALS",
"paramValue": true
}
],
"displayName": "",
"name": "customParameters",
"groupStyle": "NO_ZIPPY",
"type": "GROUP",
"subParams": [
{
"name": "values",
"simpleTableColumns": [
{
"selectItems": [],
"defaultValue": "",
"displayName": "Name",
"name": "name",
"type": "TEXT"
},
{
"defaultValue": "",
"displayName": "Value",
"name": "value",
"type": "TEXT"
}
],
"type": "SIMPLE_TABLE"
}
]
}
]
},
{
"type": "CHECKBOX",
"name": "setOptOut",
"checkboxText": "Opt Out Information",
"simpleValueType": true,
"help": "If checked, you could set the Opt Out Information for Privacy regulations such as CCPA."
},
{
"help": "'opt_out_type' is the field where we accept opt outs for your users' privacy preference. \u003cbr\u003e\u003cbr\u003e It can handle multiple values with commas separated. Current accepted value is \u003cb\u003eLDP\u003c/b\u003e for Limited Data Processing.",
"displayName": "Opt Out Type",
"name": "opt_out_type",
"type": "TEXT",
"enablingConditions": [
{
"paramName": "setOptOut",
"type": "EQUALS",
"paramValue": true
}
]
},
{
"help": "'st' is the field for sharing a user's \u003cb\u003estate of residency\u003c/b\u003e in connection with use of the LDP flag. Please note that the LDP flag does not currently have any effect for users outside of the State of California. \u003cbr\u003e\u003cbr\u003e The state names we accept are SHA256 hashed, standard USPS state abbreviations with two characters (e.g., 'CA').",
"displayName": "State",
"name": "st",
"type": "TEXT",
"enablingConditions": [
{
"paramName": "setOptOut",
"type": "EQUALS",
"paramValue": true
}
]
},
{
"help": "'country' is the field in which you pass a user’s country of residency in connection with use of the LDP flag. Please note that the LDP flag does not currently have any effect for users outside of the State of California. \u003cbr\u003e\u003cbr\u003e The country names we accept are SHA256 hashed, standard ISO-3166 country codes with two characters (e.g., 'US', 'DE').",
"displayName": "Country",
"name": "country",
"type": "TEXT",
"enablingConditions": [
{
"paramName": "setOptOut",
"type": "EQUALS",
"paramValue": true
}
]
},
{
"type": "LABEL",
"name": "aem_upsell",
"displayName": "\u003cb\u003eEnable automatic enhanced match? \u003c/b\u003eAutomatic enhanced match can help attribute more conversions to your Pinterest ads and increase audience sizes. Navigate to \u003ca href\u003d\"https://ads.pinterest.com/conversions/tag\"\u003ePinterest Ads Manager\u003c/a\u003e to enable. \u003ca href\u003d\"https://help.pinterest.com/business/article/automatic-enhanced-match\"\u003eLearn more\u003c/a\u003e\u003c/br\u003e"
}
]
___SANDBOXED_JS_FOR_WEB_TEMPLATE___
const copyFromWindow = require('copyFromWindow');
const createArgumentsQueue = require('createArgumentsQueue');
const injectScript = require('injectScript');
const log = require('logToConsole');
const makeTableMap = require('makeTableMap');
/**
* This GTM snippet takes care of loading the Pinterest tag and firing events.
* It is roughly equivalent to installing the Pinterest Tag base code and then
* using pintrk() to fire events. It will do the base tag functionality only
* once so you can load and call this multiple times without worrying multiple
* loads, etc.
*/
log('GTM PTag v1.4; tagId: ' + data.tagId);
// Check to see if we've already created the queue.
const isFirstLoad = !copyFromWindow('pintrk');
// Set up window.pintrk. Won't re-create if it already exists.
const pintrk = createArgumentsQueue('pintrk', 'pintrk.queue');
/**
* First-time Load/Initialization.
*/
if (isFirstLoad) {
// OK to call 'load' and 'page' events before injecting script,
// it will process existing items in the queue on load.
const initializationData = {
'np': 'gtm',
};
if (data.em) {
initializationData.em = data.em;
}
if (data.ph) {
initializationData.ph = data.ph;
}
// Set opt_out params
setOptOutParams(data, initializationData);
pintrk('load', data.tagId.toString(), initializationData);
pintrk('page');
} else {
const partnerDataUpdate = {};
if (data.em) {
partnerDataUpdate.em = data.em;
}
if (data.ph) {
partnerDataUpdate.ph = data.ph;
}
// Override opt_out params
overrideOptOutParams(data, partnerDataUpdate);
pintrk('set', partnerDataUpdate);
}
// Special case: this if block is written to handle the case where the base
// code is fired after another event, which would cause isFirstLoad to run
// but not include config values
if (data.eventName === "") {
const partnerDataUpdate = {};
setOptOutParams(data, partnerDataUpdate);
pintrk('set', partnerDataUpdate);
}
// Set opt_out params
function setOptOutParams(data, pdObject) {
if (data.setOptOut) {
if (data.opt_out_type) {
pdObject.opt_out_type = data.opt_out_type;
}
if (data.st) {
pdObject.st = data.st;
}
if (data.country) {
pdObject.country = data.country;
}
}
}
// Override opt_out params
function overrideOptOutParams(data, pdObject) {
if (data.setOptOut) {
pdObject.opt_out_type = data.opt_out_type ? data.opt_out_type : undefined;
pdObject.st = data.st ? data.st : undefined;
pdObject.country = data.country ? data.country : undefined;
} else {
pdObject.opt_out_type = undefined;
pdObject.st = undefined;
pdObject.country = undefined;
}
}
/**
* Define function to setup event data and call pintrk() as needed.
* Intentionally verbose for completeness.
*/
const onSuccess = function() {
let eventData = {};
// Copy custom parameters, if any, into eventData.
// We do this first so that in case someone has defined
// a custom parameter with the same name as a top-level
// field, then the top-level field will take precedence.
if (data.setCustomParams) {
eventData = makeTableMap(data.values, 'name', 'value');
}
// In the extremely unlikely event that someone has created a 'np'
// custom field, we make sure to override that.
eventData.np = 'gtm';
const safeCopyField = (fieldName) => {
if (data[fieldName] !== undefined) {
eventData[fieldName] = data[fieldName];
}
};
const safeCopyLineItem = (fieldName) => {
if (data[fieldName] !== undefined) {
if (eventData.line_items === undefined) {
eventData.line_items = [{}];
}
eventData.line_items[0][fieldName] = data[fieldName];
}
};
switch (data.eventName) {
case 'watchvideo': // No fields defined.
case 'viewcategory': // No fields defined.
case 'custom': // Only custom fields, none preconfigured.
break;
case 'signup': // Signup and Lead share the same single field.
case 'lead':
safeCopyField('lead_type');
break;
case 'search':
safeCopyField('search_query');
break;
case 'addtocart': // AddToCart and Checkout share the same fields.
case 'checkout':
safeCopyField('order_id');
safeCopyField('order_quantity');
safeCopyField('value');
safeCopyField('currency');
// Intentional fall-through, page vist has only ID and category.
case 'pagevisit':
safeCopyLineItem('product_id');
safeCopyLineItem('product_category');
break;
default:
// Just fallthrough as server-side code will take care of
// emitting an error message to the console.
break;
}
if (data.eventName !== '') {
log('Firing Pinterest event: ' + data.eventName);
log('Event Data:');
log(eventData);
pintrk('track', data.eventName, eventData);
}
data.gtmOnSuccess();
};
/**
* Failure callback; server-size JS didn't load, log error and exit.
*/
const onFailure = function() {
log('Pinterest Error: Loading JS failed!');
data.gtmOnFailure();
};
// Async load
injectScript("https://s.pinimg.com/ct/core.js", onSuccess, onFailure, 'PinterestJS');
___WEB_PERMISSIONS___
[
{
"instance": {
"key": {
"publicId": "access_globals",
"versionId": "1"
},
"param": [
{
"key": "keys",
"value": {
"type": 2,
"listItem": [
{
"type": 3,
"mapKey": [
{
"type": 1,
"string": "key"
},
{
"type": 1,
"string": "read"
},
{
"type": 1,
"string": "write"
},
{
"type": 1,
"string": "execute"
}
],
"mapValue": [
{
"type": 1,
"string": "pintrk"
},
{
"type": 8,
"boolean": true
},
{
"type": 8,
"boolean": true
},
{
"type": 8,
"boolean": true
}
]
},
{
"type": 3,
"mapKey": [
{
"type": 1,
"string": "key"
},
{
"type": 1,
"string": "read"
},
{
"type": 1,
"string": "write"
},
{
"type": 1,
"string": "execute"
}
],
"mapValue": [
{
"type": 1,
"string": "pintrk.queue"
},
{
"type": 8,
"boolean": true
},
{
"type": 8,
"boolean": true
},
{
"type": 8,
"boolean": true
}
]
}
]
}
}
]
},
"clientAnnotations": {
"isEditedByUser": true
},
"isRequired": true
},
{
"instance": {
"key": {
"publicId": "logging",
"versionId": "1"
},
"param": [
{
"key": "environments",
"value": {
"type": 1,
"string": "debug"
}
}
]
},
"clientAnnotations": {
"isEditedByUser": true
},
"isRequired": true
},
{
"instance": {
"key": {
"publicId": "inject_script",
"versionId": "1"
},
"param": [
{
"key": "urls",
"value": {
"type": 2,
"listItem": [
{
"type": 1,
"string": "https://s.pinimg.com/ct/core.js"
}
]
}
}
]
},
"clientAnnotations": {
"isEditedByUser": true
},
"isRequired": true
}
]
___TESTS___
scenarios: []
___NOTES___
Points of Contact:
Yuchen Mou <ymou@pinterest.com>
Jian Li <jianli@pinterest.com>
Mirko Rodriguez Mallma <mrodriguezmallma@pinterest.com>
Created on 2/19/2019, 9:22:34 PM
Updated on 07/19/2023, 3:40:00 PM