Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
6 views
2 pages
Gecko GTMScript ECMA5 Updated
Uploaded by
Venkey Dematti
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
Download
Save
Save GeckoGTMScriptECMA5Updated For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
6 views
2 pages
Gecko GTMScript ECMA5 Updated
Uploaded by
Venkey Dematti
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save GeckoGTMScriptECMA5Updated For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save GeckoGTMScriptECMA5Updated For Later
You are on page 1
/ 2
Search
Fullscreen
// Code to handle input type text and tel
var inputs = document.querySelectorAll("input");
if (inputs.length > 0) {
Array.prototype.forEach.call(inputs, function (input) {
input.addEventListener("keyup", function (v) {
var elementType, placeHolder, fieldId , autoComplete, type;
autoComplete = input.getAttribute("autocomplete");
type = input.getAttribute("type");
if ((type === "text" || type === "tel") && event.target.value.length >= 2
&& !input.getAttribute("data-triggered")) {
fieldId = input.id;
if (input.getAttribute("role") == 'searchbox') {
elementType = 'select';
fieldId = input.getAttribute("aria-labelledby");
placeHolder = document.getElementById(fieldId).textContent.trim();
}
if(autoComplete === "email") {
elementType = "text";
placeHolder = "Email Address";
} else if(autoComplete === "tel") {
elementType = "tel";
placeHolder = "Telephone Number";
} else {
placeHolder = input.getAttribute("placeholder");
}
window.triggerGtmEvent('gecko-blur-on-input', {
field_id: fieldId,
field_placeholder: placeHolder,
field_type: elementType || type
});
input.setAttribute("data-triggered", true);
}
});
});
}
// Code to handle radio inputs
var radios = document.querySelectorAll("input[type='radio']");
if (radios.length > 0) {
Array.prototype.forEach.call(radios, function (radio) {
radio.addEventListener("change", function () {
var eleName, eleType, eleLabel, elePlaceholder;
if (!radio.getAttribute("data-triggered")) {
eleType = "radio";
eleName = radio.getAttribute("name");
eleLabel = document.querySelector('label[for="' + eleName + '"]');
var getAllRadios = document.querySelectorAll('input[name="' + eleName +
'"]');
if (getAllRadios.length > 0) {
Array.prototype.forEach.call(getAllRadios, function (getAllRadios) {
getAllRadios.setAttribute("data-triggered", true);
});
}
elePlaceholder = eleLabel ? eleLabel.textContent.trim() : "";
window.triggerGtmEvent('gecko-blur-on-input', {
field_id: eleType,
field_placeholder: elePlaceholder,
field_type: eleType
});
radio.setAttribute("data-triggered", true); //Mark the radio as triggred
}
});
});
}
// Code to handle select element
var chosenContainers = document.querySelectorAll(".chosen-container");
if (chosenContainers) {
Array.prototype.forEach.call(chosenContainers, function (select) {
//Store inital span content
var initialContent = select.querySelector('.chosen-single span').textContent;
select.addEventListener("click", function () {
if (!select.dataset.gtmTriggered) {
var spanContent = select.querySelector('.chosen-single span').textContent;
if (spanContent !== initialContent) {
var clickedId = select.id;
// Remove "_container"
var originalId = clickedId.replace("_container", "");
// Find the label value, using for attribute
var fieldLabelElement = document.querySelector('label[for="' + originalId
+ '"]');
// Check if the label element exists before accessing innerHTML
var fieldLabel = fieldLabelElement ? fieldLabelElement.textContent.trim()
: "";
var selectId = originalId;
var selectName = fieldLabel;
var selectType = "select";
// Trigger GTM event
window.triggerGtmEvent('gecko-blur-on-input', {
field_id: originalId,
field_placeholder: fieldLabel,
field_type: selectType
});
select.dataset.gtmTriggered = true;
initialContent = spanContent; //To treating it as the new "initial"
content for future comparisons.
}
}
});
});
}
You might also like
Dhaka Applicant Info Auto Fill
PDF
0% (1)
Dhaka Applicant Info Auto Fill
2 pages
Iso 13709
PDF
0% (4)
Iso 13709
120 pages
Bls Doorstep
PDF
No ratings yet
Bls Doorstep
2 pages
Script Page2
PDF
No ratings yet
Script Page2
3 pages
Marscode
PDF
No ratings yet
Marscode
779 pages
Compact HMI 800 5.0 Getting Started
PDF
100% (1)
Compact HMI 800 5.0 Getting Started
176 pages
Mu 3 Steli
PDF
No ratings yet
Mu 3 Steli
18 pages
Currentaddress
PDF
No ratings yet
Currentaddress
157 pages
Demographic
PDF
No ratings yet
Demographic
164 pages
Preparation: ERICSSON Node B Commissioning and Integration
PDF
No ratings yet
Preparation: ERICSSON Node B Commissioning and Integration
37 pages
Master ASP - Net Core 6.0 (ADO .NET +3 Capas+ Store Procedure)
PDF
No ratings yet
Master ASP - Net Core 6.0 (ADO .NET +3 Capas+ Store Procedure)
119 pages
1 Applicant Info Button
PDF
No ratings yet
1 Applicant Info Button
2 pages
Trinet Community Connector Source
PDF
No ratings yet
Trinet Community Connector Source
39 pages
New 6
PDF
No ratings yet
New 6
29 pages
License Cerberus Info
PDF
No ratings yet
License Cerberus Info
2 pages
Document
PDF
No ratings yet
Document
34 pages
Ejemplo
PDF
No ratings yet
Ejemplo
18 pages
Editlead
PDF
No ratings yet
Editlead
32 pages
Events (CSS) 3rd Year
PDF
No ratings yet
Events (CSS) 3rd Year
28 pages
Fomr
PDF
No ratings yet
Fomr
5 pages
C## UserRole
PDF
No ratings yet
C## UserRole
46 pages
14iv4no 4d690285 Quickdownloadarchive Trade
PDF
No ratings yet
14iv4no 4d690285 Quickdownloadarchive Trade
5 pages
Codes
PDF
No ratings yet
Codes
11 pages
FSWD 8
PDF
No ratings yet
FSWD 8
8 pages
inboundCallDetails Js
PDF
No ratings yet
inboundCallDetails Js
16 pages
Master Detail
PDF
No ratings yet
Master Detail
15 pages
9afcf077-ddad-4050-8a99-654c058e4a51
PDF
No ratings yet
9afcf077-ddad-4050-8a99-654c058e4a51
6 pages
PDF
PDF
No ratings yet
PDF
13 pages
Code 2
PDF
No ratings yet
Code 2
6 pages
Old 4
PDF
No ratings yet
Old 4
3 pages
Jqgrid
PDF
No ratings yet
Jqgrid
6 pages
Main Old-Second
PDF
No ratings yet
Main Old-Second
6 pages
Zone Selection
PDF
No ratings yet
Zone Selection
2 pages
Scrit 103622
PDF
No ratings yet
Scrit 103622
5 pages
Assignment5 Js
PDF
No ratings yet
Assignment5 Js
2 pages
Changes
PDF
No ratings yet
Changes
3 pages
Grafik Muncul
PDF
No ratings yet
Grafik Muncul
4 pages
WW OL Dropdown - Updated
PDF
No ratings yet
WW OL Dropdown - Updated
4 pages
Actividad de Fernando Remache
PDF
No ratings yet
Actividad de Fernando Remache
4 pages
HTML Lang
PDF
No ratings yet
HTML Lang
3 pages
Input Type
PDF
No ratings yet
Input Type
2 pages
HTML5 Form Input Types
PDF
No ratings yet
HTML5 Form Input Types
3 pages
Json
PDF
No ratings yet
Json
4 pages
Sourabh1 3
PDF
No ratings yet
Sourabh1 3
3 pages
Custom Transform JS
PDF
No ratings yet
Custom Transform JS
4 pages
Jquery Notes
PDF
No ratings yet
Jquery Notes
2 pages
Sidebar
PDF
No ratings yet
Sidebar
3 pages
Officials
PDF
No ratings yet
Officials
2 pages
Operations On Web Elements
PDF
No ratings yet
Operations On Web Elements
3 pages
Userlist
PDF
No ratings yet
Userlist
2 pages
"Aa" " " "Daily" "Monthly": Name Onchange Value Value
PDF
No ratings yet
"Aa" " " "Daily" "Monthly": Name Onchange Value Value
2 pages
Fragmento de Form Mailer
PDF
No ratings yet
Fragmento de Form Mailer
4 pages
Popup
PDF
No ratings yet
Popup
2 pages
Yealink SIP-T2xP and SIP-T19P IP Phone Family Administrator Guide V72 25
PDF
No ratings yet
Yealink SIP-T2xP and SIP-T19P IP Phone Family Administrator Guide V72 25
506 pages
01 - Introduction To Computer Security Security
PDF
No ratings yet
01 - Introduction To Computer Security Security
39 pages
Standard Tools & Equipment List COPA
PDF
No ratings yet
Standard Tools & Equipment List COPA
3 pages
Red Hat System Administration I On RHEL 7 RH1241
PDF
No ratings yet
Red Hat System Administration I On RHEL 7 RH1241
2 pages
Embracing The Quantum Economy-Pathway For Business Leaders
PDF
No ratings yet
Embracing The Quantum Economy-Pathway For Business Leaders
70 pages
SqUID Warehouse Robot
PDF
No ratings yet
SqUID Warehouse Robot
3 pages
BernhardGschaider-OFW9 swakPyFoamBasicTraining
PDF
No ratings yet
BernhardGschaider-OFW9 swakPyFoamBasicTraining
222 pages
MultiCorpora MultiTrans Pro User Manual v37 English
PDF
No ratings yet
MultiCorpora MultiTrans Pro User Manual v37 English
213 pages
Microsoft Word 2013 Lesson 3 PDF
PDF
No ratings yet
Microsoft Word 2013 Lesson 3 PDF
25 pages
Build Your Own Windows Server IT Lab PDF
PDF
No ratings yet
Build Your Own Windows Server IT Lab PDF
15 pages
Illuminating: The Future Intelligently
PDF
No ratings yet
Illuminating: The Future Intelligently
12 pages
Lec 15
PDF
No ratings yet
Lec 15
37 pages
Jonah Marindoque Balicoco SAS 21 Nursing InformaticsFINAL
PDF
No ratings yet
Jonah Marindoque Balicoco SAS 21 Nursing InformaticsFINAL
9 pages
Postgres Monitoring Queries All
PDF
No ratings yet
Postgres Monitoring Queries All
16 pages
Ieee Paper Bit 2k24
PDF
No ratings yet
Ieee Paper Bit 2k24
5 pages
XDR For Networks - Datasheet
PDF
No ratings yet
XDR For Networks - Datasheet
3 pages
SAP Customer Story Siemens LDA
PDF
No ratings yet
SAP Customer Story Siemens LDA
4 pages
CAPS and IBASS Manuals
PDF
No ratings yet
CAPS and IBASS Manuals
50 pages
Alcatel-Lucent Vs Microsoft
PDF
100% (1)
Alcatel-Lucent Vs Microsoft
11 pages
Gursharan Singh: VSRK Capital Pvt. LTD
PDF
No ratings yet
Gursharan Singh: VSRK Capital Pvt. LTD
1 page
TELUS Digital - Reasoning Annotation Project Opportunity
PDF
No ratings yet
TELUS Digital - Reasoning Annotation Project Opportunity
3 pages
System Compatibility Report
PDF
No ratings yet
System Compatibility Report
4 pages
Kryptronix Gaming: Configuration
PDF
No ratings yet
Kryptronix Gaming: Configuration
2 pages
Robots, Androids, Al: Which Transmit
PDF
No ratings yet
Robots, Androids, Al: Which Transmit
7 pages
6es7132 6BH00 0aa0
PDF
No ratings yet
6es7132 6BH00 0aa0
4 pages
Advanced C Concepts and Programming: First Edition
From Everand
Advanced C Concepts and Programming: First Edition
Gayatri
3/5 (1)
Designing XSD diagrams vol1
From Everand
Designing XSD diagrams vol1
Jose Luis Arias Cobreros
No ratings yet
Java Programming Tutorial With Screen Shots & Many Code Example
From Everand
Java Programming Tutorial With Screen Shots & Many Code Example
Desmond Ohwofosirai
No ratings yet
NgRx SignalStore: An effortless solution for state management
From Everand
NgRx SignalStore: An effortless solution for state management
Abdelfattah Ragab
No ratings yet
Javascript Assessment Test
From Everand
Javascript Assessment Test
Edward Yao
No ratings yet
jQuery 1.4 Reference Guide
From Everand
jQuery 1.4 Reference Guide
Jonathan Chaffer
3.5/5 (2)
How to a Developers Guide to 4k: Developer edition, #3
From Everand
How to a Developers Guide to 4k: Developer edition, #3
Xinc Cyberwizard
No ratings yet
50 Java Concepts Every Developer Should Know
From Everand
50 Java Concepts Every Developer Should Know
Hernando Abella
No ratings yet
Computer Engineering Laboratory Solution Primer
From Everand
Computer Engineering Laboratory Solution Primer
Karan Bhandari
No ratings yet
Ajax in One Hour, For Beginners, Learn Coding Fast
From Everand
Ajax in One Hour, For Beginners, Learn Coding Fast
Ray Yao
No ratings yet
150+ C Pattern Programs
From Everand
150+ C Pattern Programs
Hernando Abella
No ratings yet
Profound Python Data Science
From Everand
Profound Python Data Science
Onder Teker
No ratings yet