-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
743 lines (594 loc) · 30.3 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript">
dataLayer.push({
'ecommerce': {
'currencyCode': 'EUR', // Local currency is optional.
'impressions': [
{
'name': 'Triblend Android T-Shirt', // Name or ID is required.
'id': '12345',
'price': '15.25',
'brand': 'Google',
'category': 'Apparel',
'variant': 'Gray',
'list': 'Search Results',
'position': 1
},
{
'name': 'Donut Friday Scented T-Shirt',
'id': '67890',
'price': '33.75',
'brand': 'Google',
'category': 'Apparel',
'variant': 'Black',
'list': 'Search Results',
'position': 2
}]
}
});
</script>
<link rel="icon" type="image/x-icon" href="./Images/favicon-32x32.png">
<title>DataLayer Helper - Gradiweb</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Head -> Activate from settings json theme -->
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-N8G6RKF');</script>
<!-- End Google Tag Manager -->
<link rel="stylesheet" href="./css/styles.css">
<link rel="stylesheet" href="./css/collapsiblestyles.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bs-stepper/dist/css/bs-stepper.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intro.js@7.2.0/minified/introjs.min.css">
<script src="./js/jquery.min.js"></script>
<script src="./js/popper.min.js"></script>
<script src="./js/bootstrap.min.js"></script>
<script src="./js/beautify.js"></script>
<script src="./js/beautify-css.js"></script>
<script src="./js/beautify-html.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js" integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bs-stepper/dist/js/bs-stepper.min.js" crossorigin="anonymous"></script>
<script>
dataLayer.push({
"event":"event1",
"variable1":"someVAlue",
"variable2":"someothervalue"
})
</script>
</head>
<body>
<div id="bodycontainer" class="container">
<div class="container">
<div class="row">
<div class="col-md-12 mt-5">
<div id="stepper1" class="bs-stepper">
<!-- Stepper header -->
<div class="bs-stepper-header">
<div class="step" data-target="#test-l-1">
<button type="button" class="btn step-trigger">
<span class="bs-stepper-circle">1</span>
<span class="bs-stepper-label">Introduction</span>
</button>
</div>
<div class="line"></div>
<div id="step-2" class="step" data-target="#test-l-2">
<button type="button" class="btn step-trigger">
<span class="bs-stepper-circle">2</span>
<span class="bs-stepper-label">Datalayer Details</span>
</button>
</div>
<div class="line"></div>
<div id="step-3" class="step" data-target="#test-l-3">
<button type="button" class="btn step-trigger">
<span class="bs-stepper-circle">3</span>
<span class="bs-stepper-label">Datalayer Variables</span>
</button>
</div>
<div class="line"></div>
<div id="step-4" class="step" data-target="#test-l-4">
<button type="button" class="btn step-trigger">
<span class="bs-stepper-circle">4</span>
<span class="bs-stepper-label">Datalayer Preview</span>
</button>
</div>
</div>
<!-- Stepper content -->
<div class="bs-stepper-content">
<!-- First Step - Introduction -->
<div id="test-l-1" class="content">
<p class="text-center">Graditools: Datalayer Generator</p>
<p>
Explore our dynamic Datalayer generation tool, designed to effortlessly create custom data layers without technical complexities.
Enhance data collection, improve web analytics, and tailor your strategy to meet your unique needs.
Empower your decision-making with the simplicity of our Datalayer generator!
</p>
<div class="Stepper-btns">
<div class="Btns-container">
<button
class="btn-shape btn-main btn-spacing"
onclick="stepper1.next()">
Let's start
</button>
</div>
</div>
</div>
<!-- Second Step - Datalayer Details -->
<div id="test-l-2" class="content">
<div class="row Main__Datalayer">
<div
id="datalayer-details">
<p
class="Label">
To get started, please choose the data layer type:
<div class="tooltip-container">
<a
href="#"
class="openSidemodal"
id="datalayer-details-help">
<img src="./Images/information.gif" alt="">
</a>
</div>
</p>
<select class="form-select selector datalayer-type" id ="dldropdown" name="dropdown" style="margin-bottom:8px;display: inline">
<option value='select'>Select Data Layer Type</option>
<option value='declare'>Datalayer Declaration</option>
<option value='push'>Datalayer Push</option>
<option value='ecomm'>Shopify Ecommerce</option>
</select>
</div>
<div>
<label
class="Label"
id="dlLabel"
style="visibility: hidden;"
for="dlName">
DataLayer Name:
</label>
<input
class="form-control"
type="text"
style="visibility: hidden;"
placeholder="Default dataLayer"
name="dlName"
value="dataLayer"
id="dlName" >
</div>
</div>
<div class="Stepper-btns">
<div class="Btns-container">
<button
class="btn-shape btn-main btn-spacing"
onclick="stepper1.previous()">
Previous
</button>
<button
class="btn-shape btn-main btn-spacing next disabled"
id="to-second-step"
onclick="stepper1.next()"
disabled="true">
Next
</button>
</div>
</div>
</div>
<!-- Third Step - Datalayer Variable -->
<div id="test-l-3" class="content">
<p class="Label">
Datalayer Variables
<div class="tooltip-container">
<a
href="#"
class="openSidemodal"
id="datalayer-variables-help">
<img src="./Images/information.gif" alt="">
</a>
</div>
</p>
<div class="container" id="MainContainer"></div>
<div class="container" id="EcommContainer"></div>
<div id="error" class="container"></div>
<div id="divfunctionButtons" class="p-2">
<button
type="button"
id="addMore"
class="addMore datadeclare btn-primary-gradi"
style="display: inline;visibility:hidden">
+ Add key value
</button>
<button
type="button"
id="dataGenerate"
class="btn-primary-gradi"
onclick="generateCode()"
style="display: inline;visibility:hidden">
Generate
</button>
</div>
<div class="Stepper-btns">
<div class="Btns-container">
<button
class="btn-shape btn-main btn-spacing"
onclick="stepper1.previous()">
Previous
</button>
<button
class="btn-shape btn-main btn-spacing next disabled"
onclick="stepper1.next()"
disabled="true"
id="to-third-step">
Next
</button>
</div>
</div>
</div>
<!-- Fourth Step - Datalayer Variable -->
<div id="test-l-4" class="content">
<p class="text-center">Datalayer generator</p>
<div>
<textarea id="taggingcode" name="taggingcode" rows="10" cols="45" readonly="readonly" style="visibility:hidden;">
DataLayer Code
</textarea>
<div class="Btn__actions">
<button
class="btn-primary-gradi"
id="clearall"
onclick="clearall()"
style="visibility:hidden;"">
Clear
</button>
<button
class="btn-primary-gradi"
id="copyToClipboard"
onclick="copyToClipboard()"
style="visibility:hidden;">
<b>Copy DataLayer</b>
</button>
</div>
</div>
<div id="PastCodes" class="container-fluid" style="display:none;">
<div id="pastCode" class="container-fluid pastCode">
<button type="button" class="collapsible">
<p class="pcbuttonId" style="display: none;">1</p>
<b class="pcbuttonText">Open Section 1</b>
<span class="close" style="float: left;margin-right: 8px;" onclick="deleteData(this)">
<img src="Images/del.png" style="width: 20px; height: 20px;"></span>
<span class="arrow" style="float: right;"></span>
</button>
<div class="content">
<textarea class="pccontextText" name="taggingcode" rows="1" cols="50" readonly="readonly">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</textarea>
<button class="copyToClipboard" onclick="copyToClipboard(this)">Copy to clipboard</button>
</div>
</div>
</div>
<div id="datalayerdec" class="container-fluid datalayer datalayerdec" style="padding: 0 2px 2px 0;display: none;">
<div class="input-group keyvalue" style="padding: 0 2px 2px 0">
<input type="text" class="form-control key" id="key" onfocus="removeerrormsg()" placeholder="Key" style="display: inline;">
<p class="my-auto" style="margin-left:4px;margin-right:4px;display: inline"><b>:</b></p>
<div style="display: inline;;width:50%" class="parinputvalue">
<input type="text" class="form-control value" onfocus="removeerrormsg()" id="value" placeholder="Value" style="display: inline">
<span class="nestedparam" onclick="nestedparams(this)">+ Nested</span>
</div>
<img class="my-auto" id="removeIcon" onclick="removeNode()" src="Images/images.png" alt="remove row" style="visibility:hidden;height: 17px;width: 23px;padding-left: 6px;">
<br>
<div class="container nestedparams" style="margin-top: 4px; display:block;visibility:hidden;"></div>
</div>
</div>
<div id="datalayerPush" class="container-fluid datalayer datalayerPush" style="padding: 0 2px 2px 0;display: none">
<div class="input-group keyvalue" style="padding: 0 2px 2px 0; margin-bottom: 20px">
<label class="my-auto" style="height:100%;display: inline;margin-bottom: 0px;vertical-align: baseline"><strong>Enter the Event Name</strong></label>
<p class="my-auto" style="margin-left:4px;margin-right:4px;display: inline;vertical-align: baseline"><b>:</b></p>
<input type="text" class="form-control value" id="value" onfocus="removeerrormsg()" placeholder="Value" style="display: inline;;max-width: 80%;border-radius: 8px;"></div>
</div>
<div id="datalayerEcomm" class="container-fluid datalayer datalayerEcomm" style="padding: 0 2px 2px 0;display: none;">
<div class="input-group keyvalue" style="padding: 0 2px 2px 0">
<label class="my-auto" style="height:100%;display: inline;margin-bottom: 0px;vertical-align: baseline">Choose the Ecommerce Event </label>
<p class="my-auto" style="margin-left:4px;margin-right:4px;display: inline;vertical-align: baseline"><b>:</b></p>
<select class="my-auto form-select" id ="ecommdropdown" name="dropdown" onfocus="removeerrormsg()">
<option value='choose'>Select</option>
<option value='impression'>Product Impression</option>
<option value='click'>Product Click</option>
<option value='details'>Product View</option>
<option value='addtocart'>Product Add to Cart</option>
<option value='removecart'>Remove from Cart</option>
<option value='checkout'>Product Checkout</option>
<option value='checkoutopt'>Checkout Option</option>
<option value='purchase'>Product Purchase</option>
<option value='fullrefund'>Full Refund</option>
<option value='partrefund'>Partial Refund</option>
</select>
<input type="checkbox" id="useevent" name="Event" style="margin-left:40px;margin-right:4px;display: inline;vertical-align:sub;visibility:hidden">
<label for="Useevent" style="visibility:hidden">Use Event</label><br>
</div>
</div>
<div id="datalayerecommevent" class="container-fluid datalayer datalayerecommevent" style="padding: 0 2px 2px 0;display: none;">
<div id="even_det" style="display: flex;">
<div style="height:max-content; padding-right:16px">
<p class="Label">
Event Details
<div class="tooltip-container">
<a
href="#"
class="openSidemodal"
id="datalayer-event-details-help">
<img src="./Images/information.gif" alt="">
</a>
</div>
</p>
</div>
<div style="height:max-content;margin-top:8px" >
<select name="configType" id="Configs" class="form-select">
<option value="GA4">Google Analytics 4</option>
<option value="UA">Universal Analytics</option>
</select>
</div>
</div>
<div id="divproducts" class="divproducts product-wrapper">
<button class="nestedparam" id="addnewproduct" style="margin:4px"> Add product</button>
<div class="divproductparams">
<button class="nestedparam" id="productparams" onclick="addProdParam(this)" style="display:inline-block;margin-bottom:4px">Add product parameter</button>
<img id="removeIcon" class="remove_node" onclick="removeNode(this)" src="Images/close.png" alt="remove row" style="visibility:inherit";>
<div class="input-group keyvalue productparams" style="padding: 0 2px 2px 0">
<input list="prodparams" class="form-control key" onfocus="removeerrormsg()" id="key" placeholder="Product parameter name" style="display: inline;"/>
<datalist id="prodparams" >
<option>name</option>
<option>id</option>
<option>price</option>
<option>brand</option>
<option>collection</option>
<option>variant</option>
<option>list</option>
<option>position</option>
<option>coupon</option>
<option>item_id</option>
<option>item_name</option>
<option>item_price</option>
<option>item_list</option>
<option>item_discount</option>
<option>item_brand</option>
<option>item_collection</option>
<option>item_collection2</option>
<option>item_collection3</option>
<option>item_collection4</option>
<option>item_collection5</option>
<option>item_created_at</option>
<option>item_compare_at_price</option>
<option>item_compare_at_price_max</option>
<option>item_compare_at_price_min</option>
<option>item_gift_card</option>
<option>item_handle</option>
<option>item_has_only_default_variant</option>
<option>item_price_max</option>
<option>item_price_min</option>
<option>item_price_varies</option>
<option>item_tags</option>
<option>item_type</option>
<option>item_url</option>
<option>item_vendor</option>
<option>item_quantity</option>
</datalist>
<p class="my-auto" style="margin-left:4px;margin-right:4px;display: inline"><b>:</b></p>
<input list="prodvalues" class="form-control value" id="value" onfocus="removeerrormsg()" placeholder="Product parameter Value" style="display: inline;">
<datalist id="prodvalues" >
<option>{{product.available}}</option>
<option>{{product.collections}}</option>
<option>{{product.compare_at_price}}</option>
<option>{{product.compare_at_price_max}}</option>
<option>{{product.compare_at_price_min}}</option>
<option>{{product.created_at}}</option>
<option>{{product.gift_card?}}</option>
<option>{{product.handle}}</option>
<option>{{product.has_only_default_variant}}</option>
<option>{{product.id}}</option>
<option>{{product.title}}</option>
<option>{{product.options}}</option>
<option>{{product.price}}</option>
<option>{{product.price_max}}</option>
<option>{{product.price_min}}</option>
<option>{{product.price_varies}}</option>
<option>{{product.tags}}</option>
<option>{{product.type}}</option>
<option>{{product.url}}</option>
<option>{{product.variants}}</option>
<option>{{product.vendor}}</option>
</datalist>
<img class="my-auto" id="removeIcon" onclick="removeNode(this)" src="Images/images.png" alt="remove row" style="visibility:inherit;height: 17px;width: 23px;padding-left: 6px;">
</div>
</div>
</div>
<div id="diveventparams" class="product-wrapper">
<button class="nestedparam" id="eventparams" style="display:inline;margin-bottom:4px">Add event parameter</button>
<p style="display: inline;">[optional]</p>
<div class="input-group keyvalue eventparams" style="padding: 0 2px 2px 0">
<input type="text" class="form-control key" id="key" onfocus="removeerrormsg()" placeholder="Parameter name" style="display: inline;">
<p class="my-auto" style="margin-left:4px;margin-right:4px;display: inline"><b>:</b></p>
<input type="text" class="form-control value" onfocus="removeerrormsg()" id="value" placeholder="Paramater Value" style="display: inline;">
<img class="my-auto" id="removeIcon" onclick="removeNode(this)" src="Images/images.png" alt="remove row" style="visibility:inherit;height: 17px;width: 23px;padding-left: 6px;">
</div>
</div>
<div id="divactionfieldparams" class="product-wrapper">
<button class="nestedparam" id="actionfieldparams" style="display:block">Add action field</button>
<div class="input-group keyvalue actionfieldparams" style="padding: 0 2px 2px 0">
<input list="afparams" type="text" class="form-control key" placeholder="Action field Name" id="key" onfocus="removeerrormsg()" style="display: inline;"/>
<datalist id="afparams">
<option>list</option>
<option>step</option>
<option>option</option>
<option>id</option>
<option>affiliation</option>
<option>revenue</option>
<option>tax</option>
<option>shipping</option>
<option>coupon</option>
</datalist>
<p class="my-auto" style="margin-left:4px;margin-right:4px;display: inline"><b>:</b></p>
<input type="text" class="form-control value" id="value" onfocus="removeerrormsg()" placeholder="Action field Value" style="display: inline;">
<img class="my-auto" id="removeIcon" onclick="removeNode(this)" src="Images/images.png" alt="remove row" style="visibility:inherit;height: 17px;width: 23px;padding-left: 6px;">
</div>
</div>
</div>
<table id="headerTable" style="display:none">
</table>
<h4 id="titlePastcodes"></h4>
<div class="Stepper-btns excel_download">
<div class="Btns-container">
<button
class="btn-shape btn-main btn-spacing"
onclick="stepper1.previous()">
Previous
</button>
<button
class="btn-shape btn-main btn-spacing"
onclick="createExportTable()">
Download Excel
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="androidEvent" class="container-fluid android androidEvent" style="padding: 0 2px 2px 0;display: none">
<div class="input-group keyvalue" style="padding: 0 2px 2px 0; margin-bottom: 20px">
<label class="my-auto" style="height:100%;display: inline;margin-bottom: 0px;vertical-align: baseline"><strong>Enter the Event Name</strong></label>
<p class="my-auto" style="margin-left:4px;margin-right:4px;display: inline;vertical-align: baseline"><b>:</b></p>
<input type="text" class="form-control value" id="value" onfocus="removeerrormsg()" placeholder="Value" style="display: inline;;max-width: 80%;border-radius: 8px;"></div>
</div>
<div id="iOSEvent" class="container-fluid iOS iOSEvent" style="padding: 0 2px 2px 0;display: none">
<div class="input-group keyvalue" style="padding: 0 2px 2px 0; margin-bottom: 20px">
<label class="my-auto" style="height:100%;display: inline;margin-bottom: 0px;vertical-align: baseline"><strong>Enter the Event Name</strong></label>
<p class="my-auto" style="margin-left:4px;margin-right:4px;display: inline;vertical-align: baseline"><b>:</b></p>
<input type="text" class="form-control value" id="value" onfocus="removeerrormsg()" placeholder="Value" style="display: inline;;max-width: 80%;border-radius: 8px;"></div>
</div>
<div class="input-group keyvaluenested" style="padding: 0 2px 2px 0;visibility: hidden;">
<input type="text" class="form-control keynested" id="keynested" onfocus="removeerrormsg()" placeholder="Key" style="display: inline;border-radius: 8px;">
<p class="my-auto" style="margin-left:4px;margin-right:4px;display: inline;vertical-align: baseline"><b>:</b></p><s></s>
<input type="text" class="form-control valuenested" id="value" onfocus="removeerrormsg()" placeholder="Value" style="display: inline;;border-radius: 8px;">
<img id="addrow" class="my-auto" onclick="addNode(this)" src="Images/open.png" alt="remove row" style="visibility:inherit;width:12px;height: 12px;background-color:#a5e184;display:inline;margin-left: 8px;cursor:pointer;">
<img id="removerow" class="my-auto" onclick="removeNode(this)" src="Images/remove.png" alt="remove row" style="visibility:inherit;width:12px;height:5px;background-color:#ef8195;display: inline;margin-left: 8px;cursor:pointer;">
</div>
</div>
</div>
<!-- Sidemodal -->
<div id="sidemodal">
<div id="sidemodal-content">
<a id="closeSidemodal">×</a>
<div id="loader" style="display: none;">
<img src="./Images/loader.gif" alt="">
</div>
<p id="Help-text"></p>
</div>
</div>
<script src="./js/Database.js"></script>
<script src="./js/datalayerhelper.js"></script>
</body>
<script src="https://cdn.jsdelivr.net/npm/intro.js@7.2.0/intro.min.js"></script>
<script>
$(document).ready(function() {
sideModal()
showHelp();
function showHelp(){
$(".openSidemodal").each(function() {
$(this).on("click", function() {
document.getElementById("Help-text").innerHTML = "";
document.getElementById("loader").style.display = "block";
fetch('https://gradiweb.github.io/datalayer-helper/js/help.json')
.then(response => {
if (!response.ok) {
throw new Error('Failed to load JSON file.');
}
return response.json();
})
.then(data => {
let key = this.id;
let value = data[key];
document.getElementById("Help-text").innerHTML = value;
document.getElementById("loader").style.display = "none";
})
.catch(error => {
console.error('Error loading JSON file:', error);
document.getElementById("loader").style.display = "none";
});
});
});
}
function sideModal(){
// Abrir sidemodal
$(".openSidemodal").click(function() {
$("#sidemodal").width("100%");
$("#sidemodal-content").css("right", "0");
$("#sidemodal-overlay").show();
});
$(document).keyup(function(e) {
if (e.key === "Escape") {
closeSidemodal();
}
});
$("#closeSidemodal").click(function() {
closeSidemodal();
});
function closeSidemodal() {
$("#sidemodal").width("0");
$("#sidemodal-content").css("right", "-420px");
$("#sidemodal-overlay").hide();
}
}
// Btns Validate
$('.datalayer-type').on('change',function(e){
let $secondStep = $('#to-second-step');
$secondStep.removeClass('disabled');
$secondStep.removeAttr('disabled');
if($(this).val() == 'select'){
$secondStep.addClass('disabled');
$secondStep.attr('disabled','true');
}
});
$(document.body).on("keypress", "#key", function (event) {
let $thirStep = $('#to-third-step');
$thirStep.removeClass('disabled');
$thirStep.removeAttr('disabled');
});
if($('#key').val() == ''){
let $thirStep = $('#to-third-step');
$thirStep.addClass('disabled');
$thirStep.attr('disabled','true');
}
$('#to-third-step').on('click',function(e){
$('#dataGenerate').click();
})
});
introJs().setOptions({
steps:[
{
title:'Welcome',
intro:'Generate your datalayer in a simple and efficient way with our tool'
},
{
element:document.querySelector('#step-2'),
intro:'First select the type and name of the datalayer'
},
{
element:document.querySelector('#step-3'),
intro:'Then select the variables you want to load in your datalayer object.'
},
{
element:document.querySelector('#step-4'),
intro:'Finally copy the code or download it in xls format to share it with your agency or marketing and SEO team.'
},
{
element:document.querySelector('#intro'),
intro:"Let's start the tour"
}
]
}).start();
</script>
</html>