1/* jshint camelcase: false */ 2'use strict'; 3 4/** 5 * Adobe Analytics tracking 6 */ 7 8/*global _A*/ 9/*global _satellite*/ 10/*global Vimeo*/ 11/*global Promise*/ 12/*global firstName*/ 13/*global lastName*/ 14/*global isGuestUser*/ 15/*global customerAccountNumber*/ 16/*global salesOrg*/ 17/*global userName*/ 18/*global adobeZipCode*/ 19/*global userIdEmail*/ 20/*global internalTraffic*/ 21 22/*Search AutoComplete tracking was implemented in acc.autocomplete.js*/ 23var launchObjLoadCheck = setInterval(function() { 24 if (typeof(_A) !== 'undefined' && typeof(_A) === 'object') { 25 clearInterval(launchObjLoadCheck); 26 require(['main'], function () { 27 require(['domReady', 'jquery', 'notifications', 'pubSub'], function (domReady, $, NOTIFICATIONS) { 28 domReady(function adobeAnalytics() { 29 var pageName, 30 pageURL, 31 pageType, 32 siteSection, 33 siteSubSection, 34 siteSubSubSection, 35 siteSubSubSubSection, 36 userID, 37 fName, 38 lName, 39 zipCode, 40 loginStatus, 41 accountID, 42 userType, 43 cartPageShipTo, 44 cartPageSalesOrg, 45 monetateDivID; 46 47 function registerAdobeElementEvents() { 48 var isQuoteSubmitEmarket = $('.isemarketSite').val() === 'true' && $('.shopping-cart-table').length > 0 && $('#cartForm').find('.confirmationMessage .js-msg').text().indexOf('quotation') !== -1; 49 try { 50 var medalliaLoadChecker = setInterval(function() { 51 if (typeof(MDIGITAL) !== 'undefined' && typeof(MDIGITAL) === 'object') { 52 clearInterval(medalliaLoadChecker); 53 setMedalliaDataObject(); 54 } 55 }); 56 subscribeToPublishedEvents(); 57 setPageDetails(); 58 pageLoadAdobeGlobalObject(); 59 productPageLoadTrack(); 60 addAdobeLinkTrackCSS(); 61 setTimeout(function (){ 62 adobeLinkTrack(); 63 }, 2000); 64 adobeSearchTrack(); 65 adobeVimeoVideoTrack(); 66 adobeResultsListTrack(); 67 adobeProductSKUTrack();
68 if (($('.autopay-enroll-steps-container').length > 0 || $('.accounts-review-enrolled-container').length > 0) && $('.enrolled-authent-managed-container').length === 0) { 69 adobeAutopayTrack(); 70 } 71 if($('.enrolled-authent-managed-container').length > 0) { 72 adobeEnrolledAccountActionsTrack(); 73 } 74 if($('.requisition-approval').length > 0 || $('.requisition-approved-success').length >0) { 75 handleRequisitionApprove(); 76 } 77 if(window.location.href.includes('/requisition/order_complete')) { 78 handleRequisitionAdobeTracking(); 79 } 80 setTimeout(function (){ 81 observeBannerClassChanges(); 82 }, 3000); 83 if (window.performance.navigation.type !== window.performance.navigation.TYPE_RELOAD && window.performance.navigation.type !== window.performance.navigation.TYPE_BACK_FORWARD) { 84 invoicePaymentInfoTrack(); 85 } 86 if ($('.page-quoteDetailsPage').length > 0) { 87 quotePageLoadTrack(); 88 } 89 if ($('#ftAuditResponse').val()) { 90 publishftAuditDataToAdobe(); /* ARG21828969 - (7) Analytics gap filling based on analysis (sprint 3) */ 91 } 92 if ($('.progress-bar-new').length > 0 || $('.adobe-form').length > 0) { 93 var isRegistrationPage = decodeURIComponent(window.location.pathname); 94 if (!isRegistrationPage.includes('/register')) { 95 adobeFormTracking(); 96 } 97 } 98 if ($('#searchTerms').val() !== '' && $('#searchTerms').val() !== undefined && $('#myitemsSearchForm').length > 0) { 99 myItemsTracking(); 100 } 101 if ($('.inputSearchTextID').val() !== '' && $('.inputSearchTextID').val() !== undefined && $('#msdsSearchForm').length > 0) { 102 sdsSearchTracking(); 103 } 104 accountRegisterInfoTrack(); 105 /* ORA2 Start */ 106 if ($('.review-order').length > 0) { 107 setCartId(); 108 } 109 if (($('.order-confirmation').length > 0) && (location.href.includes('checkout_complete'))) { 110 oraMultiOrderTracking(); 111 } 112 if ($('.cart-content').length > 0) { 113 oraCartFlowProductTracking('cart'); 114 } 115 if ($('.review-order').length > 0) { 116 oraCartFlowProductTracking('review'); 117 } 118 if (isQuoteSubmitEmarket) { 119 oraQuoteTracking('submitQuoteEmarket'); 120 } 121 if($('.email-notification-popup').is(':visible')){ 122 window.onbeforeunload = function(e){ emailPdpAbandoned(e); }; 123 124 } 125 searchResultsPageTracking(); 126 searchResultsEzGazPageTracking(); 127 var montateProductFinderLoaderInterval = setInterval(function() { 128 129 if($('.mt-product-finder-container').length > 0) { 130 clearInterval(montateProductFinderLoaderInterval); 131 monetateDivID = $('.mt-product-finder-welcome-screen-wrapper').parents('.mt-product-finder-container').parent().attr('id'); 132 window.onbeforeunload = function(e){ productFinderAbandoned(e); }; 133 monetateProductFinderTracking(); 134 } 135 136 }, 5); 137 setTimeout (function(){ 138 clearInterval(montateProductFinderLoaderInterval); 139 140 }, 10000); 141 142 } catch (e) { 143 console.log('Adobe Exception: ' + e.message); 144 } 145 /* ORA2 End */ 146 } 147 148 /** Function to set Data object for Medallia for triggered alerts */ 149 function setMedalliaDataObject() { 150 var medalliaDataObj = {}, 151 customerName,
152 productCode, 153 airgasBranchContact; 154 155 customerName = window.isGuestUser === 'true' ? window.firstName + ' ' + window.lastName : atob(window.firstName) + ' ' + atob(window.lastName); 156 productCode = $('#productCode').text().trim(); 157 airgasBranchContact = window.agBranchContact; 158 medalliaDataObj['customerName'] = customerName; 159 medalliaDataObj['accountNumber'] = window.customerAccountNumber; 160 if ($('.page-ProductDetailsPage').length > 0 ) { 161 medalliaDataObj['airgasPartNumber'] = $('#productCode').text().trim(); 162 medalliaDataObj['productHierarchy'] = $('#productHeirarchy').val().trim(); 163 } else { 164 medalliaDataObj['airgasPartNumber'] = ''; 165 } 166 medalliaDataObj['airgasBranchContact'] = airgasBranchContact; 167 medalliaDataObj['zipCode'] = adobeZipCode; 168 _A.digitalData['medalliaDataObj'] = medalliaDataObj; 169 } 170 function subscribeToPublishedEvents() { 171 $.subscribe(NOTIFICATIONS.ADOBE_ADD_TO_CART_TRACK, $.proxy(adobeAddtoCartTrack)); 172 $.subscribe(NOTIFICATIONS.ADOBE_ORA_ASYNC, $.proxy(handleOraAsyncUpdates)); 173 $.subscribe(NOTIFICATIONS.ADOBE_MULTI_SELECTED_ADD_TO_CART, $.proxy(adobeMultiSelectAddtoCartListsTrack)); 174 $.subscribe(NOTIFICATIONS.ADOBE_ADD_TO_LIST_TRACK, $.proxy(adobeAddtoListTrack)); 175 $.subscribe(NOTIFICATIONS.ADOBE_SWITCH_TAB, $.proxy(adobeSwitchTab)); 176 $.subscribe(NOTIFICATIONS.ADOBE_LINK_TRACK, $.proxy(adobeLinkTrack)); 177 $.subscribe(NOTIFICATIONS.EZ_GAZ_TRACK, $.proxy(ezGazAdobeTrack)); 178 $.subscribe(NOTIFICATIONS.EMAIL_PDP_TRACK, $.proxy(emailPdpFormTracking)); 179 $.subscribe(NOTIFICATIONS.SUGGESTED_ACCESSORIES_TRACK, $.proxy(suggestedAccessoriesTrack)); 180 $.subscribe(NOTIFICATIONS.REQUISITION_ACTION_TRACK,$.proxy(requisitionActionTrack)); 181 $.subscribe(NOTIFICATIONS.REQUISITION_CONFIRM_ORDER_TRACK,$.proxy(requisitionConfirmOrderTrack)); 182 $.subscribe(NOTIFICATIONS.MANAGE_ACCOUNTS_ADDRESSSES,$.proxy(manageAccountAddressesTrack)); 183 $.subscribe(NOTIFICATIONS.ADOBE_LINK_TRACK_CONTACT_MODAL,$.proxy(contactAirgasModalTrack)); 184 $.subscribe(NOTIFICATIONS.AUTOPAY,$.proxy(handleAutopayTrack)); 185 $.subscribe(NOTIFICATIONS.DASHBOARD_TRACKING,$.proxy(handleDashboardsTracking)); 186 } 187 /* Set page details globally */ 188 function setPageDetails() { 189 try { 190 var breadCrumbArray, 191 site, 192 activeTabName, 193 pageNameUrl; 194 /* Page Name */ 195 pageName = decodeURIComponent(window.location.pathname); 196 pageNameUrl = decodeURIComponent(window.location.href); 197 198 if($('.mobile-canvas').is(':visible') && !pageNameUrl.includes('sort')) { 199 activeTabName = $('.all-devices-row.mobile-view .device-item.active').find('.alarm-type-text').text().trim().toLowerCase(); 200 } else if(!pageNameUrl.includes('sort')) { 201 activeTabName = $('.all-devices-row.desktop-view .device-item.active').find('.alarm-level-desc').text().trim().toLowerCase(); 202 } else if(pageNameUrl.includes('sort')) { 203 activeTabName = $('select.sortOptions option:selected').text().trim(); 204 } 205 206 if (window.location.pathname === '/') { 207 pageName = 'homepage'; 208 siteSection = 'home'; 209 } else if ((pageName.indexOf('/category/') !== -1 && /\d/.test(pageName)) || (pageName[pageName.length - 1] === '/')) { 210 pageName = pageName.split('/').slice(0, -1).join(':').substring(1); 211 } else if (window.location.pathname === '/ezgaz' && pageNameUrl.includes('?') && (pageNameUrl.includes('/ezgaz?alarmType') || activeTabName.toUpperCase() === 'FAVORITES')){ 212 pageName = pageName.replace(/(.{6})/g, '$1:').slice(1) + activeTabName; /*ezgaz Page Name */ 213 } else { 214 pageName = pageName.split('/').slice(0).join(':').substring(1); 215 } 216 /*site Details */ 217 $('#breadcrumb').find('ul li').each(function (index, element) { 218 var siteSectionsText; 219 220 if ($(element).children('a').text() === 'Category Page') { 221 return true; 222 } else { 223 if ($(element).children('a').length > 0 && $(element).children('a').attr('href') !== '/') { 224 siteSectionsText = $(element).children('a').text().trim(); 225 } else { 226 siteSectionsText = $(element).text().trim(); 227 } 228 } 229 if (breadCrumbArray === undefined) { 230 breadCrumbArray = siteSectionsText; 231 } else { 232 breadCrumbArray = breadCrumbArray + ':' + siteSectionsText; 233 } 234 }); 235 if (breadCrumbArray !== undefined) { 236 site = breadCrumbArray.split(':'); 237 siteSection = site[1]; 238 siteSubSection = site[2]; 239 siteSubSubSection = site[3]; 240 siteSubSubSubSection = site[4]; 241 } else { 242 siteSection = decodeURIComponent(window.location.pathname).split('/')[1]; 243 siteSubSection = decodeURIComponent(window.location.pathname).split('/')[2]; 244 siteSubSubSection = decodeURIComponent(window.location.pathname).split('/')[3]; 245 if (siteSection === '' && siteSubSection === undefined && siteSubSubSection === undefined) { 246 siteSection = 'home'; 247 } 248 } 249 /*Page URL*/ 250 pageURL = decodeURIComponent(window.location.href); 251 /*Page Type */ 252 pageType = 'content'; 253 /*User Details */ 254 userID = userName !== undefined ? userName : ''; 255 fName = firstName !== undefined ? firstName : ''; 256 lName = lastName !== undefined ? lastName : ''; 257 if (adobeZipCode !== '') { 258 zipCode = adobeZipCode; 259 } else { 260 zipCode = '11111'; 261 } 262 loginStatus = isGuestUser; 263 if (loginStatus === 'true') { 264 accountID = customerAccountNumber; 265 userType = 'Guest'; 266 loginStatus = 'not logged-in'; 267 } else { 268 accountID = customerAccountNumber; 269 userType = 'Authenticated'; 270 loginStatus = 'logged-in'; 271 } 272 } catch (e) { 273 console.log('Adobe Exception' + e.message); 274 } 275 } 276 cartPageShipTo = $('#adobeCartCustomerNumber').val() !== undefined ? $('#adobeCartCustomerNumber').val() : ''; 277 cartPageSalesOrg = $('#adobeCartSalesOrg').val() !== undefined ? $('#adobeCartSalesOrg').val() : ''; 278 if (cartPageShipTo !== undefined && cartPageShipTo.length < 1) { 279 cartPageShipTo = accountID; 280 cartPageSalesOrg = salesOrg; 281 } 282 /* Global Data Layer Object Creation */ 283 function pageLoadAdobeGlobalObject() { 284 $.extend(_A.digitalData, { 285 pageInfo: { 286 pageName: pageName, 287 pageURL: pageURL, 288 pageType: pageType, 289 prevPageName: document.referrer.split('/')[document.referrer.split('/').length - 1] 290 }, 291 Category: { 292 siteSection: siteSection === undefined ? '' : siteSection, 293 siteSubSection: siteSubSection === undefined ? '' : siteSubSection, 294 siteSubSubSection: siteSubSubSection === undefined ? '' : siteSubSubSection, 295 siteSubSubSubSection: siteSubSubSubSection === undefined ? '' : siteSubSubSubSection 296 }, 297 userInfo: { 298 userID: userID, 299 firstName: fName, 300 lastName: lName, 301 loginStatus: loginStatus, 302 accountID: cartPageShipTo === undefined ? accountID : cartPageShipTo, 303 userType: userType, 304 salesOrg: cartPageShipTo === undefined ? salesOrg : cartPageSalesOrg, 305 zipCode: zipCode, 306 internalTraffic: window.internalTraffic 307 } 308 }); 309 if (((decodeURIComponent(window.location.pathname).includes('/expressorderpad/addtocart')) || 310 (decodeURIComponent(window.location.pathname).includes('/expressorderpad/copypaste'))) && ($('#globalMessages').children().hasClass('confirmationMessage'))) { 311 $.publish(NOTIFICATIONS.ADOBE_EXPRESS_ORDER_PAD_TRACK, true); 312 } 313 if ((window.location.pathname).includes('/ezgaz')){ 314 adobeEzGazDashboardTracks(); 315 } 316 if (isGuestUser === 'true' && (decodeURIComponent(window.location.pathname).includes('guestPayInvoice') || decodeURIComponent(window.location.pathname).includes('invoicepartialconfirmation'))) { 317 _A.digitalData.userInfo.accountID = $('#adobeAccountID').val(); 318 _A.digitalData.userInfo.userID = $('#adobeEmailID').val(); 319 } 320 } 321 322 function addAdobeLinkTrackCSS() { 323 /* Apending adobe-link-track class name to anchor tag elements for Link Tracking */ 324 $('a').each(function (index, element) { 325 if ($(element).attr('href') !== undefined) { 326 if ($(element).attr('href').indexOf('/') >= 0 && !$(element).hasClass('adobe-link-track')) { 327 $(element).addClass('adobe-link-track'); 328 } 329 } 330 if ($(element).find('img').length > 0 && $(element).text().trim() === '' && $(element).attr('data-adobe-link-name') === undefined) { 331 if ($(element).find('img').attr('title') !== undefined) { 332 $(element).attr('data-adobe-link-name', $(element).find('img').attr('title')); 333 } else { 334 $(element).attr('data-adobe-link-name', $(element).find('img').attr('alt')); 335 } 336 } 337 if ($(element).text().toUpperCase() === 'SHOP NOW' && $(element).attr('data-adobe-link-name') === undefined) { 338 if ($(element).parents('.product').length > 0) { 339 $(element).attr('data-adobe-link-name', $(element).parents('.product').find('.info').text().trim()); 340 } 341 } 342 }); 343 344 /* Appending adobe-link-track-ext class name to Footer anchor tag elements on fly for link tracking */ 345 $('.yCmsContentSlot a').each(function (index, element) { 346 if ($(element).find('.social-icons').length > 0) { 347 $(element).addClass('adobe-link-track-ext'); 348 } else { 349 $(element).addClass('adobe-link-track'); 350 } 351 }); 352 353 } 354 355 /* Adobe Link Tracking Data Layer assigning classes and events on fly */ 356 function adobeLinkTrack() { 357 var links = $('.fancybox-container').is(':visible') ? $('.fancybox-container').find('.adobe-link-track, .adobe-link-track-ext') : $('.adobe-link-track, .adobe-link-track-ext'); 358 /* Preparing data layer object and trigger track when link is clicked */ 359 $(links).each(function (index, element) { 360 var currentLinkName = $(element).text().trim(); 361 if ($(element).hasClass('ez-apply')) { 362 linksDataLayer(element, false); 363 } else { 364 $(element).attr('data-value', currentLinkName); 365 } 366 $(element).on('click', function (e) { 367 var currentElement = $(e.currentTarget); 368 linksDataLayer(currentElement, false); 369 }); 370 }); 371 $.publish(NOTIFICATIONS.EMARKET_SUPERUSER_LINK_TRACK); 372 } 373 /* Adobe Search Track Data Layer Events */ 374 function adobeSearchTrack() { 375 /* Storing the user entered search terms */ 376 $('.icon-search').click(function () {
377 var userSearchTerm = $('#input_SearchBox').val() !== undefined ? $('#input_SearchBox').val() : ''; 378 localStorage.setItem('userSearchSelectedTerm', userSearchTerm); 379 }); 380 } 381 382 /* Adobe Search Results List Page Data Layer Events*/ 383 function adobeResultsListTrack() { 384 var prodImage, 385 productId; 386 /* Setting JS Object on search results page, when a user clicks on a specific product */ 387 if ($('.form-search-results').length > 0) { 388 $('.add-to-cart-container').each(function (index, element) { 389 $(element).find('.compare-view-group, .description-group h3').click(function () { 390 if ($(element).find('img').attr('src').indexOf('CM-0000001SO4') !== -1) { 391 prodImage = 'not available'; 392 } else { 393 prodImage = 'available'; 394 } 395 productId = $(element).find('.airgas-part-number em').text(); 396 setSearchObject(index + 1, prodImage, productId, $(this)); 397 _satellite.track('InternalSearch_productClicks'); 398 }); 399 }); 400 /* Setting JS Object when user click on Add to Cart button on Results List Page */ 401 $('.add-product').each(function (index, element) { 402 $(element).click(function () { 403 if ($(element).closest('form').find('.compare-view-group img').attr('src').indexOf('CM-0000001SO4') !== -1) { 404 prodImage = 'not available'; 405 } else { 406 prodImage = 'available'; 407 } 408 productId = $(element).find('.airgas-part-number em').text(); 409 setSearchObject(index + 1, prodImage, productId, null); 410 _satellite.track('InternalSearch_addToCart'); 411 }); 412 }); 413 } 414 } 415 416 /* Adobe Product SKU Search Data Layer Creation*/ 417 function adobeProductSKUTrack() { 418 /* Setting JS Object When the user inputs exact product sku in search box, page gets redirected */ 419 /** 420 * searchTermSKU - Added input hidden field to capture the SKU value 421 * after page redirect. 422 **/ 423 424 // ARG21900998 PDP - Data Layer Object 425 var productDetailsPageObj; 426 if ($('.page-ProductDetailsPage').length > 0 && $('#searchTermSKU').length > 0) { 427 productDetailsPageObj = { 428 internalSearchTermInfo: { 429 internalSearchTerm: $('#searchTermSKU').val() !== undefined ? $('#searchTermSKU').val() : '', 430 suggestedSearchTerm: '' 431 } 432 }; 433 $.extend(_A.digitalData, productDetailsPageObj); // Appending internalSearchTermInfo to the existing datalayer 434 _satellite.track('InternalSearch_redirect'); 435 } 436 } 437 438 /* Adobe Vimeo Video Tracking Data Layer Events*/ 439 function adobeVimeoVideoTrack() { 440 setTimeout(function () { 441 $('iframe').each(function (index, iframeElement) { 442 if ($(iframeElement).attr('src')) { 443 if ($(iframeElement).attr('src').indexOf('vimeo') !== -1) { 444 $(iframeElement).attr('id', 'video' + index); 445 } 446 } 447 }); 448 capturePlayPauseEvents(); 449 }, 2000); 450 } 451 452 /* Adobe Form Tracking Data Layer Creation */ 453 function adobeFormTracking() { 454 var errorField, 455 formError, 456 formOptionsSelected = ''; 457 $('form').each(function (index, element) { 458 if ($(element).find('#globalMessages').length > 0) { 459 /* common Data Layer for forms */ 460 _A.digitalData = { 461 formInfo: { 462 formName: $('#adobeFormName').val() !== undefined ? $('#adobeFormName').val() : '', 463 formType: 'lead' 464 } 465 }; 466 if ($(element).find('.warning').length === 0 && $('#globalMessages .js-form-warning').length === 0) { 467 /* Form Load Tracking */ 468 _satellite.track('form-start'); 469 } else { 470 /* Form Error Tracking */ 471 if ($(element).find('#globalMessages .js-form-warning').length > 0 && $('input.warning, select.warning').length === 0) { 472 formError = $(element).find('#globalMessages .js-msg').text().trim(); 473 } else { 474 $(element).find('input.warning, select.warning').each(function (index, ele) { 475 errorField = $(ele).parent().find('span')[0].innerText.replaceAll('*', '').trim(); 476 if (formError === undefined) { 477 formError = errorField; 478 } else { 479 formError = formError + '|' + errorField; 480 } 481 }); 482 } 483 if ($('#cardNumberValidationError').length > 0) { 484 formError = formError + '|' + 'Credit Card number'; 485 } 486 /* Data Layer Object for Form errors */ 487 _A.digitalData.formInfo.formError = formError; 488 _satellite.track('form-error'); 489 } 490 /* Form Submit Tracking */ 491 $(element).on('submit', function () { 492 /* Capture the checked values to pass to the data layer object */ 493 $(element).closest('form').find('input, select').each(function (index, element) { 494 if ($(element).attr('type') === 'checkbox' && $(element).is(':checked')) { 495 if (formOptionsSelected === '') { 496 formOptionsSelected = $(element).parent().find('label').text(); 497 } else { 498 formOptionsSelected = formOptionsSelected + '|' + $(element).attr('id'); 499 } 500 } 501 }); 502 _A.digitalData = { 503 formInfo: { 504 formName: $('#adobeFormName').val() !== undefined ? $('#adobeFormName').val() : '', 505 formType: 'lead', 506 formOptionsSelect: formOptionsSelected 507 } 508 }; 509 _satellite.track('form-complete'); 510 }); 511 } 512 }); 513 } 514 515 function myItemsTracking() { 516 var searchTerm = $('#searchTerms').val() !== undefined ? $('#searchTerms').val() : ''; 517 var searchResultsCount; 518 searchResultsCount = $('#your_products').find('tbody tr').length; 519 _A.digitalData = { 520 myItemsSearch: { 521 searchTerm: searchTerm, 522 searchResultsCount: searchResultsCount 523 } 524 }; 525 _satellite.track('myitems-search-success'); 526 527 /* Handle search result click */ 528 if ($('#your_products').length > 0) { 529 $('.add-to-cart-container').each(function (index, element) { 530 $(element).find('.product_selector a, .product-list a, form button').click(function (e) { 531 _A.digitalData = { 532 myItemsSearch: { 533 searchTerm: searchTerm, 534 searchResultClicked: $(element).find('.product-list a').text().trim(), 535 searchResultIndex: (index + 1).toString(), 536 searchResultPage: $('.pagination').length > 0 ? $('.pagination .currentPageActive')[0].innerText : '', 537 searchFilterBy: $('#catalogType').find(':selected').text() 538 } 539 }; 540 if ($(e.currentTarget).attr('type') === 'button') { 541 _satellite.track('myitems-search-addtocart'); 542 } else { 543 _satellite.track('myitems-search-resultclicked'); 544 } 545 }); 546 }); 547 } 548 } 549 550 function sdsSearchTracking() { 551 var searchTerm = $('.inputSearchTextID').val() !== undefined ? $('.inputSearchTextID').val() : ''; 552 var searchResultsCount; 553 searchResultsCount = $('#msdsSearchForm > div.table-content > table > tbody > tr').length; 554 _A.digitalData = { 555 sdsSearchInfo: { 556 searchTerm: searchTerm, 557 searchResultsCount: searchResultsCount 558 } 559 }; 560 _satellite.track('sds-search-success'); 561 /* Handle View Button click tracking */ 562 if ($('.sds-view-btn').length > 0) { 563 $('.sds-view-btn').each(function (index, element) { 564 $(element).click(function (e) { 565 var currentElement = $(e.currentTarget); 566 _A.digitalData = { 567 sdsSearchInfo: { 568 searchTerm: searchTerm, 569 searchResultClicked: currentElement.closest('tr').find('td')[0].innerText.trim(), 570 searchResultIndex: (index + 1).toString(), 571 searchResultPage: $('.pagination').length > 0 ? $('.pagination .currentPageActive')[0].innerText : '', 572 searchFilterBy: $('select#sortOrder').find(':selected').text() 573 } 574 }; 575 _satellite.track('sds-search-view'); 576 }); 577 }); 578 } 579 } 580 581 /* Adobe Link Tracking Data Layer Object Creation */ 582 function linksDataLayer(currentElement, fromSearchLinkClick) { 583 var linkType, 584 linkName, 585 linkCategory, 586 linkObj, 587 siteRegion; 588 589 if (currentElement !== null && currentElement !== undefined) { 590 if (($(currentElement).attr('data-adobe-link-name') !== undefined) && ($(currentElement).parent().hasClass('footer-svg-logo-box'))) { 591 $(currentElement).attr('data-adobe-link-name', 'Airgas an Air Liquide Company'); 592 } 593 if ($(currentElement).hasClass('adobe-link-track-ext')) { 594 linkType = 'external'; 595 linkName = $(currentElement).find('title').text().trim(); 596 } else { 597 linkType = 'internal'; 598 if ($(currentElement).data('adobe-link-name') !== undefined) { 599 if ($(currentElement).hasClass('results-cmslink-text')) { 600 linkName = $(currentElement).data('adobe-link-name').replace('<em>', '').replace('</em>', ''); 601 } else { 602 linkName = $(currentElement).data('adobe-link-name'); 603 } 604 } else { 605 linkName = $(currentElement).attr('data-value'); 606 if($(currentElement).hasClass('.reqd-link-text')) { 607 linkName = $(currentElement).text(); 608 } 609 } 610 if($(currentElement).parents('.all-devices-row').is(':visible')) { 611 linkName = $(currentElement).data('alarm-type'); 612 } 613 if ($(currentElement).hasClass('view-system-btn')) { 614 linkName = $(currentElement).attr('title'); 615 } 616 } 617 if(fromSearchLinkClick) { 618 linkName = $(currentElement).closest('a').data('value'); 619 } 620 if ($(currentElement).parents().hasClass('container header') || $(currentElement).parents().hasClass('navigation-bar-extended') || ( 621 $(currentElement).parents().closest('div').attr('class').indexOf('monetate_selector') === 0) || $(currentElement).parents().hasClass('cookie-message') || 622 $(currentElement).parents().hasClass('mobile-canvas')) { 623 siteRegion = 'Header'; 624 } else if ($(currentElement).parents().hasClass('main-content') || $(currentElement).parents().hasClass('container header-utility') || 625 $(currentElement).parents().hasClass('home-page')) { 626 siteRegion = 'Body'; 627 } else if ($(currentElement).parents().hasClass('footer') || $(currentElement).parents().hasClass('bottom-links')) { 628 siteRegion = 'Footer'; 629 } else if($(currentElement).parents('.fancybox-container').length > 0) { 630 siteRegion = 'Modal'; 631 } 632 if (_A.digitalData.hasOwnProperty('pageInfo')) { 633 delete _A.digitalData.pageInfo; 634 } 635 linkObj = { 636 pageInfo: { 637 pageName: pageName, 638 pageURL: pageURL, 639 pageType: pageType 640 }, 641 linkName: linkName, 642 linkPageName: pageName, 643 linkType: linkType, 644 siteRegion: siteRegion 645 }; 646 if(fromSearchLinkClick) { 647 return linkObj; 648 } 649 if ($(currentElement).closest('.column-reference-tile').length > 0) { 650 linkCategory = $(currentElement).closest('.column-reference-tile').find('h2').text(); 651 linkObj['linkCategory'] = linkCategory; 652 } else if ($(currentElement).closest('.subcategory-container').length > 0) { 653 linkCategory = $(currentElement).closest('.subcategory-container').find('.subcategories').text(); 654 linkObj['linkCategory'] = linkCategory; 655 } 656 suggestedProductTrack(false, currentElement); 657 if (_A.digitalData.hasOwnProperty('linkObj')) { 658 delete _A.digitalData.linkObj; 659 } 660 $.extend(_A.digitalData, linkObj); 661 if($(currentElement).hasClass('extract')){ 662 _satellite.track('List_Download'); 663 } 664 _satellite.track('linkCli
664cked'); 665 } 666 } 667 668 /* Adobe Results List Tracking Data Layer Object Creation */ 669 function setSearchObject(index, prodImage, productId, currentProductClick) { 670 var userSearchTerm = '', 671 filterElem, 672 prodFilter, 673 pageIndexVal, 674 pageLastIndexVal, 675 linkObject; 676 677 if (localStorage.getItem('userSearchSelectedTerm') !== null) { 678 userSearchTerm = encodeURI(localStorage.getItem('userSearchSelectedTerm')); 679 // Removing user search term from local storage after assigning to data layer 680 localStorage.removeItem('userSearchSelectedTerm'); 681 } 682 /* Format Product Filter panel options */ 683 if ($('#product-facet > .link-list').find('input[type="hidden"]').length > 0) { 684 $('#product-facet > .link-list').find('input[type="hidden"]').each(function (index, element) { 685 filterElem = $(element).attr('class'); 686 if (prodFilter === undefined) { 687 prodFilter = filterElem; 688 } else { 689 prodFilter = prodFilter + '|' + filterElem; 690 } 691 }); 692 } else { 693 prodFilter = 'none'; 694 } 695 if ($('.isemarketSite').val() === 'true') { 696 pageIndexVal = $('.first-pagination .currentPageActive').text(); 697 pageLastIndexVal = $('.first-pagination li:nth-last-child(2)').length > 0 ? $('.first-pagination li:nth-last-child(2)').text().replaceAll('.', '').trim() : ''; 698 } else { 699 pageIndexVal = $('.pagination .currentPageActive').text(); 700 pageLastIndexVal = $('.pagination li:nth-last-child(2)').length > 0 ? $('.pagination li:nth-last-child(2)').text().replaceAll('.', '').trim() : ''; 701 } 702 linkObject = linksDataLayer(currentProductClick, true); 703 _A.digitalData = { 704 internalSearchTerm: userSearchTerm, 705 suggestedSearchTerm: '', 706 prodPosition: index.toString(), 707 pageIndex: pageIndexVal, 708 pageLastIndex: pageLastIndexVal, 709 prodfilter: prodFilter, 710 prodSortBy: $('.sortOptions').find(':selected').text().trim(), 711 prodImage: prodImage, 712 prodId: productId, 713 linkObj : linkObject 714 }; 715 } 716 717 /* Adobe Vimeo Video tracking Data Layer Object Creation */ 718 function capturePlayPauseEvents() { 719 var player = {}, 720 trackPlayObj = {}, 721 iframe = $('iframe'), 722 videoCompleted = false; 723 iframe.each(function (index, element) { 724 if ($(element).attr('src')) { 725 if ($(element).attr('src').indexOf('vimeo') !== -1) { 726 player['player' + index] = new Vimeo.Player(element); 727 trackPlayObj['trackingStarted' + index] = false; 728 player['player' + index].on('progress', function (data) { 729 if (data.percent > 0.95) { 730 data.percent = 1; 731 videoCompleted = true; 732 } 733 }); 734 player['player' + index].on('play', function () { 735 videoCompleted = false; 736 if (!trackPlayObj['trackingStarted' + index]) { 737 startTracking('play', 'video-playing', player, index, trackPlayObj); 738 } else { 739 console.log('videoResume'); 740 } 741 }); 742 player['player' + index].on('pause', function () { 743 if (videoCompleted === false) { 744 console.log('videoPause'); 745 startTracking('pause', 'video-paused', player, index, trackPlayObj); 746 } 747 }); 748 player['player' + index].on('seeked', function () { 749 console.log('videoSeeked'); 750 _satellite.track('video-seeked'); 751 }); 752 player['player' + index].on('bufferstart', function () { 753 console.log('bufferStart'); 754 _satellite.track('video-bufferstart'); 755 }); 756 player['player' + index].on('bufferend', function () { 757 console.log('bufferEnd'); 758 _satellite.track('video-bufferend'); 759 }); 760 player['player' + index].on('ended', function () { 761 console.log('videoComplete'); 762 trackPlayObj['trackingStarted' + index] = false;
763 startTracking('ended', 'video-ended', player, index, trackPlayObj); 764 }); 765 } 766 } 767 }); 768 } 769 770 function startTracking(playerEvent, adobeTrackEvent, player, index, trackPlayObj) { 771 Promise.all([player['player' + index].getVideoId(), player['player' + index].getVideoTitle(), player['player' + index].getDuration(), index + 1, player['player' + index].getCurrentTime()]).then(function (values) { 772 var vidID = values[0] + '', 773 vidName = values[1], 774 vidDuration = Math.round(values[2]), 775 vidIndex = values[3], 776 vidCurrentTime = values[4], 777 videoObj; 778 trackPlayObj['trackingStarted' + index] = true; 779 console.log('videoStart: ' + 'Vimeo|' + vidName + '|' + vidID + '|' + vidDuration + '|' + vidIndex); 780 videoObj = { 781 videoInfo: { 782 videoName: vidName, 783 videoID: vidID 784 } 785 }; 786 switch (playerEvent) { 787 case 'play': 788 videoObj.videoInfo.videoDuration = vidDuration; 789 videoObj.videoInfo.videoPosition = vidIndex; 790 $.extend(_A.digitalData, videoObj); 791 _satellite.track(adobeTrackEvent); 792 break; 793 case 'pause': 794 videoObj.videoInfo.videoCurrentTime = vidCurrentTime; 795 $.extend(_A.digitalData, videoObj); 796 _satellite.track(adobeTrackEvent); 797 break; 798 case 'ended': 799 $.extend(_A.digitalData, videoObj); 800 _satellite.track(adobeTrackEvent); 801 break; 802 } 803 }); 804 } 805 806 function productPageLoadTrack() { 807 var pdpPageName = decodeURIComponent(window.location.pathname), 808 productObj, 809 isEmarketSite = $('.isemarketSite').val() === 'true' ? true : false, 810 isMobile = $('.mobile-canvas').is(':visible')?true:false; 811 if (pdpPageName.includes('/p/')) { 812 productObj = { 813 productInfo: { 814 brand: $('input[name=productBrand]').val() !== undefined ? $('input[name=productBrand]').val().trim() : '', 815 category: $('input[name=productCategory]').val() !== undefined ? $('input[name=productCategory]').val().trim() : '', 816 id: $('#productCode').text().trim(), 817 name: $('#productName').text().replace(/\t/g, '').replace(/\n/g, '').trim(), 818 price: $('#productPrice').text().replace('$', '').trim(), 819 salePrice: $('#productSellingPrice').text().replace('$', '').trim(), 820 uom: $('input[name=unitOfMeasure]').val() !== undefined ? $('input[name=unitOfMeasure]').val().trim() : '', 821 quantity: $('input[name=qty]').val() !== undefined ? $('input[name=qty]').val().trim() : '' 822 } 823 }; 824 //On load of sugggested accessories PDP adding parent PDP Info 825 826 if (location.href.includes('isAccessories=true')) { 827 if(!isEmarketSite && !isMobile){ 828 productObj.parentProduct ={ 829 brand:$('.parent-productBrand').text() !== ''?$('.parent-productBrand').text():'', 830 category: $('.parent-productCategory').text() !== ''?$('.parent-productCategory').text():'', 831 id: $('.parent-productId').text() !== ''?$('.parent-productId').text():'', 832 name: $('.parent-productName').text() !== ''?$('.parent-productName').text():'' 833 }; 834 $.extend(_A.digitalData, productObj); 835 } 836 837 } 838 839 availableSelectableDeliveryMethods(productObj.productInfo); 840 $.extend(_A.digitalData, productObj); 841 suggestedProductTrack(true, null); 842 } 843 } 844 845 function adobeAddtoCartTrack(e) { 846 try { 847 e.preventDefault(); 848 adobeLinkTrack(); 849 var productObj, 850 totalCartItems, 851 currentProductPosition, 852 selectedCartContainer = [], 853 currentItemPrice, 854 currentItemSalePrice, 855 tempSellingPrice, 856 pageName = decodeURIComponent(window.location.pathname), 857 $currentRowEl, 858 isPDP, 859 isPLP, 860 isMyItems, 861 isFPI, 862 isListDetails, 863 isEmarketSite = $('.isemarketSite').val() === 'true' ? true : false, 864 uom, 865 quantity; 866 867 $currentRowEl = $(arguments)[2].parents('.add-to-cart-container'); 868 totalCartItems = $('.js-mini-cart-container span.js-total-cart-items')[0].innerText; 869 if (pageName.includes('/p/')) { 870 if(localStorage.getItem('productPosition') !== null){ 871 currentProductPosition = localStorage.getItem('productPosition'); 872 }else{ 873 currentProductPosition = '0:0'; 874 } 875 /*currentProductPosition = '1:1';*/ 876 } else { 877 currentProductPosition = $(arguments)[1]; 878 } 879 if (pageName.includes('/manageQuote/quoteDetails')) { 880 currentItemPrice = $('#cartpopUpregularPrice').text().replace('$', '').trim(); 881 currentItemSalePrice = $('#cartpopUpsalePrice').text().replace('$', '').trim(); 882 } else { 883 if ($currentRowEl.find('.gasProductRegularPrice').length > 0) { 884 tempSellingPrice = $('#cartpopUpsalePrice').text().replace('$', '').trim(); 885 if (tempSellingPrice !== '0.00') { 886 currentItemPrice = $('#cartpopUpsalePrice').text().replace('$', '').trim(); 887 } else { 888 currentItemPrice = $('#cartpopUpregularPrice').text().replace('$', '').trim(); 889 } 890 } else { 891 currentItemPrice = $('#cartpopUpregularPrice').text().replace('$', '').trim(); 892 } 893 if ($currentRowEl.find('.productPriceSale').val() === 'true') { 894 currentItemSalePrice = $('#cartpopUpsalePrice').text().replace('$', '').trim(); 895 } else { 896 currentItemSalePrice = ''; 897 } 898 } 899 900 if (!isEmarketSite) { 901 uom = $('.js-product-list').find('.quantity .value .label').text().trim(); 902 quantity = $('.js-product-list').find('.qty-value').text().trim(); 903 } else { 904 uom = $('.js-product-list .packagesize .value').text().trim(); 905 quantity = $('.js-product-list .quantity .value').text().trim(); 906 } 907 908 selectedCartContainer.push({ 909 id: $('.js-product-list .airgas-part-number .value').text().trim(), 910 name: $('.js-product-list .shortdescription').text().trim(), 911 price: (currentItemPrice === '0' || currentItemPrice === '0.00') ? '' : currentItemPrice, 912 salePrice: (currentItemSalePrice === '0' || currentItemSalePrice === '0.00') ? '' : currentItemSalePrice, 913 uom: uom, 914 brand: $('#cartpopUpBrand').text().trim(), 915 category: $('#cartpopUpcategory').text().replace('[', '').replace(']', '').trim(), 916 position: currentProductPosition === undefined ? '' : currentProductPosition, 917 quantity: quantity 918 }); 919 isPDP = $('.ora-product-details').length > 0 ? true : false;
920 isPLP = $('.ora-modal-add-cart-options').length > 0 ? true : false; 921 isMyItems = $('.ora3-myitems-detail').length > 0 ? true : false; 922 isFPI = $('.ora-freuently-purchases').length > 0 ? true : false; 923 isListDetails = $('.ora-form-list-detail').length > 0 ? true : false; 924 if (isPDP || isPLP) { 925 selectableDeliveryMethodInfo(selectedCartContainer, isPDP, isPLP, false, null, true, 0); 926 } else if (isMyItems || isFPI || isListDetails) { 927 availableDeliveryMethodInfo(selectedCartContainer, isMyItems, isFPI, isListDetails, $currentRowEl, 0); 928 } 929 productObj = { 930 productInfo: { 931 cartOpen: totalCartItems === '0' ? true : false, 932 cartId: $('.jsCheckoutCartId').text(), 933 productsAddedToCart: selectedCartContainer 934 } 935 }; 936 937 if (_A.digitalData.hasOwnProperty('listInfo')) { 938 delete _A.digitalData.listInfo; 939 } 940 if (_A.digitalData.hasOwnProperty('expressOrderInfo')) { 941 delete _A.digitalData.expressOrderInfo; 942 } 943 if (_A.digitalData.hasOwnProperty('listAddition')) { 944 delete _A.digitalData.listAddition; 945 } 946 $.extend(_A.digitalData, productObj); 947 _satellite.track('global-add-to-cart'); 948 } catch (e) { 949 console.log('Adobe Exception: ' + e.message); 950 } 951 } 952 /** 953 * Function to append delivery Methods Info to Product Obj for PDP and PLP Pages Add to Cart 954 * Note - Only Sinlge Add to cart exists for this above pages 955 */ 956 function selectableDeliveryMethodInfo(productInfo, isPDP, isPLP, isCart, currentCartItem, isArray, index) { 957 try { 958 var isMultipleDate, 959 deliveryMethodInfo = [], 960 deliveryModes = [], 961 deliveryInfo = {}, 962 deliveryDate, 963 currentDate, 964 singleQuantity, 965 activeDeliveryMethod, 966 deliveryMethod; 967 968 currentDate = (new Date().getMonth() + 1) + '/' + new Date().getDate() + '/' + new Date().getFullYear().toString().substring(-2); 969 if (isPDP) { 970 activeDeliveryMethod = $('.ora-product-details').find('.delivery-method.active'); 971 singleQuantity = productInfo[0] !== undefined ? productInfo[0].quantity : ''; 972 } else if (isPLP) { 973 activeDeliveryMethod = $('.ora-modal-add-cart-options').find('.delivery-method.active'); 974 singleQuantity = productInfo[0] !== undefined ? productInfo[0].quantity : ''; 975 } else if (isCart) { 976 activeDeliveryMethod = $(currentCartItem).find('.delivery-method.active'); 977 singleQuantity = $(currentCartItem).find('#productQuantity').val(); 978 } 979 isMultipleDate = $(activeDeliveryMethod).find('.delivery-by-date-multiple').length > 0 ? true : false; 980 deliveryMethod = $(activeDeliveryMethod).find('.item-delivery-label').text() !== undefined ? $(activeDeliveryMethod).find('.item-delivery-label').text() : ''; 981 if (deliveryMethod === '') { 982 deliveryMethodInfo.push({ 983 quantity: '0', 984 daysForDelivery: '0' 985 }); 986 } else { 987 if (isMultipleDate) { 988 $(activeDeliveryMethod).find('.multiple-date').each(function (index, elmnt) { 989 deliveryDate = $(elmnt).find('.schInfo-deliveryDate').text() !== undefined ? $(elmnt).find('.schInfo-deliveryDate').text() : ''; 990 deliveryMethodInfo.push({ 991 quantity: $(elmnt).find('.single-quantity').val(), 992 daysForDelivery: Math.floor((Date.parse(deliveryDate) - Date.parse(currentDate)) / 86400000) 993 }); 994 }); 995 } else { 996 deliveryDate = $(activeDeliveryMethod).find('.schInfo-deliveryDate').text() !== undefined ? $(activeDeliveryMethod).find('.schInfo-deliveryDate').text() : ''; 997 deliveryMethodInfo.push({ 998 quantity: singleQuantity, 999 daysForDelivery: Math.floor((Date.parse(deliveryDate) - Date.parse(currentDate)) / 86400000) 1000 }); 1001 } 1002 } 1003 deliveryInfo = { 1004 DeliveryMethod: deliveryMethod, 1005 DeliveryMethodInfo: deliveryMethodInfo 1006 }; 1007 deliveryModes.push({ 1008 deliveryInfo: deliveryInfo 1009 }); 1010 if (isArray) { 1011 productInfo[index]['deliveryModes'] = deliveryModes; 1012 } else { 1013 productInfo['deliveryModes'] = deliveryModes; 1014 } 1015 } catch (e) { 1016 console.log('Exception: ' + e.message); 1017 } 1018 } 1019 /** 1020 * Function to append delivery modes info to product info for single add to cart in MyItems, FPI and List Details page. 1021 * Note - Multiple add to cart for this pages is handled in form-list-details.js page 1022 */ 1023 function availableDeliveryMethodInfo(productInfo, isMyItems, isFPI, isListDetails, currentRowEl, index) { 1024 var deliveryMethods, 1025 deliveryMethod, 1026 deliveryDate, 1027 currentDate, 1028 deliveryModes = [], 1029 deliveryInfo = [], 1030 deliveryMethodInfo = []; 1031 1032 currentDate = (new Date().getMonth() + 1) + '/' + new Date().getDate() + '/' + new Date().getFullYear().toString().substring(-2); 1033 deliveryMethods = $(currentRowEl).find('.ora-availability-mode'); 1034 $(deliveryMethods).each(function (index, elmnt) { 1035 deliveryMethodInfo = []; 1036 deliveryMethod = $(elmnt).find('span').text(); 1037 if ($(elmnt).hasClass('ora-availability-disable') || $(deliveryMethods).length === 0) { 1038 deliveryMethodInfo.push({ 1039 quantity: '0', 1040 daysForDelivery: '0' 1041 }); 1042 } else { 1043 if ($(elmnt).find('.ora-multiple-dates').length > 0) { 1044 $(elmnt).find('.multiple-dates > .multiple-date').each(function (itr, el) { 1045 deliveryDate = $(el).find('.multiple-date').text(); 1046 deliveryMethodInfo.push({ 1047 quantity: $(el).find('.quantity-multi').val(), 1048 daysForDelivery: Math.floor((Date.parse(deliveryDate) - Date.parse(currentDate)) / 86400000) 1049 }); 1050 }); 1051 } else { 1052 deliveryDate = $(elmnt).find('.ora-availability-date').text(); 1053 deliveryMethodInfo.push({ 1054 quantity: $(elmnt).parents('.add-to-cart-container').find('.quantity-val').val(), 1055 daysForDelivery: Math.floor((Date.parse(deliveryDate) - Date.parse(currentDate)) / 86400000) 1056 }); 1057 } 1058 } 1059 deliveryInfo.push({ 1060 DeliveryMethod: deliveryMethod, 1061 DeliveryMethodInfo: deliveryMethodInfo 1062 }); 1063 }); 1064 deliveryModes.push({ 1065 deliveryInfo: deliveryInfo 1066 }); 1067 productInfo[index]['deliveryModes'] = deliveryModes; 1068 } 1069 /** 1070 * function to capture delivery modes in PDP View 1071 */ 1072 function availableSelectableDeliveryMethods(productInfo) { 1073 try { 1074 var availableDeliveryMethods, 1075 activeDeliveryMethod, 1076 defaultDeliveryMethod, 1077 availability, 1078 isPriceError, 1079 isMultipleDate, 1080 isItemNA, 1081 deliveryMethod, 1082 deliveryDate, 1083 currentDate, 1084 isNotAvailableError, 1085 deliveryInfo = [], 1086 deliveryMethods = [], 1087 deliveryMethodInfo = []; 1088 1089 currentDate = (new Date().getMonth() + 1) + '/' + new Date().getDate() + '/' + new Date().getFullYear().toString().substring(-2); 1090 availableDeliveryMethods = $('.ora-product-details').find('.delivery-method'); 1091 activeDeliveryMethod = $('.ora-product-details').find('.delivery-method.active'); 1092 defaultDeliveryMethod = $(activeDeliveryMethod).find('.item-delivery-label').text() !== undefined ? $(activeDeliveryMethod).find('.item-delivery-label').text() : ''; 1093 isPriceError = $('.ora-error-notification .ora-notification-label').text().includes('Price'); 1094 isNotAvailableError = $('.ora-error-notification .ora-notification-label').text().includes('Not available'); 1095 isItemNA = $('.remarks-content').length > 0; 1096 if (isPriceError) { 1097 availability = 'PRICE-NA'; 1098 } else if (isNotAvailableError) { 1099 availability = 'ONLINE PURCHASE-NA'; 1100 } else if (isItemNA) { 1101 availability = 'ITEM-NA'; 1102 } else { 1103 availability = 'YES'; 1104 } 1105 productInfo['availability'] = availability; 1106 $(availableDeliveryMethods).each(function (index, elmnt) { 1107 deliveryMethodInfo = []; 1108 isMultipleDate = $(elmnt).find('.multiple-dates.multiple-date-visible').length > 0 ? true : false;
1109 deliveryMethod = $(elmnt).find('.item-delivery-label').text() !== undefined ? $(elmnt).find('.item-delivery-label').text() : ''; 1110 if ($(elmnt).hasClass('not-available')) { 1111 deliveryMethodInfo.push({ 1112 quantity: '0', 1113 daysForDelivery: '0' 1114 }); 1115 } else { 1116 if (isMultipleDate) { 1117 $(elmnt).find('.multiple-date').each(function (index, elmnt) { 1118 deliveryDate = $(elmnt).find('.delivered-by-date').text() !== undefined ? $(elmnt).find('.delivered-by-date').text() : ''; 1119 deliveryMethodInfo.push({ 1120 quantity: $(elmnt).find('.single-quantity').val(), 1121 daysForDelivery: Math.floor((Date.parse(deliveryDate) - Date.parse(currentDate)) / 86400000) 1122 }); 1123 }); 1124 } else { 1125 deliveryDate = $(elmnt).find('.delivery-by-date').text() !== undefined ? $(elmnt).find('.delivery-by-date').text() : ''; 1126 deliveryMethodInfo.push({ 1127 quantity: $('.js-qty').val(), 1128 daysForDelivery: Math.floor((Date.parse(deliveryDate) - Date.parse(currentDate)) / 86400000) 1129 }); 1130 } 1131 } 1132 deliveryMethods.push({ 1133 deliveryMethod: deliveryMethod, 1134 deliveryMethodInfo: deliveryMethodInfo 1135 }); 1136 }); 1137 deliveryInfo = { 1138 defaultDeliveryMethod: defaultDeliveryMethod, 1139 methodInfo: deliveryMethods 1140 }; 1141 productInfo['deliveryInfo'] = deliveryInfo; 1142 } catch (e) { 1143 console.log('Exception: ' + e.message); 1144 } 1145 } 1146 /** 1147 * Function to append delivery Method info to product obj in Checkout Review and Confirmation page 1148 */ 1149 function orderDeliveryMethodsInfo(productInfo, orderItem, index) { 1150 try { 1151 var isMultipleDate, 1152 deliveryMethodInfo = [], 1153 deliveryModes = [], 1154 deliveryInfo = {}, 1155 deliveryDate, 1156 currentDate, 1157 deliveryMethod; 1158 1159 currentDate = (new Date().getMonth() + 1) + '/' + new Date().getDate() + '/' + new Date().getFullYear().toString().substring(-2); 1160 isMultipleDate = $(orderItem).find('.date-list .date').length > 0 ? true : false; 1161 deliveryMethod = $(orderItem).parents('.order-section').find('.deliverymode-title').text() !== undefined ? $(orderItem).parents('.order-section').find('.deliverymode-title').text() : ''; 1162 if (isMultipleDate) { 1163 $(orderItem).find('.date-list .date').each(function (index, elmnt) { 1164 deliveryDate = $(elmnt).find('.moment').text() !== undefined ? $(elmnt).find('.moment').text() : ''; 1165 deliveryMethodInfo.push({ 1166 quantity: $(elmnt).find('.quantity').text() !== undefined ? $(elmnt).find('.quantity').text().trim().split('')[0] : '', 1167 daysForDelivery: Math.floor((Date.parse(deliveryDate) - Date.parse(currentDate)) / 86400000) 1168 }); 1169 }); 1170 } else { 1171 deliveryDate = $(orderItem).find('.order-item-delivery .single-date').text() !== undefined ? $(orderItem).find('.order-item-delivery .single-date').text() : ''; 1172 deliveryMethodInfo.push({ 1173 quantity: $(orderItem).find('#quantity').val(), 1174 daysForDelivery: Math.floor((Date.parse(deliveryDate) - Date.parse(currentDate)) / 86400000) 1175 }); 1176 } 1177 deliveryInfo = { 1178 DeliveryMethod: deliveryMethod, 1179 DeliveryMethodInfo: deliveryMethodInfo 1180 }; 1181 deliveryModes.push({ 1182 deliveryInfo: deliveryInfo 1183 }); 1184 productInfo[index]['deliveryModes'] = deliveryModes; 1185 } catch (e) { 1186 console.log('Exception: ' + e.message); 1187 } 1188 } 1189 1190 function invoicePaymentInfoTrack() { 1191 var pageUrl = decodeURIComponent(window.location.pathname), 1192 InvoicesFull = [], 1193 InvoicesPartial = [], 1194 invoicesData = $('table tbody tr.even'), 1195 invoiceObj, 1196 hasFullInvoices = false, 1197 hasPartialInvoices = false;
1198 1199 if (pageUrl.includes('/invoicepartialconfirmation')) { 1200 if (invoicesData.length > 0) { 1201 invoicesData.each(function() { 1202 if($(this).find('.price span').text().trim() === '$0.00') { 1203 hasFullInvoices = true; 1204 } else { 1205 hasPartialInvoices = true; 1206 } 1207 }); 1208 if(hasFullInvoices && !hasPartialInvoices) { 1209 invoicesData.each(function () { 1210 InvoicesFull.push({ 1211 invoiceNo: $(this).find('.invoice-number p').text(), 1212 division: $(this).find('.doc-number p').text(), 1213 paymentAmount: $(this).find('.amount-paid p.price').text().replace('$', '').trim(), 1214 paymentMethod: $('.paymentMethod').val() !== undefined ? $('.paymentMethod').val() : '' 1215 }); 1216 1217 }); 1218 invoiceObj = { 1219 payInvoiceInfo: { 1220 Invoices: InvoicesFull, 1221 totalAmountPaid: $('form#invoiceARsForm').find('.total-amount-paid').text().replace('$', '').trim(), 1222 paymentDocNo: $('form#invoiceARsForm').find('.paymentDocNo').text().trim() 1223 } 1224 }; 1225 $.extend(_A.digitalData, invoiceObj); 1226 _satellite.track('invoice_FPay_call'); 1227 } else if(!hasFullInvoices && hasPartialInvoices) { 1228 invoicesData.each(function () { 1229 InvoicesPartial.push({ 1230 invoiceNo: $(this).find('.invoice-number p').text(), 1231 division: $(this).find('.doc-number p').text(), 1232 activeBal: $(this).find('.past-due p.price').text().replace('$', '').trim(), 1233 amount: $(this).find('.amount-paid p.price').text().replace('$', '').trim(), 1234 reasonCode: $(this).next().find('.reason p span').text().trim(), 1235 paymentMethod: $('.paymentMethod').val() !== undefined ? $('.paymentMethod').val() : '' 1236 }); 1237 }); 1238 invoiceObj = { 1239 payPartialInvoiceInfo: { 1240 Invoices: InvoicesPartial, 1241 totalAmountPaid: $('form#invoiceARsForm').find('.total-amount-paid').text().replace('$', '').trim(), 1242 paymentDocNo: $('form#invoiceARsForm').find('.paymentDocNo').text().trim() 1243 } 1244 }; 1245 $.extend(_A.digitalData, invoiceObj); 1246 _satellite.track('invoice_PPay_call'); 1247 1248 } else { 1249 invoicesData.each(function () { 1250 if($(this).find('.price span').text().trim() === '$0.00') { 1251 InvoicesFull.push({ 1252 invoiceNo: $(this).find('.invoice-number p').text(), 1253 division: $(this).find('.doc-number p').text(), 1254 paymentAmount: $(this).find('.amount-paid p.price').text().replace('$', '').trim(), 1255 paymentMethod: $('.paymentMethod').val() !== undefined ? $('.paymentMethod').val() : '' 1256 }); 1257 } else { 1258 InvoicesPartial.push({ 1259 invoiceNo: $(this).find('.invoice-number p').text(), 1260 division: $(this).find('.doc-number p').text(), 1261 activeBal: $(this).find('.past-due p.price').text().replace('$', '').trim(), 1262 amount: $(this).find('.amount-paid p.price').text().replace('$', '').trim(), 1263 reasonCode: $(this).next().find('.reason p span').text().trim(), 1264 paymentMethod: $('.paymentMethod').val() !== undefined ? $('.paymentMethod').val() : '' 1265 }); 1266 } 1267 }); 1268 invoiceObj = { 1269 payPartialInvoiceInfo: { 1270 Invoices: InvoicesPartial, 1271 totalAmountPaid: $('form#invoiceARsForm').find('.total-amount-paid').text().replace('$', '').trim(), 1272 paymentDocNo: $('form#invoiceARsForm').find('.paymentDocNo').text().trim() 1273 }, 1274 payInvoiceInfo: { 1275 Invoices: InvoicesFull, 1276 totalAmountPaid: $('form#invoiceARsForm').find('.total-amount-paid').text().replace('$', '').trim(), 1277 paymentDocNo: $('form#invoiceARsForm').find('.paymentDocNo').text().trim() 1278 } 1279 }; 1280 $.extend(_A.digitalData, invoiceObj); 1281 _satellite.track('invoice_FPay_call'); 1282 _satellite.track('invoice_PPay_call'); 1283 } 1284 } 1285 } 1286 } 1287 1288 function accountRegisterInfoTrack() { 1289 var pageUrl = decodeURIComponent(window.location.pathname), 1290 accountRegisterObj; 1291 1292 if (pageUrl.includes('/register/confirmation/')) { 1293 accountRegisterObj = { 1294 accountRegisterInfo: {
1295 accountID: $('#regionalAccountNumber').val() !== undefined ? $('#regionalAccountNumber').val() : '', 1296 userID: $('#encryptedEmail').val() !== undefined ? $('#encryptedEmail').val() : '', 1297 jsessionID: $('#registerJSessionId').text() 1298 } 1299 }; 1300 $.extend(_A.digitalData, accountRegisterObj); 1301 _satellite.track('account_register_confirm'); 1302 } 1303 } 1304 1305 function setCartId() { 1306 var singleOrderCartId, 1307 multipleOrderCartIdElem, 1308 multipleOrderCartIds = []; 1309 singleOrderCartId = $('.review-order').find('.singleOrderCartId').val() !== undefined ? $('.review-order').find('.singleOrderCartId').val() : ''; 1310 multipleOrderCartIdElem = $('.monetate-order').find('.multipleOrderCartId'); 1311 if (singleOrderCartId !== undefined && singleOrderCartId !== '') { 1312 localStorage.setItem('singleOrderCartId', encodeURI(singleOrderCartId)); 1313 localStorage.removeItem('multipleOrderCartIdsList'); 1314 } else { 1315 $.each(multipleOrderCartIdElem, function (index, element) { 1316 multipleOrderCartIds[index] = $(element).val() !== undefined ? $(element).val() : ''; 1317 }); 1318 localStorage.setItem('multipleOrderCartIdList', multipleOrderCartIds); 1319 localStorage.removeItem('singleOrderCartId'); 1320 } 1321 } 1322 1323 function oraMultiOrderTracking() { 1324 var orderObj = { 1325 order: [] 1326 }, 1327 purchaseObj = {}, 1328 purchaseId, 1329 shipItType, 1330 paymentMethod, 1331 requisitionFlag, 1332 cartId = '', 1333 surchargeKey, 1334 salePrice, 1335 returnCyl, 1336 purchaseSalesOrg = salesOrg, 1337 masterOrderID = $('.order-confirmation').find('#masterOrderID').val(), 1338 couponCode = $('.order-confirmation').find('#couponCode').length > 0 ? $('.order-confirmation').find('#couponCode').val() : '', 1339 multipleCartIdList = localStorage.getItem('multipleOrderCartIdList') !== null ? localStorage.getItem('multipleOrderCartIdList').split(',') : '', 1340 atcPageName, 1341 addedFrom, 1342 quoteID = '', 1343 quoteTime = ''; 1344 1345 1346 $('.monetate-order').each(function (index, elem) { 1347 if ($(elem).find('.order-title').text().indexOf('#') === -1) { 1348 purchaseId = $('.order-number').find('#singleOrderId').val(); 1349 cartId = encodeURI(localStorage.getItem('singleOrderCartId')); 1350 } else { 1351 purchaseId = $(elem).find('#purchaseID').val(); 1352 $.each(multipleCartIdList, function (iteration, fieldValue) { 1353 if (index === iteration) { 1354 cartId = encodeURI(fieldValue); 1355 } 1356 }); 1357 } 1358 if ($('.order-confirmation').find('.billing-payment-icon').length > 0) { 1359 paymentMethod = 'On Account'; 1360 } else { 1361 paymentMethod = 'Credit Card'; 1362 } 1363 if (($('.order-number').find('#singleOrderId').val() !== '' && $('.order-number').find('#singleOrderId').val() !== undefined) || ($(elem).find('#purchaseID').val() !== '' && $(elem).find('#purchaseID').val() !== undefined)) { 1364 requisitionFlag = 'No'; 1365 } else { 1366 requisitionFlag = 'Yes'; 1367 } 1368 purchaseObj = { 1369 purchase: { 1370 action: 'transactionp_conf', 1371 affiliation: 'Airgas.com', 1372 id: purchaseId !== undefined ? purchaseId : '', 1373 masterOrderID: masterOrderID !== undefined ? masterOrderID : '', 1374 coupon: couponCode, 1375 revenue: '', 1376 tax: '', 1377 subtotal: '', 1378 discount: '', 1379 shipToAccount: $(elem).find('#shipToAccountNumber').val() !== undefined ? $(elem).find('#shipToAccountNumber').val() : '', 1380 paymentMethod: paymentMethod, 1381 cartId: cartId, 1382 req_flag: requisitionFlag, 1383 shipto_zip: $(elem).find('.address-one').text().split(',').pop(), 1384 shiptoSalesOrg: $(elem).find('#salesOrg').val() !== '' ? $(elem).find('#salesOrg').val() : purchaseSalesOrg 1385 }, 1386 products: [] 1387 }; 1388 if ($('.cart-totals-line-level').length > 0) { 1389 $('.cart-totals-line-level').find('.order-total').each(function (lineIndex, lineElement) { 1390 if (lineIndex === index) { 1391 purchaseObj.purchase.revenue = $(lineElement).find('.estimation').find('.order-list-item-price').text().replace('$', '').replace(',', '').trim(); 1392 } 1393 }); 1394 } else { 1395 purchaseObj.purchase.revenue = $('.grand-total').find('.order-list-item-price').text().replace('$', '').replace(',', '').trim(); 1396 } 1397 $('.order-total').find('.order').each(function (counter, elmnt) { 1398 if (counter === index) { 1399 $(elmnt).find('.order-list-item, .order-list-item-existing').each(function (loop, elm) { 1400 if ($(elm).hasClass('order-list-item')) { 1401 if ($(elm).find('.order-list-item-subtotal').text().trim().toLowerCase().indexOf('subtotal') !== -1) { 1402 purchaseObj.purchase.subtotal = $(elm).find('.order-list-item-price').text().replace('$', '').replace(',', '').trim(); 1403 } 1404 if ($(elm).find('.order-list-item-subtotal').text().trim().toLowerCase().indexOf('discounts') !== -1) { 1405 purchaseObj.purchase.discount = $(elm).find('.order-list-item-price').text().replace('$', '').replace(',', '').trim(); 1406 } 1407 if ($(elm).find('div').first().text().trim().toLowerCase().indexOf('taxes') !== -1) { 1408 purchaseObj.purchase.tax = $(elm).find('.order-list-item-price').text().replace('$', '').replace(',', '').trim(); 1409 } 1410 } else if ($(elm).hasClass('order-list-item-existing')) { 1411 /* Dynamic Surcharges key and value appending to purchase Obj */ 1412 $(elm).find('.cost-container').each(function (loopItr, elmn) { 1413 surchargeKey = $(elmn).text().split(':')[0].trim().replace(/[^a-zA-Z 0-9]+/g, '').split(' ').join('_').toLowerCase(); 1414 purchaseObj.purchase[surchargeKey] = $(elmn).find('.value').text().replace('$', '').replace(',', '').trim(); 1415 }); 1416 } 1417 }); 1418 } 1419 }); 1420 $(elem).find('.order-item').each(function (itr, el) { 1421 if ($(el).parents('.order-section-body-
1421products').find('.order-section-body-products-title').length > 0) { 1422 shipItType = $(el).parents('.order-section-body-products').find('.order-section-body-products-title').text().trim(); 1423 } 1424 if ($(el).find('.productPriceSale').val() === 'true') { 1425 salePrice = $(el).find('#productSellingPrice').text().replace('$', '').replace(',', '').trim(); 1426 } else { 1427 salePrice = ''; 1428 } 1429 returnCyl = $(el).find('.item-quantity-return').find('.item-quantity-value').text().trim().split('')[0]; 1430 atcPageName = $(el).find('.actPageName').val() !== undefined ? $(el).find('.actPageName').val().trim() : ''; 1431 if (atcPageName.indexOf('quoteDetailsPage') !== -1) { 1432 addedFrom = atcPageName.split('_')[0]; 1433 quoteID = atcPageName.split('_')[1]; 1434 quoteTime = $(el).find('.quoteTimeForConversion').val(); 1435 } else { 1436 addedFrom = atcPageName; 1437 } 1438 var quote_details={ 1439 quoteID: quoteID, 1440 quoteTimeForConversion: quoteTime, 1441 quotePOType: 'ZQT' 1442 }; 1443 1444 purchaseObj.products.push({ 1445 brand: $(el).find('#brand').val() !== undefined ? $(el).find('#brand').val() : '', 1446 category: $(el).find('#category').val() !== undefined ? $(el).find('#category').val() : '', 1447 id: $(el).find('#productCode').val() !== undefined ? $(el).find('#productCode').val() : '', 1448 name: $(el).find('#productDesc').text().replace(/\t/g, '').replace(/\n/g, '').trim(), 1449 position: itr + 1, 1450 price: $(el).find('.main-price > .value')[0].innerText.replace('$', '').replace(',', '').trim(), 1451 saleprice: salePrice, 1452 quantity: $(el).find('#quantity').val() !== undefined ? $(el).find('#quantity').val() : '', 1453 Shipment_Type: shipItType !== undefined ? shipItType : '', 1454 return_cyl: returnCyl !== undefined ? returnCyl : '', 1455 Delivery_Method: $(el).parents('.order-section').find('.delivery-icon + div').text().trim(), 1456 upc: $(el).find('#upc').val() !== undefined ? $(el).find('#upc').val().trim() : '', 1457 uom: $(el).find('#productUOM').val() !== undefined ? $(el).find('#productUOM').val().trim() : '', 1458 atc_method: addedFrom, 1459 quoteID: quoteID, 1460 quoteTimeForConversion: quoteTime, 1461 quote_details: quote_details 1462 }); 1463 orderDeliveryMethodsInfo(purchaseObj.products, el, itr); 1464 1465 }); 1466 orderObj.order.push(purchaseObj); 1467 $.extend(_A.digitalData, orderObj); 1468 }); 1469 _satellite.track('order_confirmation'); 1470 } 1471 1472 /** 1473 * Function to track quote submission 1474 */ 1475 function oraQuoteTracking(asyncType) { 1476 var productData, 1477 productInfoObj, 1478 productInfo = [], 1479 productQty, 1480 salePrice, 1481 quoteId; 1482 1483 delete _A.digitalData.productInfo; 1484 if (asyncType === 'submitQuote' || asyncType === 'submitQuoteEmarket') { 1485 delete _A.digitalData.linkName; 1486 delete _A.digitalData.linkPageName; 1487 delete _A.digitalData.linkType; 1488 delete _A.digitalData.siteRegion; 1489 quoteId = $('#cartForm').find('.js-msg').text().replace(/[^\d]/g, ''); 1490 _A.digitalData['quoteId'] = quoteId; 1491 } 1492 if (asyncType === 'submitQuoteEmarket' || asyncType === 'quoteRequestedEmarket') { 1493 productData = $('.shopping-cart-table tr.product'); 1494 } else { 1495 productData = $('.cart-items .cart-item'); 1496 } 1497 productData.each(function (index, element) { 1498 if ($(element).find('.productPriceSale').val() === 'true') { 1499 salePrice = $(element).find('#productSellingPrice').text().replace('$', '').replace(',', '').trim(); 1500 } else { 1501 salePrice = ''; 1502 } 1503 if (asyncType === 'submitQuoteEmarket' || asyncType === 'quoteRequestedEmarket') { 1504 productQty = $(element).find('.js-qty-input').val() !== undefined ? $(element).find('.js-qty-input').val() : ''; 1505 } else { 1506 productQty = $(element).find('#productQuantity').val() !== undefined ? $(element).find('#productQuantity').val() : ''; 1507 } 1508 productInfo.push({ 1509 brand: $(element).find('#brand').val() !== undefined ? $(element).find('#brand').val() : '', 1510 category: $(element).find('#category').val() !== undefined ? $(element).find('#category').val() : '',
1511 id: $(element).find('#productCode').val() !== undefined ? $(element).find('#productCode').val() : '', 1512 name: $(element).find('#productDesc').text().replace(/\t/g, '').replace(/\n/g, '').trim(), 1513 position: index + 1, 1514 salePrice: salePrice !== undefined ? salePrice : '', 1515 uom: $(element).find('#productUOM').val() !== undefined ? $(element).find('#productUOM').val() : '', 1516 quantity: productQty, 1517 price: $(element).find('.sale > .value')[0].innerText.replace('$', '').replace(',', '').trim() 1518 }); 1519 }); 1520 productInfoObj = { 1521 productInfo: productInfo 1522 }; 1523 $.extend(_A.digitalData, productInfoObj); 1524 if (asyncType === 'quoteRequested' || asyncType === 'quoteRequestedEmarket') { 1525 _satellite.track('ReqQuote'); 1526 } else if (asyncType === 'submitQuote' || asyncType === 'submitQuoteEmarket') { 1527 _satellite.track('quote-submitted'); 1528 } 1529 } 1530 1531 /** 1532 * This function executes on cart and review page load and capture all product information 1533 */ 1534 function oraCartFlowProductTracking(pageType, asyncType) { 1535 try { 1536 var productInfoObj = { 1537 productInfo: [] 1538 }, 1539 productInfo = [], 1540 productData, 1541 salePrice, 1542 productQty; 1543 1544 if (pageType === 'cart') { 1545 if (asyncType === 'updateDeliveryMethod') { 1546 delete _A.digitalData.productInfo; 1547 } 1548 productData = $('.cart-items .cart-item'); 1549 } else { 1550 productData = $('.review-order .order-item'); 1551 } 1552 /* Use Same hidden field name in product iteration */ 1553 productData.each(function (index, element) { 1554 if ($(element).find('.productPriceSale').val() === 'true') { 1555 salePrice = $(element).find('#productSellingPrice').text().replace('$', '').replace(',', '').trim(); 1556 } else { 1557 salePrice = ''; 1558 } 1559 if (pageType === 'cart') { 1560 productQty = $(element).find('#productQuantity').val() !== undefined ? $(element).find('#productQuantity').val() : ''; 1561 } else { 1562 productQty = $(element).find('#quantity').val() !== undefined ? $(element).find('#quantity').val() : ''; 1563 } 1564 productInfo.push({ 1565 brand: $(element).find('#brand').val() !== undefined ? $(element).find('#brand').val() : '', 1566 category: $(element).find('#category').val() !== undefined ? $(element).find('#category').val() : '', 1567 id: $(element).find('#productCode').val() !== undefined ? $(element).find('#productCode').val() : '', 1568 targetproductID: $(element).find('.substitute-products .airgas-part-number span').text(), 1569 name: $(element).find('#productDesc').text().replace(/\t/g, '').replace(/\n/g, '').trim(), 1570 position: index + 1, 1571 salePrice: salePrice !== undefined ? salePrice : '', 1572 uom: $(element).find('#productUOM').val() !== undefined ? $(element).find('#productUOM').val() : '', 1573 quantity: productQty, 1574 price: $(element).find('.sale > .value').length > 0 ? $(element).find('.sale > .value')[0].innerText.replace('$', '').replace(',', '').trim() : '' 1575 }); 1576 if (pageType === 'cart') { 1577 selectableDeliveryMethodInfo(productInfo, false, false, true, element, true, index); 1578 } 1579 if (pageType === 'review') { 1580 orderDeliveryMethodsInfo(productInfo, element, index); 1581 } 1582 }); 1583 productInfoObj.productInfo = productInfo; 1584 productInfoObj.productInfo.cartId = (pageType === 'cart') ? $('.jsCheckoutCartId').val() : $('.jsCheckoutCartId').text(); 1585 $.extend(_A.digitalData, productInfoObj); 1586 } catch (e) { 1587 console.log('Exception: ' + e.message); 1588 } 1589 } 1590 1591 /** 1592 * Function to handle ORA Async updates - Subscribed Function Definition 1593 */ 1594 function handleOraAsyncUpdates(event, currentLink, asyncType) { 1595 try { 1596 switch (asyncType) { 1597 case 'removeProduct': 1598 handleOraProductRemoveLinkAction(currentLink); 1599 break;
1600 case 'clearCart': 1601 delete _A.digitalData.removedProductInfo; 1602 handleOraClearCartLinkAction(); 1603 break; 1604 case 'updateQty': 1605 delete _A.digitalData.removedProductInfo; 1606 oraCartFlowProductTracking('cart'); 1607 break; 1608 case 'removeUpdateProductInfo': 1609 case 'updateDeliveryMethod': 1610 oraCartFlowProductTracking('cart'); 1611 break; 1612 case 'submitQuote': 1613 oraQuoteTracking('submitQuote'); 1614 break; 1615 case 'quoteRequested': 1616 oraQuoteTracking('quoteRequested'); 1617 break; 1618 case 'quoteRequestedEmarket': 1619 oraQuoteTracking('quoteRequestedEmarket'); 1620 break; 1621 } 1622 } catch (e) { 1623 console.log('Adobe Exception: ' + e.message); 1624 } 1625 } 1626 1627 /** 1628 * Function triggers when remove link is clicked to remove product in Cart page - callie handleOraAsyncUpdates 1629 */ 1630 function handleOraProductRemoveLinkAction(currentLink) { 1631 try { 1632 var productInfoObj, 1633 productEntryDiv; 1634 1635 productEntryDiv = $(currentLink).closest('.cart-item'); 1636 1637 productInfoObj = { 1638 removedProductInfo: { 1639 brand: $(productEntryDiv).find('#brand').val() !== undefined ? $(productEntryDiv).find('#brand').val() : '', 1640 category: $(productEntryDiv).find('#category').val() !== undefined ? $(productEntryDiv).find('#category').val() : '', 1641 id: $(productEntryDiv).find('#productCode').val() !== undefined ? $(productEntryDiv).find('#productCode').val() : '', 1642 name: $(productEntryDiv).find('#productDesc').text().replace(/\t/g, '').replace(/\n/g, '').trim(), 1643 uom: $(productEntryDiv).find('#productUOM').val() !== undefined ? (productEntryDiv).find('#productUOM').val() : '', 1644 quantity: $(productEntryDiv).find('#productQuantity').val() !== undefined ? $(productEntryDiv).find('#productQuantity').val() : '', 1645 price: $(productEntryDiv).find('.sale > .value').length > 0 ? $(productEntryDiv).find('.sale > .value')[0].innerText.replace('$', '').replace(',', '').trim() : '' 1646 } 1647 }; 1648 selectableDeliveryMethodInfo(productInfoObj.removedProductInfo, false, false, true, productEntryDiv, false, null); 1649 $.extend(_A.digitalData, productInfoObj); 1650 _satellite.track('global-remove-from-cart'); 1651 oraCartFlowProductTracking('cart'); 1652 } catch (e) { 1653 console.log('Exception: ' + e.message); 1654 } 1655 } 1656 1657 /** 1658 * Function triggered when clear cart is clicked - callie handleOraAsyncUpdates 1659 */ 1660 function handleOraClearCartLinkAction() { 1661 try { 1662 var productInfoObj = { 1663 removedProductInfo: [] 1664 }, 1665 removedProductInfo = [], 1666 productData, 1667 salePrice; 1668 1669 productData = $('.cart-items .cart-item'); 1670 productData.each(function (index, element) { 1671 if ($(element).find('.productPriceSale').val() === 'true') { 1672 salePrice = $(element).find('#productSellingPrice').text().replace('$', '').replace(',', '').trim(); 1673 } else { 1674 salePrice = ''; 1675 } 1676 removedProductInfo.push({ 1677 brand: $(element).find('#brand').val() !== undefined ? $(element).find('#brand').val() : '', 1678 category: $(element).find('#category').val() !== undefined ? $(element).find('#category').val() : '',
1679 id: $(element).find('#productCode').val() !== undefined ? $(element).find('#productCode').val() : '', 1680 name: $(element).find('#productDesc').text().replace(/\t/g, '').replace(/\n/g, '').trim(), 1681 position: index + 1, 1682 salePrice: salePrice !== undefined ? salePrice : '', 1683 uom: $(element).find('#productUOM').val() !== undefined ? $(element).find('#productUOM').val() : '', 1684 quantity: $(element).find('#productQuantity').val() !== undefined ? $(element).find('#productQuantity').val() : '', 1685 price: $(element).find('.sale > .value').length > 0 ? $(element).find('.sale > .value')[0].innerText.replace('$', '').replace(',', '').trim() : '' 1686 }); 1687 selectableDeliveryMethodInfo(removedProductInfo, false, false, true, element, true, index); 1688 }); 1689 productInfoObj.removedProductInfo = removedProductInfo; 1690 $.extend(_A.digitalData, productInfoObj); 1691 _satellite.track('global-remove-from-cart'); 1692 // clearing productInfo object as clear cart removes all products in the cart 1693 _A.digitalData.productInfo = []; 1694 } catch (e) { 1695 console.log('Exception: ' + e.message); 1696 } 1697 } 1698 1699 /* ARG21785054 Adobe Analytics - Add to Cart button tracking*/ 1700 function adobeMultiSelectAddtoCartListsTrack(e) { 1701 try { 1702 e.preventDefault(); 1703 var productListInfo = $(arguments)[1]; 1704 if (_A.digitalData.hasOwnProperty('listInfo')) { 1705 delete _A.digitalData.listInfo; 1706 } 1707 if (_A.digitalData.hasOwnProperty('productInfo')) { 1708 delete _A.digitalData.productInfo; 1709 } 1710 if (_A.digitalData.hasOwnProperty('expressOrderInfo')) { 1711 delete _A.digitalData.expressOrderInfo; 1712 } 1713 if (_A.digitalData.hasOwnProperty('listAddition')) { 1714 delete _A.digitalData.listAddition; 1715 } 1716 $.extend(_A.digitalData, productListInfo); 1717 _satellite.track('global-add-to-cart'); 1718 } catch (e) { 1719 console.log('Adobe Exception: ' + e.message); 1720 } 1721 } 1722 1723 /* ARG21828969 - (7) Analytics gap filling based on analysis (sprint 3) */ 1724 function publishftAuditDataToAdobe() { 1725 var findtunerInfoObj = { 1726 findtunerInfo: $('#ftAuditResponse').val() ? JSON.parse($('#ftAuditResponse').val()) : '' 1727 }; 1728 $.extend(_A.digitalData, findtunerInfoObj); // append ftaudit response to existing data layer 1729 _satellite.track('ft_action'); // PUBLISH ADOBE DATA EVENT 1730 } 1731 1732 /** 1733 * Add To List Track 1734 */ 1735 function adobeAddtoListTrack() { 1736 try { 1737 var productRowContainers, 1738 addListObj, 1739 listDetails, 1740 currentProductPosition, 1741 productPosition, 1742 regularPrice, 1743 salePrice, 1744 listType, 1745 listName, 1746 isCartPage, 1747 isPLP, 1748 brand, 1749 uom, 1750 quantity, 1751 prodDesc, 1752 category, 1753 productInfo = []; 1754 1755 listDetails = $(arguments)[1]; 1756 listType = listDetails.listType; 1757 listName = listDetails.listName; 1758 isCartPage = listDetails.isCart;
1759 isPLP = listDetails.isPLP; 1760 if (pageName.includes('p:')) { 1761 productRowContainers = $('#pdp-main'); 1762 } else { 1763 productRowContainers = listDetails.productRowContainers; 1764 } 1765 $(productRowContainers).each(function (index, element) { 1766 if (pageName.includes('p:')) { 1767 brand = $(element).find('input[name="productBrand"]').val(); 1768 category = $(element).find('input[name="productCategory"]').val(); 1769 productPosition = '1:1'; 1770 } else if (isCartPage) { 1771 brand = $(element).find('#brand').val(); 1772 category = $(element).find('#category').val(); 1773 } else { 1774 if (isPLP) { 1775 brand = listDetails.brand; 1776 category = listDetails.category; 1777 } else { 1778 brand = $(element).find('#productBrand').text(); 1779 category = $(element).find('#productCategory').text(); 1780 } 1781 if (pageName.includes('/compareproducts')) { 1782 productPosition = $(element).index() + 1; 1783 } else { 1784 currentProductPosition = $(element).index() + 1; 1785 productPosition = ($(element).parents().hasClass('form-search-results')) ? currentProductPosition - 1 : currentProductPosition; 1786 } 1787 } 1788 if (pageName.includes('manageQuote:quoteDetails')) { 1789 prodDesc = $(element).find('.col-product-description .productDescription').text().replace(/\t/g, '').replace(/\n/g, '').trim(); 1790 } else if (pageName.includes('p:')) { 1791 prodDesc = $('#productName').text().replace(/\t/g, '').replace(/\n/g, '').trim(); 1792 } else { 1793 prodDesc = $(element).find('.product-desc').text().replace(/\t/g, '').replace(/\n/g, '').trim(); 1794 } 1795 if (isCartPage) { 1796 regularPrice = $(element).find('.sale > .value').length > 0 ? $(element).find('.sale > .value')[0].innerText.replace('$', '').replace(',', '').trim() : ''; 1797 if ($(element).find('.productPriceSale').val() === 'true') { 1798 salePrice = $(element).find('#productSellingPrice').text().replace('$', '').replace(',', '').trim(); 1799 } else { 1800 salePrice = ''; 1801 } 1802 quantity = $('.qty-input').val(); 1803 uom = $(element).find('#productUOM').val(); 1804 } else { 1805 regularPrice = $(element).find('#productPrice').text() !== undefined ? $(element).find('#productPrice').text().trim() : ''; 1806 salePrice = $(element).find('#productSellingPrice').text() !== undefined ? $(element).find('#productSellingPrice').text().trim() : ''; 1807 quantity = $(element).find('input[name="qty"]').val(); 1808 uom = $(element).find('input[name="unitOfMeasure"]').val(); 1809 } 1810 productInfo.push({ 1811 id: $(element).find('input[name="productCode"]').val(), 1812 name: prodDesc, 1813 price: (regularPrice === '0' || regularPrice === '0.00') ? '' : regularPrice, 1814 salePrice: (salePrice === '0' || salePrice === '0.00') ? '' : salePrice, 1815 uom: uom, 1816 brand: brand !== undefined ? brand.trim() : '', 1817 category: category !== undefined ? category.trim() : '', 1818 position: productPosition === undefined ? '' : currentProductPosition, 1819 quantity: quantity 1820 }); 1821 }); 1822 addListObj = { 1823 listAddition: { 1824 listName: listName !== undefined ? listName : '', 1825 listType: listType !== undefined ? listType : '', 1826 productInfo: productInfo 1827 } 1828 }; 1829 $.extend(_A.digitalData, addListObj); 1830 _satellite.track('global-add-to-list'); 1831 } catch (e) { 1832 console.log('Adobe Exception: ' + e.message); 1833 } 1834 } 1835 1836 function searchResultsPageTracking() { 1837 var searchInfoObj, 1838 pageSearchName; 1839 1840 pageSearchName = decodeURIComponent(window.location.pathname); 1841 if (pageSearchName.includes('/search')) { 1842 searchInfoObj = { 1843 searchInfo: { 1844 searchTab: $('.active-result-tab').find('div.tab-item-title')[0].innerText.trim(), 1845 searchTerm: $('.searchResultFreeText').val(), 1846 resultsCount: $('.active-result-tab').find('span.tab-results-count')[0].innerText 1847 } 1848 }; 1849 $.extend(_A.digitalData, searchInfoObj); 1850 } 1851 } 1852 1853 function adobeSwitchTab() { 1854 var event = arguments[1]; 1855 var element = event.currentTarget; 1856
1857 var switchTabObj = { 1858 switchTab: { 1859 prevsearchTab: $(element).siblings('.active-result-tab').find('div.tab-item-title')[0].innerHTML.trim(), 1860 nextsearchTab: $(element).find('div.tab-item-title')[0].innerText.trim(), 1861 searchTerm: $('.searchResultFreeText').val(), 1862 resultsCount: $(element).find('span.tab-results-count')[0].innerText 1863 } 1864 }; 1865 $.extend(_A.digitalData, switchTabObj); 1866 _satellite.track('search_tab_switch'); 1867 } 1868 1869 function quotePageLoadTrack() { 1870 var quoteInfoObj, 1871 productInfo = [], 1872 quoteId, 1873 productData, 1874 regularPrice, 1875 salePrice, 1876 quoteExpirationDate, 1877 quoteOriginalQty; 1878 1879 1880 quoteId = $('.quote-number').text !== undefined ? $('.quote-number').text().trim() : ''; 1881 quoteExpirationDate = $('.quote-exp-date .value').text !== undefined ? $('.quote-exp-date .value').text().trim() : ''; 1882 quoteOriginalQty = $('.quote-qty').val !== undefined ? $('.quote-qty').val().trim() : ''; 1883 1884 productData = $('.my-lists').find('.add-to-cart-container'); 1885 productData.each(function (index, element) { 1886 regularPrice = $(element).find('#productPrice').text() !== undefined ? $(element).find('#productPrice').text().replace('$', '').replace(',', '').trim() : ''; 1887 salePrice = $(element).find('#productSellingPrice').text() !== undefined ? $(element).find('#productSellingPrice').text().replace('$', '').replace(',', '').trim() : ''; 1888 if ($(element).find('.product-details').length > 0) { /* Quote details - 2022.DQA.1910 */ 1889 return; 1890 } 1891 productInfo.push({ 1892 brand: $(element).find('#productBrand').text() !== undefined ? $(element).find('#productBrand').text().trim() : '', 1893 category: $(element).find('#productCategory').text() !== undefined ? $(element).find('#productCategory').text().trim() : '', 1894 id: $(element).find('input[name="productCode"]').val() !== undefined ? $(element).find('input[name="productCode"]').val().trim() : '', 1895 name: $(element).find('.product-desc').text().replace(/\t/g, '').replace(/\n/g, '').trim(), 1896 salePrice: (salePrice === '0' || salePrice === '0.00') ? '' : salePrice, 1897 quantity: $(element).find('.quote-item-qty').val() !== undefined ? $(element).find('.quote-item-qty').val().replace(',', '').trim() : '', 1898 price: (regularPrice === '0' || regularPrice === '0.00') ? '' : regularPrice, 1899 /* updatedPrice: $(element).find('#updatedPrice').text() !== undefined ? $(element).find('#updatedPrice').text().replace('$', '').replace(',', '').trim() : '', 1900 updatedDate: $(element).find('#updatedDate').text() !== undefined ? $(element).find('#updatedDate').text().trim() : '',*/ 1901 uom: $(element).find('input[name="unitOfMeasure"]').val() !== undefined ? $(element).find('input[name="unitOfMeasure"]').val().trim() : '' 1902 }); 1903 }); 1904 quoteInfoObj = { 1905 QuoteInfo: { 1906 quoteId: quoteId, 1907 quoteExpirationDate: quoteExpirationDate, 1908 quoteOriginalQty: quoteOriginalQty, 1909 productInfo: productInfo 1910 1911 1912 } 1913 }; 1914 $.extend(_A.digitalData, quoteInfoObj); 1915 } 1916 1917 function suggestedProductTrack(isPdpPage, element) { 1918 var SuggestedProductInfoObj = { 1919 SuggestedProductInfo: [] 1920 }, 1921 SuggestedProductInfo = [], 1922 subProd, 1923 suggestedProdLinkObj; 1924 if (isPdpPage) { 1925 if ($('.hard-substitute-product').length > 0) { 1926 SuggestedProductInfo.push({ 1927 targetproductID: $('.target-product-id').text().replace(/\t/g, '').replace(/\n/g, '').trim(), 1928 presentProductID: $('.present-product-id').text().replace(/\t/g, '').replace(/\n/g, '').trim(), 1929 category: $('.substitue-product-category').text().replace(/\t/g, '').replace(/\n/g, '').trim(), 1930 brand: $('.substitue-product-brand').text().replace(/\t/g, '').replace(/\n/g, '').trim(), 1931 Type: $('.substitue-product-type').text().replace(/\t/g, '').replace(/\n/g, '').trim(), 1932 name: $('.substitue-product-desc').text().replace(/\t/g, '').replace(/\n/g, '').trim(), 1933 }); 1934 } 1935 if ($('.suggested-substitute-products').length > 0) { 1936 subProd = $('.mobile-canvas').is(':visible') ? $('.suggested-substitute-products-list-mobile .suggested-substitute-products-item') : $('.suggested-substitute-products-list .suggested-substitute-products-item'); 1937 $(subProd).each(function (index, element) { 1938 SuggestedProductInfo.push({ 1939 targetproductID: $(element).children().find('.suggested-substitute-product .present-product-id').text().replace(/\t/g, '').replace(/\n/g, '').trim(), 1940 presentProductID: $('.isemarketSite').val() === 'true' ? $('.product-information .airgas-part-number em').text().replace(/\t/g, '').replace(/\n/g, '').trim() : $('.ora-product-details .airgas-part-number em').text().replace(/\t/g, '').replace(/\n/g, '').trim(), 1941 category: $(element).children().find('.suggested-substitute-product .substitue-product-category').text().replace(/\t/g, '').replace(/\n/g, '').trim(), 1942 brand: $(element).children().find('.suggested-substitute-product .substitue-product-brand').text().replace(/\t/g, '').replace(/\n/g, '').trim(), 1943 Type: $(element).children().find('.suggested-substitute-product .substitue-product-type').text().replace(/\t/g, '').replace(/\n/g, '').trim(), 1944 name: $(element).children().find('.suggested-substitute-product .substitue-product-sh
1944ortDescription').text().replace(/\t/g, '').replace(/\n/g, '').trim() 1945 }); 1946 }); 1947 } 1948 if (_A.digitalData.hasOwnProperty('SuggestedProductInfo')) { 1949 delete _A.digitalData.SuggestedProductInfo; 1950 } 1951 SuggestedProductInfoObj.SuggestedProductInfo = SuggestedProductInfo; 1952 $.extend(_A.digitalData, SuggestedProductInfoObj); 1953 } else { 1954 if (($('.suggested-substitute-products').length > 0) && ($(element).hasClass('substitute-product-description'))) { 1955 suggestedProdLinkObj = { 1956 SuggestedProdLink: { 1957 targetproductID: $(element).parent().siblings('.present-product-id').text().replace(/\t/g, '').replace(/\n/g, '').trim(), 1958 presentProductID: $('.isemarketSite').val() === 'true' ? $('.product-information .airgas-part-number em').text().replace(/\t/g, '').replace(/\n/g, '').trim() : $('.ora-product-details .airgas-part-number em').text().replace(/\t/g, '').replace(/\n/g, '').trim(), 1959 category: $(element).parent().siblings('.substitue-product-category').text().replace(/\t/g, '').replace(/\n/g, '').trim(), 1960 Brand: $(element).parent().siblings('.substitue-product-brand').text().replace(/\t/g, '').replace(/\n/g, '').trim(), 1961 Type: $(element).parent().siblings('.substitue-product-type').text().replace(/\t/g, '').replace(/\n/g, '').trim() 1962 } 1963 }; 1964 if (_A.digitalData.hasOwnProperty('SuggestedProdLink')) { 1965 delete _A.digitalData.SuggestedProdLink; 1966 } 1967 $.extend(_A.digitalData, suggestedProdLinkObj); 1968 } 1969 } 1970 } 1971 /* Monetate Product Finder Tracking*/ 1972 function monetateProductFinderTracking(){ 1973 letsGoButtonTracking(); 1974 backButtonTracking(); 1975 registerFinderIntervals(); 1976 } 1977 1978 /* When user clicks lets go button*/ 1979 function letsGoButtonTracking() { 1980 try{ 1981 1982 $('.mt-product-finder-welcome-screen-wrapper .hover-rise').off('click').on('click', function(e) { 1983 var linkText = $(e.currentTarget).length >0 ?$(e.currentTarget).text().trim().toUpperCase() :''; 1984 var monetateExpId = monetateDivID; 1985 var monetateProductFinderName = window.location.pathname.replace('/', '').trim(); 1986 var monetateProductFinderInf = { 1987 monetateProductFinderInfo: { 1988 monetateExpId: monetateExpId, 1989 monetateProductFinderName: monetateProductFinderName, 1990 linkText: linkText 1991 } 1992 1993 }; 1994 $.extend(_A.digitalData, monetateProductFinderInf); 1995 _satellite.track('Product_Finding_Modal_Started'); 1996 }); 1997 } 1998 catch (e) { 1999 console.log('Adobe Exception: ' + e.message); 2000 } 2001 2002 } 2003 2004 /* When user clicks on back button*/ 2005 function backButtonTracking(){ 2006 try{ 2007 2008 $('.mt-product-finder-back-button').off('click').on('click', function(e) { 2009 var linkText= $(e.currentTarget).length > 0 ?$(e.currentTarget).text().trim() :''; 2010 var monetateExpId = monetateDivID; 2011 var monetateProductFinderName = window.location.pathname.replace('/', '').trim(); 2012 var monetateProductFinderInf = { 2013 monetateProductFinderInfo: { 2014 monetateExpId: monetateExpId, 2015 monetateProductFinderName: monetateProductFinderName, 2016 linkText: linkText 2017 } 2018 }; 2019 $.extend(_A.digitalData, monetateProductFinderInf); 2020 _satellite.track('Product_Finding_Modal_Backed'); 2021 }); 2022 } 2023 catch (e) { 2024 console.log('Adobe Exception: ' + e.message); 2025 } 2026 2027 } 2028 /* Setting intervals for the dom elemenets to load*/ 2029 function registerFinderIntervals(){ 2030 try{ 2031 var productFinderCounter = 0, 2032 imageItemsFinderCounter = 0; 2033 2034 $('div.mt-product-finder-single-select, div.mt-product-finder-multi-select').off('click').on('click', function(){ 2035 var clickToRestartFinderInterval = setInterval(function() { 2036 if($('#product-find-head').is(':visible') || $('span.mt-product-finder-restart-button').is(':visible') || $('#product-find-restart').is(':visible')){ 2037 clearInterval(clickToRestartFinderInterval); 2038 productFinderCounter += 1; 2039 if(productFinderCounter === 1) { 2040 productFinderCompleted(); 2041 } 2042 } 2043 }, 5); 2044 var imageItemsFinderIterval = setInterval(function() { 2045 if($('.mt-product-finder-products .hover-rise').length > 0) { 2046 clearInterval(imageItemsFinderIterval); 2047 imageItemsFinderCounter += 1; 2048 if(imageItemsFinderCounter === 1) { 2049 navigatePdp(); 2050 } 2051 } 2052 }, 5); 2053 }); 2054 } 2055 catch (e) { 2056 console.log('Adobe Exception: ' + e.message); 2057 } 2058 2059 } 2060 2061 /* When user completes the product finder*/ 2062 function productFinderCompleted() { 2063 try{ 2064 var monetateExpId =$('.mt-product-finder-restart-button.hover-rise').parents('.mt-product-finder-container').parent().attr('id').trim(); 2065 var monetateProductFinderName = window.location.pathname.replace('/', '').trim(); 2066 var monetateProductFinderInf = { 2067 monetateProductFinderInfo: { 2068 monetateExpId: monetateExpId, 2069 monetateProductFinderName: monetateProductFinderName 2070 } 2071 }; 2072 $.extend(_A.digitalData, monetateProductFinderInf); 2073 _satellite.track('Product_Finding_Modal_completed'); 2074 restartingProductFinder(monetateDivID); 2075 } 2076 catch (e) { 2077 console.log('Adobe Exception: ' + e.message); 2078 } 2079 } 2080 2081 /* When user clicks on suggested products during product finder and navigate to pdp*/ 2082 function navigatePdp(){ 2083 try{ 2084 $('.mt-product-finder-products').off('click').on('click', function(e) { 2085 2086 var linkText = $(e.target).parents('.hover-rise').find('.mt-title').length > 0 ?$(e.target).parents('.hover-rise').find('.mt-title').text().trim() :''; 2087 2088 var monetateExpId = monetateDivID; 2089 var monetateProductFinderName = window.location.pathname.replace('/', '').trim(); 2090 var monetateProductFinderInf = { 2091 monetateProductFinderInfo: { 2092 monetateExpId: monetateExpId, 2093 monetateProductFinderName: monetateProductFinderName, 2094 linkText: linkText 2095 } 2096 }; 2097 $.extend(_A.digitalData, monetateProductFinderInf); 2098 if($('.mt-product-finder-no-result').is(':visible') && $('.mt-product-finder-restart-button').is(':visible')) { 2099 _satellite.track('Product_Finding_Modal_No_Results_PDP'); 2100 2101 } else if(!$('.mt-product-finder-restart-button.hover-rise').is(':visible')) { 2102 _satellite.track('Product_Finding_Modal_Product_Found_Before_Completion'); 2103 } else { 2104 _satellite.track('Product_Finding_Modal_PDP_page'); 2105 } 2106 }); 2107 } 2108 catch (e) { 2109 console.log('Adobe Exception: ' + e.message); 2110 } 2111 } 2112 2113 /* When user restarts by clicking click here to restart*/ 2114 function restartingProductFinder(){ 2115 try{ 2116 $('.mt-product-finder-restart-button').off('click').on('click', function(e) { 2117 var linkText= $(e.currentTarget).length>0 ? $(e.currentTarget).text().trim() : ''; 2118 var monetateExpId = monetateDivID; 2119 var monetateProductFinderName = window.location.pathname.replace('/', '').trim(); 2120 var monetateProductFinderInf = { 2121 monetateProductFinderInfo: { 2122 monetateExpId: monetateExpId, 2123 monetateProductFinderName: monetateProductFinderName, 2124 linkText: linkText 2125 } 2126 }; 2127 delete _A.digitalData.monetateProductFinderInfo; 2128 $.extend(_A.digitalData, monetateProductFinderInf); 2129 2130 _satellite.track('Product_Finding_Modal_Restarted'); 2131 registerFinderIntervals(); 2132 2133 }); 2134 } 2135 catch (e) { 2136 console.log('Adobe Exception: ' + e.message); 2137 } 2138 2139 } 2140 2141 function productFinderAbandoned(e){ 2142 try{ 2143 if($('.mt-product-finder-quiz-wrapper').is(':visible')){ 2144 var linkText = $(e.target.activeElement).length > 0 ?$(e.target.activeElement).text().trim() : ''; 2145 var monetateExpId = monetateDivID; 2146 var monetateProductFinderName = window.location.pathname.replace('/', '').trim(); 2147 var monetateProductFinderInf = { 2148 monetateProductFinderInfo: { 2149 monetateExpId: monetateExpId, 2150 monetateProductFinderName: monetateProductFinderName, 2151 linkText: linkText 2152 2153 } 2154 }; 2155 2156 $.extend(_A.digitalData, monetateProductFinderInf); 2157 _satellite.track('Product_Finding_Modal_Abandoned'); 2158 2159 } 2160 } 2161 catch (e) { 2162 console.log('Adobe Exception: ' + e.message); 2163 } 2164 2165 } 2166 2167 /** 2168 Function to track EZ GAZ functionalities 2169 */
2170 function ezGazAdobeTrack(e, otherTrackDetails) { 2171 if(otherTrackDetails.trackType === 'AlarmTypeModal') { 2172 handleAlarmTypeModalTracks(e, otherTrackDetails); 2173 }else if(otherTrackDetails.trackType === 'DeviceInfoTypeModal') { 2174 handleDeviceInfoModalTracks(e, otherTrackDetails); 2175 }else if(otherTrackDetails.trackType === 'DownloadData') { 2176 handleDeviceDownloadTracks(e, otherTrackDetails); 2177 }else if(otherTrackDetails.trackType === 'sort') { 2178 sortEzGazTracking(otherTrackDetails.trackType); 2179 }else if(otherTrackDetails.trackType === 'AlarmTypeModalPop') { 2180 handleAlarmTypeModalPopTracks(e, otherTrackDetails); 2181 }else if(otherTrackDetails.trackType === 'viewChartInfo'){ 2182 handleDeviceViewChartTracks(e, otherTrackDetails.currentElement); 2183 } 2184 } 2185 2186 function handleAlarmTypeModalPopTracks() { 2187 var tabInfoObj, 2188 currentActiveAlerts = []; 2189 2190 $('.status-alarm-item').each(function () { 2191 currentActiveAlerts.push($(this).find('.label-text').text().trim()); 2192 }); 2193 tabInfoObj = { 2194 ezGazInfo:{ 2195 location: $('.ez-modal-row').find('.ez-title-amspec').text().trim(), 2196 deviceName: $('.ez-modal-row').find('.ez-title-pack').text().trim(), 2197 switchTab: { 2198 prevclickTab: '', 2199 nextclickTab: $('.alarm-tabs').find('.alarm-tab.active').text().trim(), 2200 currentActiveAlerts: currentActiveAlerts 2201 } 2202 } 2203 }; 2204 $.extend(_A.digitalData, tabInfoObj); 2205 _satellite.track('DeviceAlertsModal_Clicked'); 2206 } 2207 function handleAlarmTypeModalTracks(e, otherTrackDetails) { 2208 var tabInfoObj, 2209 currentTab = otherTrackDetails.currentTab; 2210 tabInfoObj = { 2211 ezGazInfo:{ 2212 location: otherTrackDetails.location, 2213 deviceName: otherTrackDetails.deviceName, 2214 switchTab: { 2215 prevclickTab: otherTrackDetails.prevTabClickedName, 2216 nextclickTab: $(currentTab).text() !== '' ? $(currentTab).text().trim() : '' , 2217 currentActiveAlerts: otherTrackDetails.currentActiveAlerts, 2218 } 2219 } 2220 }; 2221 $.extend(_A.digitalData, tabInfoObj); 2222 _satellite.track('switchedTab_deviceAlertModal'); 2223 delete _A.digitalData.ezGazDeviceInfo; 2224 } 2225 2226 function searchResultsEzGazPageTracking() { 2227 var searchInfoObj, 2228 pageEzgazName, 2229 activeTab; 2230 2231 pageEzgazName = decodeURIComponent(window.location.href); 2232 if (pageEzgazName.includes('/ezgaz?searchText') && pageEzgazName.includes('page=')) { 2233 if($('.mobile-canvas').is(':visible')) { 2234 activeTab = $('.all-devices-row.mobile-view .device-item.active').text().trim(); 2235 } else { 2236 activeTab = $('.all-devices-row.desktop-view .device-item.active').text().trim(); 2237 } 2238 searchInfoObj = { 2239 ezGazInfo:{ 2240 ezGazSearchInfo: { 2241 searchTerm: $('#searchInput').val(), 2242 resultsCount: { 2243 deviceCount: $('.ez-device-sub').find('span.top-device-count')[0].innerText, 2244 locationCount: $('.ez-device-sub').find('span.top-location-count').length > 0 ? $('.ez-device-sub').find('span.top-location-count')[0].innerText : '0' 2245 }, 2246 searchTab: activeTab 2247 } 2248 } 2249 }; 2250 $.extend(_A.digitalData, searchInfoObj); 2251 _satellite.track('InternalSearch_linkClicked'); 2252 delete _A.digitalData.ezGazDeviceInfo; 2253 } 2254 } 2255 2256 function handleDeviceDownloadTracks(e, otherTrackDetails) { 2257 var DownloadInfoObj; 2258 DownloadInfoObj = { 2259 ezGazInfo:{ 2260 ezdownload: { 2261 buttonName: otherTrackDetails.buttonName, 2262 fileName: otherTrackDetails.fileName, 2263 fileType:otherTrackDetails.fileType, 2264 } 2265 } 2266 }; 2267 $.extend(_A.digitalData, DownloadInfoObj); 2268 _satellite.track('downloadButton_Clicked'); 2269 delete _A.digitalData.ezGazDeviceInfo; 2270 } 2271 2272 function handleDeviceInfoModalTracks() { 2273 var deviceInfoObj, 2274 deviceModalInfo = []; 2275 2276 $('.ez-cylinder-row').each(function (index, elem) { 2277 deviceModalInfo.push({ 2278 product: $(elem).find('.product-adobe').find('.ez-cylinder-value').text().trim(), 2279 //containerType: $('.ez-modal-row').find('.ez-title-pack').text().trim(), 2280 deviceID: $(elem).find('.device-id-adobe').find('.ez-cylinder-value').text().trim(), 2281 pressure: $(elem).find('.pressure-adobe').find('.ez-cylinder-value .pressure-level-text').text(), 2282 temperature: $(elem).find('.temperature-adobe').find('.ez-cylinder-value').text().trim() 2283 }); 2284 }); 2285 deviceInfoObj = { 2286 ezGazDeviceInfo:{ 2287 deviceName: $('.ez-modal-row').find('.ez-title-pack').text().trim(), 2288 location: $('.ez-modal-row').find('.ez-title-amspec').text().trim(), 2289 deviceSensorInfo: deviceModalInfo 2290 } 2291 };
2292 $.extend(_A.digitalData, deviceInfoObj); 2293 _satellite.track('deviceInfoModal_Clicked'); 2294 delete _A.digitalData.ezGazInfo; 2295 } 2296 2297 function handleDeviceViewChartTracks(e, currentElement) { 2298 var deviceViewChartInfoObj, 2299 deviceSensorItemsInfo = [], 2300 deviceSensorItems = $(currentElement).parents('.contact-sensor-container').find('.ez-cylinder-box'); 2301 2302 $(deviceSensorItems).each(function (index, elem) { 2303 deviceSensorItemsInfo.push({ 2304 product: $(elem).closest('.contact-sensor-container').prev().prev().find('.ez-gaz-item-desc .ez-gaz-item-desc-text p').text().trim(), 2305 //containerType: $('.ez-modal-row').find('.ez-title-pack').text().trim(), 2306 deviceID: index === 0 ? ($(elem).closest('.contact-sensor-container').prev().prev().find('.two-cylinder').length > 0 ? $(elem).closest('.contact-sensor-container').prev().prev().find('.cylinder-hwid-left').val() : $(elem).closest('.contact-sensor-container').prev().prev().find('.cylinder-hwid').val()) : $(elem).closest('.contact-sensor-container').prev().prev().find('.cylinder-hwid-right').val(), 2307 pressure: $(elem).find('.ez-cylinder-value .pressure p').text().trim(), 2308 temperature: $(elem).find('.ez-cylinder-value .temp-text').text().trim(), 2309 batteryVoltage: $(elem).find('.ez-cylinder-value .battery-text').text().trim(), 2310 }); 2311 }); 2312 deviceViewChartInfoObj = { 2313 ezGazDeviceInfo:{ 2314 deviceName: $('.ez-modal-row').find('.ez-title-pack').text().trim(), 2315 location: $('.ez-modal-row').find('.ez-title-amspec').text().trim(), 2316 deviceSensorInfo: deviceSensorItemsInfo 2317 } 2318 }; 2319 $.extend(_A.digitalData, deviceViewChartInfoObj); 2320 _satellite.track('DeviceSensorHistoryInfo_Clicked'); 2321 delete _A.digitalData.ezGazInfo; 2322 } 2323 2324 function sortEzGazTracking(trackType) { 2325 var sortInfoObj, 2326 pageEzgazName, 2327 deviceDetailsInfo = [], 2328 LocationInfo=[], 2329 activeTab; 2330 2331 $('.ez-gaz-item-desc-text h4').each(function () { 2332 /*deviceName.push('device'+[index + 1]+': '+$(this).text().trim());*/ 2333 deviceDetailsInfo.push($(this).text().trim()); 2334 }); 2335 LocationInfo.push({ 2336 deviceName: deviceDetailsInfo 2337 }); 2338 pageEzgazName = decodeURIComponent(window.location.href); 2339 if($('.mobile-canvas').is(':visible')) { 2340 activeTab = $('.all-devices-row.mobile-view .device-item.active').find('.alarm-type-text').text().trim().toUpperCase(); 2341 } else { 2342 activeTab = $('.all-devices-row.desktop-view .device-item.active').find('.alarm-level-desc').text().trim().toUpperCase(); 2343 } 2344 if ((!pageEzgazName.includes('page=')) && (pageEzgazName.includes('sort') || pageEzgazName.includes('/ezgaz?alarmType') || trackType === 'sort')) { 2345 if(window.location.pathname === '/ezgaz' && pageEzgazName.includes('?') && activeTab !== 'ALL DEVICES' && (pageEzgazName.includes('/ezgaz?alarmType') || activeTab === 'FAVORITES')) { 2346 sortInfoObj = { 2347 ezGazInfo: { 2348 alertType: activeTab 2349 } 2350 }; 2351 } else { 2352 sortInfoObj = { 2353 ezGazInfo:{ 2354 platform: navigator.platform, 2355 ezGazDashboard: { 2356 deviceCount: $('.ez-device-sub').find('span.top-device-count')[0].innerText, 2357 locationCount: $('.ez-device-sub').find('span.top-location-count').length > 0 ? $('.ez-device-sub').find('span.top-location-count')[0].innerText : '0', 2358 deviceDetails: { 2359 location: $('.first-level-trigger').find('.heading h5').length > 0 ? $('.first-level-trigger').find('.heading h5')[0].innerText : '0', 2360 devices: deviceDetailsInfo, 2361 } 2362 } 2363 } 2364 }; 2365 } 2366 2367 if((pageEzgazName.includes('/ezgaz?alarmType') || pageEzgazName.includes('favorites')) && pageEzgazName.includes('sort') && activeTab === 'ALL DEVICES'){ 2368 sortInfoObj.ezGazInfo.ezGazDashboard['alertType'] = $('.select-sort').find('.selectboxit-text')[0].innerText; 2369 sortInfoObj.ezGazInfo.ezGazDashboard['alertcount'] = $('.ez-device-sub').find('span.top-device-count')[0].innerText; 2370 }
2371 $.extend(_A.digitalData, sortInfoObj); 2372 if(pageEzgazName.includes('/ezgaz?alarmType') || pageEzgazName.includes('sort') || activeTab === 'FAVORITES'){ 2373 _satellite.track('AlertClicked'); 2374 } 2375 delete _A.digitalData.ezGazDeviceInfo; 2376 } 2377 } 2378 /*DataLayer Tracking on click suggested accessories product from PDP */ 2379 2380 function suggestedAccessoriesTrack(){ 2381 _satellite.track('Suggested_Accessories'); 2382 } 2383 2384 function adobeEzGazDashboardTracks() { 2385 var ezGazDashboardInfoObj; 2386 /*pageNameUrl;*/ 2387 ezGazDashboardInfoObj = { 2388 ezGazInfo:{ 2389 platform: navigator.platform, 2390 ezGazDashboard: { 2391 locationcount: $('.ez-gaz-detail-sort-flex').find('.top-location-count').text().trim(), 2392 devicecount: $('.ez-gaz-detail-sort-flex').find('.top-device-count').text().trim() 2393 } 2394 } 2395 }; 2396 $.extend(_A.digitalData, ezGazDashboardInfoObj); 2397 /*pageNameUrl = decodeURIComponent(window.location.href); 2398 if (!pageNameUrl.includes('?') && !(pageNameUrl.includes('/ezgaz?alarmType') || $('.device-item.active .alarm-level-desc').text().trim() === 'FAVORITES' || $('.device-item.active .alarm-type-text').text().trim() === 'FAVORITES') && !pageNameUrl.includes('sort')) { 2399 _satellite.track('EzGazPage_Clicked'); 2400 }*/ 2401 } 2402 function emailPdpFormTracking(e,otherTrackDetails){ 2403 try{ 2404 if(otherTrackDetails.abandonEvent === 'YES'){ 2405 emailPdpAbandoned(); 2406 } 2407 else{ 2408 emailPdpTracking(); 2409 } 2410 } 2411 catch(e){ 2412 console.log('Adobe Exception: ' + e.message); 2413 } 2414 } 2415 function emailPdpTracking(){ 2416 try{ 2417 setTimeout(function(){ 2418 var formInfo, 2419 formErrorField, 2420 formLoadInfo, 2421 errorMessage, 2422 emailArrayFrom=[], 2423 emailArrayTo=[], 2424 emailTagsFrom, 2425 emailTagsTo, 2426 formEmail, 2427 emailTextTo, 2428 emailTextFrom, 2429 formErrorLength; 2430 // on page load form data 2431 formInfo = { 2432 formInfo:{ 2433 formName: $('#adobeFormName').val() !== undefined ? $('#adobeFormName').val() : '', 2434 formTypeName: 'lead' 2435 } 2436 }; 2437 formLoadInfo ={ 2438 formLoadInfo:{ 2439 formAction: $('form#pdpEmailForm').attr('action'), 2440 formId: $('form#pdpEmailForm').attr('id'), 2441 formName: $('#adobeFormName').val() !== undefined ? $('#adobeFormName').val() : '' 2442 } 2443 }; 2444 $.extend(_A.digitalData, formInfo); 2445 $.extend(_A.digitalData, formLoadInfo); 2446 _satellite.track('form-view'); 2447 // when user starts entering form data 2448 if($('.email-notification-popup').is(':visible')){ 2449 $('form').one('click','input', function(e){ 2450 emailTagsTo = $('.fancybox-is-open .tags-containerTo .email-tag .emailname').toArray(); 2451 emailTagsFrom = $('.fancybox-is-open .tags-containerFrom .email-tag .emailname').toArray(); 2452 emailTextTo = $('.fancybox-is-open #emailToField').val(); 2453 emailTextFrom = $('.fancybox-is-open #emailFromField').val(); 2454 emailTagsTo.forEach(element=> { 2455 emailArrayTo.push($(element).text()); 2456 }); 2457 if(emailTextTo !== ''){ 2458 emailArrayTo.push(emailTextTo); 2459 } 2460 emailTagsFrom.forEach(element=> { 2461 emailArrayFrom.push($(element).text()); 2462 }); 2463 if(emailTextFrom !== ''){ 2464 emailArrayFrom.push(emailTextFrom); 2465 } 2466 formEmail = emailArrayFrom.concat(emailArrayTo).join(','); 2467 formInfo ={ 2468 formInfo:{ 2469 formName: $('#adobeFormName').val() !== undefined ? $('#adobeFormName').val() : '', 2470 formTypeName :'lead', 2471 firstField: $(e.currentTarget).attr('id') 2472 2473 } 2474 }; 2475 $.extend(_A.digitalData, formInfo); 2476 _satellite.track('form-start'); 2477 2478 }); 2479 2480 // when user commits an error 2481 $('.email-submit-account-btn-pdp').click(function(){ 2482 formErrorLength = $('.empty-to-email-error-message:visible, .empty-from-email-error-message:visible, .invali
2482d-to-email-error-message:visible, .invalid-from-email-error-message:visible'); 2483 if(formErrorLength.length > 0){ 2484 errorMessage=''; 2485 formErrorLength.each(function(){ 2486 errorMessage = errorMessage + $(this).text().trim() + ' '; 2487 formErrorField = $(this).closest('div').find('input').attr('id'); 2488 }); 2489 formInfo ={ 2490 formInfo:{ 2491 formName: $('#adobeFormName').val() !== undefined ? $('#adobeFormName').val() : '', 2492 formTypeName: 'lead', 2493 formErrorField: formErrorField, 2494 errorMessage: errorMessage 2495 } 2496 }; 2497 $.extend(_A.digitalData, formInfo); 2498 _satellite.track('form-error'); 2499 } 2500 // successful form completion 2501 else{ 2502 formInfo ={ 2503 formInfo:{ 2504 formName: $('#adobeFormName').val() !== undefined ? $('#adobeFormName').val() : '', 2505 formTypeName: 'lead', 2506 formEmail: formEmail 2507 } 2508 }; 2509 $.extend(_A.digitalData, formInfo); 2510 _satellite.track('form-complete'); 2511 } 2512 }); 2513 } 2514 },2000); 2515 } 2516 catch(e){ 2517 console.log('Adobe Exception: ' + e.message); 2518 } 2519 } 2520 2521 function emailPdpAbandoned(){ 2522 // when user closes form by not submitting 2523 try{ 2524 var formInfo, 2525 abandonAction; 2526 abandonAction = 'Abandon'; 2527 formInfo ={ 2528 formInfo:{ 2529 formName: $('#adobeFormName').val() !== undefined ? $('#adobeFormName').val() : '', 2530 formTypeName: 'lead', 2531 2532 abandonAction: abandonAction 2533 } 2534 }; 2535 $.extend(_A.digitalData, formInfo); 2536 _satellite.track('form-abandon'); 2537 } 2538 catch(e){ 2539 console.log('Adobe Exception: ' + e.message); 2540 } 2541 } 2542 function observeBannerClassChanges() { 2543 2544 var bannerNameTrack; 2545 if(!($('.banner-slider').length > 0 || $('.content-carousel').length > 0)){ 2546 $('a.adobe-banner-track').each(function (index) { 2547 setTimeout(function(){ 2548 var bannerName=$('a.adobe-banner-track').eq(index).attr('data-adobe-click'); 2549 bannerNameTrack ={ 2550 bannerName:bannerName 2551 }; 2552 $.extend(_A.digitalData, bannerNameTrack); 2553 _satellite.track('banner_impression'); 2554 },3000); 2555 }); 2556 2557 } 2558 2559 var trackedBanners=new Set(); 2560 2561 function handleClassChange(mutationsList) { 2562 for (var mutation of mutationsList) { 2563 if (mutation.type === 'attributes' && mutation.attributeName === 'class') { 2564 const target = $(mutation.target); 2565 const bannerClick=target.attr('data-adobe-click'); 2566 if ((target.hasClass('is-active') && target.hasClass('content-carousel__thumb'))|| target.hasClass('slick-current')) { 2567 if(!trackedBanners.has(bannerClick)){ 2568 trackedBanners.add(bannerClick); 2569 var bannerName = target.attr('data-adobe-click'); 2570 bannerNameTrack ={ 2571 bannerName:bannerName 2572 }; 2573 $.extend(_A.digitalData, bannerNameTrack); 2574 _satellite.track('banner_impression'); 2575 } 2576 } 2577 } 2578 } 2579 } 2580 $('.adobe-banner-track').each(function() { 2581 if(($(this).hasClass('content-carousel__thumb')&& $(this).hasClass('is-active')) || $(this).hasClass('slick-active') ){ 2582 const bannerClick=$(this).attr('data-adobe-click'); 2583 if(!trackedBanners.has(bannerClick)){ 2584 trackedBanners.add(bannerClick); 2585 var bannerNameTrack; 2586 var bannerName = bannerClick; 2587 bannerNameTrack ={ 2588 bannerName:bannerName 2589 }; 2590 $.extend(_A.digitalData, bannerNameTrack); 2591 _satellite.track('banner_impression'); 2592 } 2593 } 2594 2595 }); 2596 2597 const observer = new MutationObserver(handleClassChange); 2598 const config = { attributes: true }; 2599 2600 $('.adobe-banner-track').each(function() { 2601 observer.observe(this, config); 2602 }); 2603 } 2604 2605 function requisitionActionTrack() { 2606 try{ 2607 var requisitionsData = {}, 2608 requisitionInfo=[], 2609 reqObj, 2610 rejectReason; 2611 2612 if($(arguments)[1] === 'cancelAction') { 2613 requisitionsData = { 2614 2615 requisitions : { 2616 requisitionNo : $(arguments)[2], 2617 } 2618 2619 }; 2620 2621 $.extend(_A.digitalData, requisitionsData);
2622 _satellite.track('cancelRequisitionHeader'); 2623 } 2624 2625 if($(arguments)[1] === 'partialApprove') { 2626 requisitionsData = { 2627 2628 requisitions : { 2629 requisitionNo : $(arguments)[2], 2630 OrderId : $(arguments)[3], 2631 productInfo : $(arguments)[4], 2632 productInfoRejected : $(arguments)[5] 2633 } 2634 2635 }; 2636 2637 $.extend(_A.digitalData, requisitionsData); 2638 _satellite.track('approvePartialRequisition'); 2639 } 2640 2641 if($(arguments)[1] === 'rejectAction') { 2642 rejectReason = $(arguments)[3]; 2643 $($(arguments)[2]).each(function(){ 2644 reqObj = { 2645 requisitionNo : this, 2646 rejectedReason : rejectReason 2647 }; 2648 requisitionInfo.push(reqObj); 2649 }); 2650 requisitionsData = { 2651 requisitions : requisitionInfo 2652 }; 2653 2654 if($(arguments)[4] === 'header') { 2655 $.extend(_A.digitalData, requisitionsData); 2656 _satellite.track('reject_requisitionH'); 2657 } 2658 } 2659 } 2660 catch(e){ 2661 console.log('Adobe Exception: ' + e.message); 2662 } 2663 } 2664 2665 function requisitionConfirmOrderTrack() { 2666 try { 2667 var requisitionsData = {}; 2668 2669 requisitionsData = { 2670 2671 requisitions : { 2672 requisitionNo : $(arguments)[1] 2673 } 2674 2675 }; 2676 2677 $.extend(_A.digitalData, requisitionsData); 2678 _satellite.track('approval_requisition'); 2679 } 2680 catch(e){ 2681 console.log('Adobe Exception: ' + e.message); 2682 } 2683 } 2684 2685 function handleRequisitionApprove() { 2686 if($('.hidden-bulkapprove').val() !== '' && localStorage.getItem('reqApproved') === null) { 2687 // set local attribute value to true to identify bulk approve 2688 localStorage.setItem('reqApproved', true); 2689 $.extend(_A.digitalData, JSON.parse($('.hidden-bulkapprove').val())); 2690 _satellite.track('approveRequisition'); 2691 localStorage.setItem('reqApproved', false); 2692 } 2693 if($('.requisition-approved-success').length >0){ 2694 2695 $.extend(_A.digitalData, JSON.parse($('.hidden-approve').val())); 2696 _satellite.track('approveRequisition'); 2697 2698 2699 } 2700 2701 } 2702 function handleRequisitionAdobeTracking() { 2703 var requisitionsInfo=[], 2704 requisitionsData = {}, 2705 obj, 2706 requisitionNumber, 2707 currentDate = (new Date().getMonth() + 1) + '/' + new Date().getDate() + '/' + new Date().getFullYear().toString().substring(-2); 2708 2709 requisitionNumber = location.href.split('=')[1]; 2710 $('.monetate-order').each(function (index, reqOrdr) { 2711 var reqOrder = [], 2712 rejOrder = []; 2713 var OrderID = $(reqOrdr).prev().prev().text().split(':')[1].trim(); 2714 2715 var requisitionOrdr = $(reqOrdr).find('.approved-items-panel .order-item.add-to-cart-container'); 2716 2717 $(requisitionOrdr).each(function (index, ordr) { 2718 2719 var item = {}, 2720 isMultipleDates, 2721 deliveryInfo = {}, 2722 deliveryMethodInfo = [], 2723 deliveryModes = []; 2724 2725 item['brand'] = $(ordr).find('#brand').val(); 2726 item['category'] = $(ordr).find('#category').val(); 2727 item['id'] = $(ordr).find('#productCode').val(); 2728 item['name'] = $(ordr).find('#productDesc').text(); 2729 item['quantity'] = $(ordr).find('#quantity').val(); 2730 item['position'] = index + 1; 2731 item['salePrice'] = $(ordr).find('input[name="productRegPrice"]').val(); 2732 item['uom'] = $(ordr).find('#productUOM').val(); 2733 item['quantity'] = $(ordr).find('#quantity').val(); 2734 item['price'] = $(ordr).find('input[name="productRegPrice"]').val(); 2735 if($(ordr).find('.dates').length > 0){ 2736 isMultipleDates =true; 2737 } 2738 if(isMultipleDates){ 2739 $(ordr).find('.date-list .date').each(function(index,elmnt){ 2740 var deliveryDate = $(elmnt).find('.moment').clone().children().remove().end().text().trim(); 2741 deliveryMethodInfo.push({ 2742 quantity: $(elmnt).find('.quantity').text().trim().match(/\d+/)[0], 2743 daysForDelivery: Math.floor((Date.parse(deliveryDate) - Date.parse(currentDate)) / 86400000) 2744 }); 2745 2746 }); 2747 }else{ 2748 var deliveryDate = $(ordr).find('.order-item-delivery .single-date').text(); 2749 2750 deliveryMethodInfo.push({ 2751 2752 quantity: $(ordr).find('#quantity').val(), 2753 daysForDelivery: Math.floor((Date.parse(deliveryDate) - Date.parse(currentDate)) / 86400000) 2754 }); 2755 } 2756 2757 deliveryInfo = { 2758 DeliveryMethod: $(ordr).parents('.order-section.requisition-action-items').find('.deliverymode-title').text(), 2759 DeliveryMethodInfo: deliveryMethodInfo 2760 }; 2761 deliveryModes.push({ 2762 deliveryInfo: deliveryInfo 2763 }); 2764 item['deliveryModes'] = deliveryModes; 2765 reqOrder.push(item); 2766 }); 2767 var requisitionRejectOrdr = $(reqOrdr).find('.rejected-items-panel .order-item.add-to-cart-container'); 2768 2769 $(requisitionRejectOrdr).each(function (index, ordr) { 2770 2771 var item = {}, 2772 isMultipleDates, 2773 deliveryInfo = {}, 2774 deliveryMethodInfo = [], 2775 deliveryModes = []; 2776 2777 item['brand'] = $(ordr).find('#brand').val(); 2778 item['category'] = $(ordr).find('#category').val();
2779 item['id'] = $(ordr).find('#productCode').val(); 2780 item['name'] = $(ordr).find('#productDesc').text(); 2781 item['quantity'] = $(ordr).find('#quantity').val(); 2782 item['rejectedReason']=$(ordr).find('.rejected-reason').text().trim(); 2783 item['position'] = index + 1; 2784 item['salePrice'] = $(ordr).find('input[name="productRegPrice"]').val(); 2785 item['uom'] = $(ordr).find('#productUOM').val(); 2786 item['quantity'] = $(ordr).find('#quantity').val(); 2787 item['price'] = $(ordr).find('input[name="productRegPrice"]').val(); 2788 if($(ordr).find('.dates').length > 0){ 2789 isMultipleDates =true; 2790 } 2791 if(isMultipleDates){ 2792 $(ordr).find('.date-list .date').each(function(index,elmnt){ 2793 var deliveryDate = $(elmnt).find('.moment').clone().children().remove().end().text().trim(); 2794 deliveryMethodInfo.push({ 2795 quantity: $(elmnt).find('.quantity').text().trim().match(/\d+/)[0], 2796 daysForDelivery: Math.floor((Date.parse(deliveryDate) - Date.parse(currentDate)) / 86400000) 2797 }); 2798 2799 }); 2800 }else{ 2801 var deliveryDate = $(ordr).find('.order-item-delivery .single-date').text(); 2802 2803 deliveryMethodInfo.push({ 2804 2805 quantity: $(ordr).find('#quantity').val(), 2806 daysForDelivery: Math.floor((Date.parse(deliveryDate) - Date.parse(currentDate)) / 86400000) 2807 }); 2808 } 2809 2810 deliveryInfo = { 2811 DeliveryMethod: $(ordr).parents('.order-section.requisition-action-items').find('.deliverymode-title').text(), 2812 DeliveryMethodInfo: deliveryMethodInfo 2813 }; 2814 deliveryModes.push({ 2815 deliveryInfo: deliveryInfo 2816 }); 2817 item['deliveryModes'] = deliveryModes; 2818 rejOrder.push(item); 2819 }); 2820 2821 obj = { 2822 requisitionNo : requisitionNumber, 2823 OrderID : OrderID, 2824 productInfo : reqOrder, 2825 productInfoRejected : rejOrder 2826 }; 2827 requisitionsInfo.push(obj); 2828 }); 2829 requisitionsData = { 2830 2831 requisitions : requisitionsInfo 2832 }; 2833 $.extend(_A.digitalData, requisitionsData); 2834 _satellite.track('approvePartialRequisition'); 2835 2836 } 2837 2838 function manageAccountAddressesTrack(e,action){ 2839 if(action==='accountRemoved'){ 2840 _satellite.track('removeAccount'); 2841 } 2842 if(action==='verifyAccount'){ 2843 _satellite.track('addAccount'); 2844 } 2845 if(action==='removedAddress'){ 2846 _satellite.track('removeAddress'); 2847 } 2848 if(action==='addAddress'){ 2849 _satellite.track('addAddress'); 2850 } 2851 if(action==='editAddress'){ 2852 _satellite.track('editAddress'); 2853 } 2854 } 2855 2856 function contactAirgasModalTrack(i,currentElement){ 2857 linksDataLayer(currentElement,false); 2858 } 2859 /** 2860 * Function to track autopay 2861 */ 2862 function adobeAutopayTrack() { 2863 var autopayDataLayer, 2864 custNum = $('#autopayCustNum').val(), 2865 emailID = $('#autopayEmailID').val(), 2866 accountType = $('#autopayAccountType').val() !== '' ? $('#autopayAccountType').val().toUpperCase().includes('SHIP') ? 'SH' : 'SP' : '', 2867 salesOrg = $('#autopaySalesOrg').val(), 2868 zipCode = $('#autopayZipcode').val(); 2869 2870 _A.digitalData.userInfo.accountID = custNum; 2871 _A.digitalData.userInfo.userID = emailID; 2872 _A.digitalData.userInfo.salesOrg = salesOrg; 2873 _A.digitalData.userInfo.zipCode = zipCode; 2874 if ($('.accounts-review-enrolled-container').length > 0) { 2875 autopayDataLayer = { 2876 autopay: { 2877 accountID: { 2878 accountNumber: $('#adCustNum').val(), 2879 division: $('#invoiceDivision').val(), 2880 accountType: accountType 2881 }, 2882 paymentMethod: $('#paymentMethod').val(), 2883 invoiceType: $('.auto-pay-table-tbody .col-enrolled span').text() !== undefined ? $('.auto-pay-table-tbody .col-enrolled span').text() : '', 2884 } 2885 }; 2886 if(isGuestUser === 'true') { 2887 autopayDataLayer.autopay['userID']= emailID; 2888 } 2889 $.extend(_A.digitalData, autopayDataLayer); 2890 _satellite.track('enrollAutopay'); 2891 } else { 2892 _A.digitalData.userInfo['accountType'] = accountType; 2893 if (isGuestUser === 'false') { 2894 autopayDataLayer = { 2895 autopay: { 2896 accountNumber: custNum, 2897 division: salesOrg, 2898 accountType: accountType 2899 } 2900 }; 2901 $.extend(_A.digitalData, autopayDataLayer); 2902 } 2903 } 2904 } 2905 /** 2906 * Function to track Enrolled autopay accounts actions 2907 */ 2908 function adobeEnrolledAccountActionsTrack() { 2909 var enrolledAccountActionsDataLayer, 2910 enrolledPaymentMetod = $('#enrolledPaymentMethod').val(); 2911 if($('#enrolledPaymentUpdate').val() === 'true' || $('#enrolledInvoiceUpdate').val() === 'true' || $('#accountUnenrolled').val() === 'true') { 2912 if(enrolledPaymentMetod === '') { 2913 $('[data-account]').each(function() { 2914 if($(this).data('account') === $('#enrolledAccountNumber').val()) { 2915 if($($(this).find('.ending-ellipsis')[0]).text() === '....') { 2916 enrolledPaymentMetod = 'CC'; 2917 } else { 2918 enrolledPaymentMetod = 'ACH'; 2919 } 2920 } 2921 }); 2922 } 2923 enrolledAccountActionsDataLayer = { 2924 autopay: { 2925 accountID: { 2926 accountNumber: $('#enrolledAccountNumber').val(), 2927 division: $('#enrolledSalesOrg').val(), 2928 accountType: $('#enrolledAccountType').val() !== '' ? $('#enrolledAccountType').val().toUpperCase().includes('SHIP') ? 'SH' : 'SP' : '' 2929 }, 2930 paymentMethod: enrolledPaymentMetod, 2931 invoiceType: $('#enrolledInvoiceType').val() 2932 } 2933 }; 2934 $.extend(_A.digitalData, enrolledAccountActionsDataLayer); 2935 } 2936 if($('#accountUnenrolled').val() === 'true') { 2937 _satellite.track('unenrollAutopay'); 2938 } 2939 if($('#enrolledPaymentUpdate').val() === 'true' || $('#enrolledInvoiceUpdate').val() === 'true') { 2940 _satellite.track('updateAutopay'); 2941 } 2942 } 2943 2944 function handleDashboardsTracking(i,linkName){ 2945 if (_A.digitalData.hasOwnProperty('pageInfo')) { 2946 delete _A.digitalData.pageInfo; 2947 } 2948 var linkObj = { 2949 pageInfo: { 2950 pageName: pageName, 2951 pageURL: pageURL, 2952 pageType: pageType 2953 }, 2954 linkName: linkName, 2955 linkPageName: pageName, 2956 linkType: 'internal', 2957 siteRegion: 'Body' 2958 }; 2959 $.extend(_A.digitalData, linkObj); 2960 _satellite.track('linkClicked'); 2961 2962 } 2963 /** 2964 * Function to track cancelled/abandoned adobe track 2965 */ 2966 function handleAutopayTrack() { 2967 var autopayObj = {}, 2968 custNum = $('#autopayCustNum').val(), 2969 emailID = $('#autopayEmailID').val(), 2970 accountType = $('#autopayAccountType').val() !== '' ? $('#autopayAccountType').val().toUpperCase().includes('SHIP') ? 'SH' : 'SP' : '', 2971 salesOrg = $('#autopaySalesOrg').val(); 2972 2973 if (_A.digitalData.userInfo !== undefined) { 2974 _A.digitalData.userInfo.accountID = custNum; 2975 _A.digitalData.userInfo.userID = emailID; 2976 _A.digitalData.userInfo.salesOrg = salesOrg; 2977 _A.digitalData.userInfo['accountType'] = accountType; 2978 } else { 2979 pageLoadAdobeGlobalObject(); 2980 } 2981 if (isGuestUser === 'false') { 2982 autopayObj['accountNumber'] = $('#autopayCustNum').val();
2983 autopayObj['division'] = $('#autopaySalesOrg').val(); 2984 autopayObj['accountType'] = $('#autopayAccountType').val() !== '' ? $('#autopayAccountType').val().toUpperCase().includes('SHIP') ? 'SH' : 'SP' : ''; 2985 _A.digitalData['autopay'] = autopayObj; 2986 } 2987 _satellite.track('cancelEnrollAutopay'); 2988 } 2989 registerAdobeElementEvents(); 2990 }); 2991 }); 2992 }); 2993 } 2994}, 5);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.