-
Notifications
You must be signed in to change notification settings - Fork 1
/
template.tpl
1732 lines (1612 loc) · 54.5 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
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
___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": "Intercom",
"categories": [
"CHAT",
"EMAIL_MARKETING",
"LEAD_GENERATION",
"MARKETING",
"PERSONALIZATION",
"SALES"
],
"brand": {
"id": "brand_intercom",
"displayName": "Intercom",
"thumbnail": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPUAAAD1CAYAAACIsbNlAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAmaSURBVHgB7d1NchvHGcbxh7GrsrSUC3iYA9h0DhCCziKpysLKNgtzkgPIvgGhXMDyCUhdIJGW2YjQLitH8gGE0c4ri156Q7rf6pkCTHwDPYOeF/9f1VuQiCliCMyD7pnp6ZEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFjmSIetCHUS6kH9b/TT+1DvQt2Eel0/HqxDC7WFdxDqvH58IHg0CvU81ItQleCShfdC8Rv9jjqouhS9MHcGocbq14ZIpa1bxS91OGAfZB82Oqqbeita7V67VL82OKqbItg99Y36taFR3RbB7pkL9WsDo/ZTFmyXZz8+kC+F4qkMYJWHoX4b6r9yxtt56rHoVmF91mJ/rnhe243fyI9SBBqbsUbtQs54aqlppbENd621l5Z6IAKN7VjD9liOeAl1KWB7Azk6Eu4l1KcCtmeBPpETHkLNZZNIgVBnxM2Hgb2x/epP5ISHUBcCdlfICU/nqQGIUAPuEGrfniiOcT6q60xM7+Meofbrs1BD/XoSvlGo41DPBLc+FPbJAtdcVVYoDoJIwVro10ue/zrUF9p9wIWt/7P6tT5S/CI5F7CjUv26jrep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6krAbuwMwhs54SHUzdFfYBduenxe9qk3vbMDMK0K9UpOeAn1cwHbG8kRTxcVXGv+PaWBZWx/2uYSr+SEp1NaTwRsznp5lRzxdvmfXWlzJmA97lpp423wid1S9r2A1SzQ1rur5MwH8sVOb/0c6i8Clvt/qL/LIW+hNv9T3K0YCJhvHOqvcnrTeo+hNiPFYJ+Kif/wa3a3kT/J8YAlr6E2o1A/hfqzCDbiPrQd6bYW+geh12zurOZeVDnPkUW1U80N77u+jQ86UCp2vQj3YYX5Qgc2f9ohdkttiqAy1B/FXFse2cEv62bbWO4XcnowbJlD39dsZsXc9a6R2K/mSj2u2AMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIBO/AH09aFEvKovxAAAAAElFTkSuQmCC"
},
"description": "Install and get the most out of Intercom\u0027s Messenger on your website.",
"containerContexts": [
"WEB"
]
}
___TEMPLATE_PARAMETERS___
[
{
"type": "GROUP",
"name": "method_group",
"displayName": "Method",
"groupStyle": "NO_ZIPPY",
"subParams": [
{
"type": "SELECT",
"name": "method",
"displayName": "",
"macrosInSelect": false,
"selectItems": [
{
"value": "install",
"displayValue": "Install"
},
{
"value": "boot",
"displayValue": "Boot"
},
{
"value": "shutdown",
"displayValue": "Shutdown"
},
{
"value": "update",
"displayValue": "Update"
},
{
"value": "hide",
"displayValue": "Hide"
},
{
"value": "show",
"displayValue": "Show"
},
{
"value": "showMessages",
"displayValue": "Show Messages"
},
{
"value": "showNewMessage",
"displayValue": "Show New Message"
},
{
"value": "onHide",
"displayValue": "On Hide"
},
{
"value": "onShow",
"displayValue": "On Show"
},
{
"value": "onUnreadCountChange",
"displayValue": "On Unread Count Change"
},
{
"value": "trackEvent",
"displayValue": "Track Event"
},
{
"value": "startTour",
"displayValue": "Start Tour"
},
{
"value": "showSpace",
"displayValue": "Show Space"
}
],
"simpleValueType": true,
"alwaysInSummary": true,
"help": "",
"valueValidators": [
{
"type": "NON_EMPTY"
}
],
"defaultValue": "install"
},
{
"type": "LABEL",
"name": "install_label",
"displayName": "Install Intercom on the current page.",
"enablingConditions": [
{
"paramName": "method",
"paramValue": "install",
"type": "EQUALS"
}
]
},
{
"type": "LABEL",
"name": "boot_label",
"displayName": "If you\u0027d like to control when Intercom is loaded, you can use the \u0027boot\u0027 method. \nThis is useful in situations like a one-page JavaScript based application where the user may not be logged in when the page loads.",
"enablingConditions": [
{
"paramName": "method",
"paramValue": "boot",
"type": "EQUALS"
}
]
},
{
"type": "LABEL",
"name": "shutdown_label",
"displayName": "If you have the Inbox product (combined with another product like Messages) you should call the Intercom shutdown method to clear your users’ conversations anytime they logout of your application. Otherwise, the cookie we use to track who was most recently logged in on a given device or computer will keep these conversations in the Messenger for one week. This method will effectively clear out any user data that you have been passing through the tag.",
"enablingConditions": [
{
"paramName": "method",
"paramValue": "shutdown",
"type": "EQUALS"
}
]
},
{
"type": "LABEL",
"name": "update_label",
"displayName": "Calling the update method with some new user data will trigger Intercom to look for new messages that should be displayed to the current user and show them if they exist.",
"enablingConditions": [
{
"paramName": "method",
"paramValue": "update",
"type": "EQUALS"
}
]
},
{
"type": "LABEL",
"name": "hide_label",
"displayName": "This will hide the main Messenger panel if it is open. It will not hide the Messenger Launcher.",
"enablingConditions": [
{
"paramName": "method",
"paramValue": "hide",
"type": "EQUALS"
}
]
},
{
"type": "LABEL",
"name": "show_label",
"displayName": "This will show the Messenger. If there are no new conversations, it will open to the Messenger Home. If there are, it will open with the message list.",
"enablingConditions": [
{
"paramName": "method",
"paramValue": "show",
"type": "EQUALS"
}
]
},
{
"type": "LABEL",
"name": "showMessages_label",
"displayName": "This will open the Messenger with the message list.",
"enablingConditions": [
{
"paramName": "method",
"paramValue": "showMessages",
"type": "EQUALS"
}
]
},
{
"type": "LABEL",
"name": "showNewMessage_label",
"displayName": "This will open the Messenger as if a new conversation was just created.",
"enablingConditions": [
{
"paramName": "method",
"paramValue": "showNewMessage",
"type": "EQUALS"
}
]
},
{
"type": "LABEL",
"name": "onShow_label",
"displayName": "When we show the messenger, you can trigger a custom event.",
"enablingConditions": [
{
"paramName": "method",
"paramValue": "onShow",
"type": "EQUALS"
}
]
},
{
"type": "LABEL",
"name": "onHide_label",
"displayName": "When we hide the messenger, you can trigger a custom event.",
"enablingConditions": [
{
"paramName": "method",
"paramValue": "onHide",
"type": "EQUALS"
}
]
},
{
"type": "LABEL",
"name": "onUnreadCountChange_label",
"displayName": "This method allows you to register a custom event that will be triggered immediately when invoked, and again whenever the current number of unread messages changes.\nThe new “unread count” will be available as a dataLayer variable named “intercom_unread_count”.",
"enablingConditions": [
{
"paramName": "method",
"paramValue": "onUnreadCountChange",
"type": "EQUALS"
}
]
},
{
"type": "LABEL",
"name": "trackEvent_label",
"displayName": "You can submit an event using the trackEvent method. This will associate the event with the currently logged in user and send it to Intercom.",
"enablingConditions": [
{
"paramName": "method",
"paramValue": "trackEvent",
"type": "EQUALS"
}
]
},
{
"type": "LABEL",
"name": "startTour_label",
"displayName": "If you would like to trigger a tour based on an action a user or visitor takes in your site or application, you can use this method.",
"enablingConditions": [
{
"paramName": "method",
"paramValue": "startTour",
"type": "EQUALS"
}
]
},
{
"type": "LABEL",
"name": "showSpace_label",
"displayName": "If you would like to open a particular Messenger space.",
"enablingConditions": [
{
"paramName": "method",
"paramValue": "showSpace",
"type": "EQUALS"
}
]
}
],
"help": "Either simply install the Messenger or perform other methods as documented in https://developers.intercom.com/installing-intercom/docs/intercom-javascript"
},
{
"type": "GROUP",
"name": "method_arguments",
"displayName": "Method Arguments",
"groupStyle": "ZIPPY_OPEN",
"subParams": [
{
"type": "GROUP",
"name": "install_boot_update_arguments",
"displayName": "",
"groupStyle": "NO_ZIPPY",
"subParams": [
{
"type": "TEXT",
"name": "app_id",
"displayName": "Workspace ID",
"simpleValueType": true,
"alwaysInSummary": false,
"notSetText": "Workspace ID is required for Messenger installation",
"help": "Your App ID is available in Intercom in Settings -\u003e Installation -\u003e Web",
"enablingConditions": [
{
"paramName": "method",
"paramValue": "install",
"type": "EQUALS"
},
{
"paramName": "method",
"paramValue": "update",
"type": "EQUALS"
},
{
"paramName": "method",
"paramValue": "boot",
"type": "EQUALS"
}
]
},
{
"type": "CHECKBOX",
"name": "log_impression",
"checkboxText": "Log impression at the current URL",
"simpleValueType": true,
"displayName": "Log Impression",
"enablingConditions": [
{
"paramName": "method",
"paramValue": "update",
"type": "EQUALS"
}
],
"help": "When checked, this will add a record showing that the user has visited this URL"
},
{
"type": "GROUP",
"name": "data_attributes",
"displayName": "Data Attributes",
"groupStyle": "ZIPPY_CLOSED",
"subParams": [
{
"type": "LABEL",
"name": "data_attributes_help",
"displayName": "These attributes are used to update user/lead information. \nPlease see https://developers.intercom.com/installing-intercom/docs/javascript-api-attributes-objects#section-data-attributes for detailed information."
},
{
"type": "TEXT",
"name": "email",
"displayName": "User Email",
"simpleValueType": true,
"help": "(Optional) Bind this to a variable that would hold the email address of the currently logged-in user (Only applicable to users). \nImportant: Do not enter a specific email address, as this address would apply to all your visitors and skew your data.",
"valueValidators": [],
"valueHint": "Choose a variable"
},
{
"type": "TEXT",
"name": "user_id",
"displayName": "User ID",
"simpleValueType": true,
"help": "(Optional) Bind this to a variable that would hold the \"User ID\" value of the currently logged-in user (Only applicable to users). \nImportant: Do not enter a specific user ID, as this ID would apply to all your visitors and skew your data.",
"valueValidators": [],
"valueHint": "Choose a variable"
},
{
"type": "TEXT",
"name": "created_at",
"displayName": "User Sign-Up Timestamp",
"simpleValueType": true,
"help": "(Optional) Bind this to a variable that would hold the Unix timestamp (in seconds) when the user signed up to your app (Only applicable to users)",
"valueValidators": [
{
"type": "POSITIVE_NUMBER"
}
],
"valueHint": "Choose a variable",
"valueUnit": "Unix timestamp (in seconds)"
},
{
"type": "TEXT",
"name": "name",
"displayName": "Name",
"simpleValueType": true,
"help": "(Optional) Bind this to a variable that would hold name of the current user/lead.\nImportant: Do not enter a specific name, as this would apply to all your visitors/users and skew your data.",
"valueValidators": [],
"valueHint": "Choose a variable"
},
{
"type": "TEXT",
"name": "phone",
"displayName": "Phone Number",
"simpleValueType": true,
"help": "(Optional) Bind this to a variable that would hold phone number of the current user/lead.\nImportant: Do not enter a specific phone number, as this number would apply to all your visitors/users and skew your data.",
"valueValidators": [],
"valueHint": "Choose a variable"
},
{
"type": "TEXT",
"name": "user_hash",
"displayName": "User Hash (Identity Verification)",
"simpleValueType": true,
"help": "(Optional) Bind this to a variable that would hold the \"user hash\" of the currently logged-in user (Only applicable to users).\nSee more details here: https://docs.intercom.com/configure-intercom-for-your-product-or-site/staying-secure/enable-identity-verification-on-your-web-product",
"valueValidators": [],
"valueHint": "Choose a variable"
},
{
"type": "TEXT",
"name": "avatar_image_url",
"displayName": "Avatar Image URL",
"simpleValueType": true,
"help": "(Optional) The avatar/profile picture of the user. Note: must be HTTPS.",
"valueValidators": [],
"valueHint": "Choose a variable"
},
{
"type": "SIMPLE_TABLE",
"name": "company",
"displayName": "Company Attributes",
"simpleTableColumns": [
{
"defaultValue": "",
"displayName": "Attribute Name",
"name": "attr_key",
"type": "SELECT",
"isUnique": true,
"macrosInSelect": true,
"selectItems": [
{
"value": "company_id",
"displayValue": "Company ID"
},
{
"value": "created_at",
"displayValue": "Created At (Unix Timestamp)"
},
{
"value": "name",
"displayValue": "Company Name"
},
{
"value": "monthly_spend",
"displayValue": "Monthly Spend"
},
{
"value": "plan",
"displayValue": "Plan"
},
{
"value": "size",
"displayValue": "Size"
},
{
"value": "website",
"displayValue": "Website"
},
{
"value": "industry",
"displayValue": "Industry"
}
]
},
{
"defaultValue": "",
"displayName": "Attribute Value",
"name": "attr_value",
"type": "TEXT"
},
{
"defaultValue": "gtm",
"displayName": "Installation type",
"name": "installation_type",
"type": "TEXT"
}
],
"help": "Current user\u0027s company (Only applicable to users). Use variables as Attribute Name to specify custom company attributes.\nSee https://developers.intercom.com/installing-intercom/docs/javascript-api-attributes-objects#section-company-object for more details."
}
],
"enablingConditions": [
{
"paramName": "method",
"paramValue": "install",
"type": "EQUALS"
},
{
"paramName": "method",
"paramValue": "update",
"type": "EQUALS"
},
{
"paramName": "method",
"paramValue": "boot",
"type": "EQUALS"
}
],
"help": "(Optional) These attributes are used to update user/lead information. Please see https://developers.intercom.com/installing-intercom/docs/javascript-api-attributes-objects#section-data-attributes for detailed information."
},
{
"type": "GROUP",
"name": "custom_attributes_section",
"displayName": "Custom Data Attributes",
"groupStyle": "ZIPPY_CLOSED",
"subParams": [
{
"type": "SIMPLE_TABLE",
"name": "custom_attributes",
"displayName": "Custom Attributes",
"simpleTableColumns": [
{
"defaultValue": "",
"displayName": "Attribute Name",
"name": "attr_key",
"type": "TEXT"
},
{
"defaultValue": "",
"displayName": "Attribute Value",
"name": "attr_value",
"type": "TEXT"
}
],
"enablingConditions": [],
"help": ""
}
],
"enablingConditions": [
{
"paramName": "method",
"paramValue": "install",
"type": "EQUALS"
},
{
"paramName": "method",
"paramValue": "update",
"type": "EQUALS"
},
{
"paramName": "method",
"paramValue": "boot",
"type": "EQUALS"
}
]
}
]
},
{
"type": "TEXT",
"name": "prepopulated_message",
"displayName": "Pre-Populate Message",
"simpleValueType": true,
"enablingConditions": [
{
"paramName": "method",
"paramValue": "showNewMessage",
"type": "EQUALS"
}
],
"help": "(Optional) Pre-populate the message composer (only possible with Intercom\u0027s Inbox Essential \u0026 Pro product)"
},
{
"type": "TEXT",
"name": "callback_event_name",
"displayName": "Event Name",
"simpleValueType": true,
"notSetText": "Event name is required for this method",
"enablingConditions": [
{
"paramName": "method",
"paramValue": "onHide",
"type": "EQUALS"
},
{
"paramName": "method",
"paramValue": "onShow",
"type": "EQUALS"
},
{
"paramName": "method",
"paramValue": "onUnreadCountChange",
"type": "EQUALS"
}
],
"help": "Trigger a dataLayer event when we hide/show the messenger or whenever the current number of unread messages changes.",
"valueValidators": [
{
"type": "NON_EMPTY"
}
]
},
{
"type": "TEXT",
"name": "event_name",
"displayName": "Event Name",
"simpleValueType": true,
"notSetText": "Event name is required for this method",
"enablingConditions": [
{
"paramName": "method",
"paramValue": "trackEvent",
"type": "EQUALS"
}
],
"valueValidators": [
{
"type": "NON_EMPTY"
}
]
},
{
"type": "SIMPLE_TABLE",
"name": "event_attributes",
"displayName": "Event Attributes",
"simpleTableColumns": [
{
"defaultValue": "",
"displayName": "Attribute Name",
"name": "attr_key",
"type": "TEXT"
},
{
"defaultValue": "",
"displayName": "Attribute Value",
"name": "attr_value",
"type": "TEXT"
}
],
"enablingConditions": [
{
"paramName": "method",
"paramValue": "trackEvent",
"type": "EQUALS"
}
],
"help": "(Optional) You can add custom information to events in the form of event metadata."
},
{
"type": "TEXT",
"name": "tour_id",
"displayName": "Tour ID",
"simpleValueType": true,
"notSetText": "You need to call this method with the id of the tour you wish to show.",
"enablingConditions": [
{
"paramName": "method",
"paramValue": "startTour",
"type": "EQUALS"
}
],
"help": "The ID of the tour you wish to show. \nThe ID of the tour can be found in the “Use tour everywhere” section of the tour editor.",
"valueValidators": [
{
"type": "POSITIVE_NUMBER"
}
]
},
{
"type": "TEXT",
"name": "space_name",
"displayName": "Space Name",
"simpleValueType": true,
"notSetText": "You need to call this method with the name of the space you wish to show.",
"enablingConditions": [
{
"paramName": "method",
"paramValue": "showSpace",
"type": "EQUALS"
}
],
"help": "The name of the space you wish to show. \nThe name of the space can be 'home', 'messages', 'news' or 'help'.",
"valueValidators": [
{
"type": "NON_EMPTY"
}
]
}
],
"enablingConditions": [
{
"paramName": "method",
"paramValue": "install",
"type": "EQUALS"
},
{
"paramName": "method",
"paramValue": "update",
"type": "EQUALS"
},
{
"paramName": "method",
"paramValue": "boot",
"type": "EQUALS"
},
{
"paramName": "method",
"paramValue": "showNewMessage",
"type": "EQUALS"
},
{
"paramName": "method",
"paramValue": "onShow",
"type": "EQUALS"
},
{
"paramName": "method",
"paramValue": "onHide",
"type": "EQUALS"
},
{
"paramName": "method",
"paramValue": "onUnreadCountChange",
"type": "EQUALS"
},
{
"paramName": "method",
"paramValue": "trackEvent",
"type": "EQUALS"
},
{
"paramName": "method",
"paramValue": "startTour",
"type": "EQUALS"
},
{
"paramName": "method",
"paramValue": "showSpace",
"type": "EQUALS"
}
]
}
]
___SANDBOXED_JS_FOR_WEB_TEMPLATE___
// Enter your template code here.
const log = require('logToConsole');
const encodeUriComponent = require('encodeUriComponent');
const copyFromWindow = require('copyFromWindow');
const callInWindow = require('callInWindow');
const setInWindow = require('setInWindow');
const injectScript = require('injectScript');
const makeInteger = require('makeInteger');
const createQueue = require('createQueue');
const dataLayerPush = createQueue('dataLayer');
const makeTableMap = require('makeTableMap');
log('data =', data);
const DATA_ATTRS = ['email', 'user_id', 'created_at', 'name', 'phone', 'unsubscribed_from_emails', 'language_override', 'avatar_image_url', 'user_hash', 'company', 'companies'];
const COMPANY_INT_FIELDS = ['created_at', 'monthly_spend', 'size'];
function getDataAttrs(data) {
var data_attrs = DATA_ATTRS.reduce( (res, attr) => {
if (data[attr]) {
var attr_val = data[attr];
if (attr == 'avatar_image_url') {
attr_val = {
type: 'avatar',
image_url: data[attr]
};
attr = 'avatar';
} else if (attr == 'company') {
attr_val = makeTableMap(data[attr], 'attr_key', 'attr_value') || {};
}
res[attr] = attr_val;
}
return res;
}, {});
return data_attrs;
}
function setOrUpdateIntercomSettings(data) {
var data_attrs = getDataAttrs(data);
if (data.app_id) {
data_attrs.app_id = data.app_id;
}
var settings = copyFromWindow('intercomSettings') || {};
for (var k in data_attrs) {
settings[k] = data_attrs[k];
}
if (data.custom_attributes) {
var custom_attrs = makeTableMap(data.custom_attributes, 'attr_key', 'attr_value') || {};
for (k in custom_attrs) {
settings[k] = custom_attrs[k];
}
}
settings.installation_type = 'gtm';
setInWindow('intercomSettings', settings, true);
return settings;
}
function setPlaceholderEventQueue() {
log("setPlaceholderEventQueue");
const queue = (params)=>{
callInWindow('Intercom.q.push', params);
};
setInWindow('Intercom', function(params){
queue(arguments);
});
setInWindow('Intercom.q', []);
}
function getIntercom() {
var ic = copyFromWindow("Intercom");
if (typeof ic !== "function") {
setPlaceholderEventQueue();
ic = copyFromWindow("Intercom");
}
return ic;
}
function onLoadSuccess() {
var ic = copyFromWindow("Intercom");
log("Intercom loaded:", ic);
data.gtmOnSuccess();
}
function onLoadFailure() {
log("Failed loading Intercom");
data.gtmOnFailure();
}
function updateMessenger(intercomSettings) {
log("Updating Messenger settings");
callInWindow('Intercom', 'reattach_activator');
callInWindow('Intercom', 'update', intercomSettings);
}
function loadMessenger() {
var app_id = data.app_id;
if (!app_id) {
data.gtmOnFailure();
return;
}
const url = 'https://widget.intercom.io/widget/' + encodeUriComponent(app_id);
injectScript(url, onLoadSuccess, onLoadFailure, url);
}
function install(ic, settings) {
loadMessenger();
}
function update(ic, settings) {
log("Updating Messenger settings: ", settings);
if (data.log_impression) {
ic(data.method, settings);
} else {
ic(data.method);
}
data.gtmOnSuccess();
}
function boot(ic, settings) {
if (!data.app_id) {
log("Boot failed - Workspace ID missing: ", settings);
data.gtmOnFailure();
return;
}
log("Booting Messenger, settings: ", settings);
ic(data.method, settings);
data.gtmOnSuccess();
}
function invokeMethod(ic, settings) {
log("Invoking method: ", data.method);
ic(data.method);
data.gtmOnSuccess();
}
function showNewMessage(ic, settings) {
if (data.prepopulated_message) {
ic(data.method, data.prepopulated_message);
} else {
ic(data.method);
}
data.gtmOnSuccess();
}
function registerCallback(ic, settings) {
var method = data.method;
var callbackEventName = data.callback_event_name;
log("registering callback: ", method, callbackEventName);
if (!method || !callbackEventName) {
data.gtmOnFailure();
return;
}
var callback = function(p) {
log("Callback fired: ", method, callbackEventName);
var dataToPush = {'event': callbackEventName};
if (method === 'onUnreadCountChange') {
dataToPush.intercom_unread_count = p;
}
dataLayerPush(dataToPush);
};
ic(method, callback);
data.gtmOnSuccess();
}
function trackEvent(ic, settings) {
var event_name = data.event_name;
if (!event_name) {
data.gtmOnFailure();
return;
}
var event_attrs = {};
if (data.event_attributes) {
event_attrs = makeTableMap(data.event_attributes, 'attr_key', 'attr_value');
}
ic(data.method, event_name, event_attrs);
data.gtmOnSuccess();
}
function startTour(ic, settings) {
if (!data.tour_id) {
data.gtmOnFailure();
return;
}
var tour_id = makeInteger(data.tour_id);
log('startTour: ', tour_id);
ic(data.method, tour_id);
data.gtmOnSuccess();
}
function showSpace(ic, settings) {
var space_name = data.space_name;
if (!space_name) {
data.gtmOnFailure();
return;
}
log('showSpace: ', space_name);
ic(data.method, space_name);
data.gtmOnSuccess();
}
var methodMap = {
install: install,
update: update,
boot: boot,
shutdown: invokeMethod,
hide: invokeMethod,
show: invokeMethod,
showMessages: invokeMethod,
showNewMessage: showNewMessage,
onShow: registerCallback,
onHide: registerCallback,
onUnreadCountChange: registerCallback,
trackEvent: trackEvent,
startTour: startTour,
showSpace: showSpace,
};
function main() {
let settings = setOrUpdateIntercomSettings(data);
var ic = getIntercom();
let methodFunc = methodMap[data.method];
if (!methodFunc) {
data.gtmOnFailure();
return;
}
methodFunc(ic, settings);
}
main();
___WEB_PERMISSIONS___
[
{
"instance": {
"key": {
"publicId": "logging",
"versionId": "1"
},
"param": [
{
"key": "environments",
"value": {
"type": 1,
"string": "debug"
}
}
]
},
"clientAnnotations": {
"isEditedByUser": true
},
"isRequired": true
},
{
"instance": {
"key": {
"publicId": "access_globals",
"versionId": "1"