1(function (win) { 2 'use strict'; 3 4 win.KeyenceAnalytics = {}; 5 6 win.KeyenceAnalytics.Analytics = (function () { 7 var Analytics = function () { 8 this.generalMeasureList = [ 9 new win.KeyenceAnalytics.GroupTypeLeftNavi(), 10 new win.KeyenceAnalytics.DownloadFilter(), 11 new win.KeyenceAnalytics.CTABanner(), 12 new win.KeyenceAnalytics.SideCTA(), 13 new win.KeyenceAnalytics.MykDeqwasModal(), 14 new win.KeyenceAnalytics.MykOneMorePRBanner(), 15 new win.KeyenceAnalytics.ModalWindow(), 16 new win.KeyenceAnalytics.PopupMypage(), 17 ]; 18 }; 19 20 Analytics.canNoticeEvent = function () { 21 if (win.dataLayer && (typeof win.dataLayer.push === 'function')) { 22 return true; 23 } 24 25 return false; 26 }; 27 28 Analytics.inherits = function (ctor, superCtor) { 29 if (typeof ctor === 'function' && typeof superCtor === 'function') { 30 ctor.prototype = Object.create(superCtor.prototype); 31 32 Object.defineProperty(ctor.prototype, 'constructor', { 33 value: ctor, 34 enumerable: false, 35 writable: true, 36 }); 37 } 38 }; 39 40 Analytics.getRawEventAction = function (eventType) { 41 var actionKey = ''; 42 var actionName = ''; 43 44 if (typeof eventType !== 'string') { 45 return ''; 46 } 47 48 actionKey = eventType.match(/^.*?(?=_)/); 49 50 if (!actionKey) { 51 return ''; 52 } 53 54 switch (actionKey[0]) { 55 case 'Focus': 56 actionName = 'focus'; 57 break; 58 case 'Click': 59 actionName = 'click'; 60 break; 61 case 'Error': 62 actionName = 'error'; 63 break; 64 case 'Blank': 65 actionName = 'blank'; 66 break; 67 case 'Validate': 68 actionName = 'validate'; 69 break; 70 default: 71 break; 72 } 73 74 return actionName; 75 }; 76 77 Analytics.prototype.getEventType = function (name) { 78 return this.EVENT_TYPES[name]; 79 }; 80 81 Analytics.prototype.noticeEvent = function (funcName, eventType, element) { 82 var i; 83 var len; 84 85 if (!Analytics.canNoticeEvent()) { 86 return; 87 } 88 89 len = this.generalMeasureList.length; 90 91 for (i = 0; i < len; i++) { 92 if (this.generalMeasureList[i].constructor.name === funcName) { 93 this.generalMeasureList[i].noticeEvent(eventType, element); 94 95 break; 96 } 97 } 98 }; 99 100 Analytics.prototype.getRawEventCategory = function () { 101 throw new Error('Not Implemented'); 102 }; 103 104 return Analytics; 105 }()); 106 107 win.KeyenceAnalytics.Form = (function () { 108 var Analytics = win.KeyenceAnalytics.Analytics; 109 110 var Form = function () { 111 Analytics.call(this); 112 113 this.EVENT_TYPES = { 114 SIGNIN_FOCUS: 'Focus_SigninForm', 115 SIGNIN_CLICK: 'Click_SigninForm', 116 SIGNIN_ERROR: 'Error_SigninForm', 117 SIGNIN_BLANK_ERROR: 'Blank_SigninForm', 118 SIGNIN_VALIDATE_ERROR: 'Validate_SigninForm', 119 RESET_FOCUS: 'Focus_ResetForm', 120 RESET_CLICK: 'Click_ResetForm', 121 RESET_ERROR: 'Error_ResetForm', 122 RESET_BLANK_ERROR: 'Blank_ResetForm', 123 RESET_VALIDATE_ERROR: 'Validate_ResetForm', 124 }; 125 }; 126 127 Analytics.inherits(Form, Analytics); 128 129 Form.prototype.noticeEvent = function (eventType, element, prefix) { 130 var rawEventCategory = ''; 131 var rawEventAction = ''; 132 var elementId = ''; 133 134 if (typeof eventType !== 'string' || !element) { 135 return; 136 } 137 138 rawEventCategory = this.getRawEventCategory(eventType); 139 140 if (rawEventCategory === '') { 141 return; 142 } 143 144 rawEventAction = Analytics.getRawEventAction(eventType); 145 146 if (rawEventAction === '') { 147 return; 148 } 149
150 if (element.id === '') { 151 return; 152 } 153 154 elementId = typeof prefix === 'string' ? prefix + element.id : element.id; 155 156 if (Analytics.canNoticeEvent()) { 157 win.dataLayer.push({ 158 event: 'GeneralFormEvent', 159 generalFormCategory: rawEventCategory, 160 generalFormAction: rawEventAction, 161 'gtm.element': element, 162 'gtm.elementClasses': element.className, 163 'gtm.elementId': elementId, 164 }); 165 } 166 }; 167 168 Form.prototype.getRawEventCategory = function (eventType) { 169 var category = ''; 170 171 switch (eventType) { 172 case this.EVENT_TYPES.RESET_FOCUS: 173 case this.EVENT_TYPES.RESET_CLICK: 174 case this.EVENT_TYPES.RESET_ERROR: 175 case this.EVENT_TYPES.RESET_BLANK_ERROR: 176 case this.EVENT_TYPES.RESET_VALIDATE_ERROR: 177 category = 'reset'; 178 break; 179 case this.EVENT_TYPES.SIGNIN_FOCUS: 180 case this.EVENT_TYPES.SIGNIN_CLICK: 181 case this.EVENT_TYPES.SIGNIN_ERROR: 182 case this.EVENT_TYPES.SIGNIN_BLANK_ERROR: 183 case this.EVENT_TYPES.SIGNIN_VALIDATE_ERROR: 184 category = 'signin'; 185 break; 186 default: 187 break; 188 } 189 190 return category; 191 }; 192 193 Form.prototype.noticeScreenName = function (screenName, formCategory) { 194 if (typeof screenName !== 'string' || typeof formCategory !== 'string') { 195 return; 196 } 197 198 if (Analytics.canNoticeEvent()) { 199 win.dataLayer.push({ 200 event: 'GeneralFormEvent', 201 generalFormCategory: formCategory, 202 generalFormAction: 'screen', 203 'gtm.element': '', 204 'gtm.elementClasses': '', 205 'gtm.elementId': screenName, 206 }); 207 } 208 }; 209 210 Form.prototype.noticeModalControl = function (idName, actionName, formCategory, prefix) { 211 var elementEventName = ''; 212 213 if (typeof idName !== 'string' || typeof actionName !== 'string' || typeof formCategory !== 'string') { 214 return; 215 } 216 217 elementEventName = typeof prefix === 'string' ? prefix + idName : idName; 218 219 if (Analytics.canNoticeEvent()) { 220 win.dataLayer.push({ 221 event: 'GeneralFormEvent', 222 generalFormCategory: formCategory, 223 generalFormAction: actionName, 224 'gtm.element': '', 225 'gtm.elementClasses': '', 226 'gtm.elementId': elementEventName, 227 }); 228 } 229 }; 230 231 return Form; 232 }()); 233 234 win.KeyenceAnalytics.GeneralMeasure = (function () { 235 var Analytics = win.KeyenceAnalytics.Analytics; 236 237 var GeneralMeasure = function () { 238 }; 239 240 GeneralMeasure.EVENT_TYPES = { 241 CLICK: 'click', 242 }; 243 244 GeneralMeasure.prototype.getRawEventCategory = function () { 245 throw new Error('Not Implemented'); 246 }; 247 248 GeneralMeasure.prototype.getRawEventAction = function () { 249 throw new Error('Not Implemented'); 250 }; 251 252 GeneralMeasure.prototype.getRawEventLabel = function () { 253 throw new Error('Not Implemented'); 254 }; 255 256 GeneralMeasure.prototype.noticeEvent = function (eventType, element) { 257 var rawEventCategory = ''; 258 var rawEventAction = ''; 259 var rawEventLabel = ''; 260 261 if (typeof eventType !== 'string' || !element) { 262 return; 263 } 264 265 rawEventCategory = this.getRawEventCategory(eventType); 266 267 if (rawEventCategory === '') { 268 return; 269 } 270 271 rawEventAction = this.getRawEventAction(eventType); 272 rawEventLabel = this.getRawEventLabel(element); 273 274 if (Analytics.canNoticeEvent()) { 275 win.dataLayer.push({ 276 event: 'GeneralMeasureEvent', 277 gaGeneralMeasureCategory: 'General Measure:' + rawEventCategory, 278 gaGeneralMeasureAction: rawEventAction, 279 gaGeneralMeasureLabel: rawEventLabel, 280 }); 281 } 282 }; 283 284 return GeneralMeasure; 285 }()); 286 287 win.KeyenceAnalytics.GroupTypeLeftNavi = (function () { 288 var GeneralMeasure = win.KeyenceAnalytics.GeneralMeasure; 289 290 var GroupTypeLeftNavi = function () { 291 GeneralMeasure.call(this); 292 }; 293 294 win.KeyenceAnalytics.Analytics.inherits(GroupTypeLeftNavi, GeneralMeasure); 295 296 GroupTypeLeftNavi.prototype.getRawEventCategory = function () { 297 var category = 'group/type left navi'; 298 299 return category; 300 }; 301 302 GeneralMeasure.prototype.getRawEventAction = function (eventType) { 303 return eventType; 304 }; 305 306 GroupTypeLeftNavi.prototype.getRawEventLabel = function (element) { 307 var eventLabel = ''; 308 309 if (element && (element.href && element.href.length)) { 310 eventLabel = element.href; 311 } 312 313 return eventLabel; 314 }; 315 316 return GroupTypeLeftNavi; 317 }()); 318 319 win.KeyenceAnalytics.DownloadFilter = (function () { 320 var GeneralMeasure = win.KeyenceAnalytics.GeneralMeasure; 321 322 var DownloadFilter = function () { 323 GeneralMeasure.call(this); 324 }; 325 326 win.KeyenceAnalytics.Analytics.inherits(DownloadFilter, GeneralMeasure); 327 328 DownloadFilter.EVENT_TYPES = { 329 CLICK: 'click', 330 CLICK_MODELS: 'click_models', 331 CLICK_FILE_TYPES: 'click_fileTypes', 332 CLICK_CATEGORY: 'click_category', 333 }; 334 335 DownloadFilter.prototype.getRawEventCategory = function (eventType) { 336 var category = ''; 337 338 switch (eventType) { 339 case DownloadFilter.EVENT_TYPES.CLICK_MODELS: 340 category = 'Filter by Models'; 341 break; 342 case DownloadFilter.EVENT_TYPES.CLICK_FILE_TYPES: 343 category = 'Filter by File Types'; 344 break; 345 case DownloadFilter.EVENT_TYPES.CLICK_CATEGORY: 346 category = 'Filter by Manual Category'; 347 break; 348 default: 349 break; 350 } 351 352 return category; 353 }; 354 355 DownloadFilter.prototype.getRawEventAction = function (eventType) { 356 var actionName = ''; 357 358 switch (eventType) { 359 case DownloadFilter.EVENT_TYPES.CLICK_MODELS: 360 case DownloadFilter.EVENT_TYPES.CLICK_FILE_TYPES: 361 case DownloadFilter.EVENT_TYPES.CLICK_CATEGORY: 362 actionName = DownloadFilter.EVENT_TYPES.CLICK; 363 break; 364 default: 365 break; 366 } 367 368 return actionName; 369 }; 370 371 DownloadFilter.prototype.getRawEventLabel = function (element) { 372 var eventLabel = ''; 373 374 if (element) { 375 if (element.value && element.value.length) { 376 eventLabel = element.value; 377 } else if (element.innerText && element.innerText.length) { 378 eventLabel = element.innerText; 379 } 380 } 381 382 return eventLabel; 383 }; 384 385 return DownloadFilter; 386 }()); 387 388 win.KeyenceAnalytics.CTABanner = (function () { 389 var GeneralMeasure = win.KeyenceAnalytics.GeneralMeasure; 390 391 var CTABanner = function () { 392 GeneralMeasure.call(this); 393 }; 394 395 win.KeyenceAnalytics.Analytics.inherits(CTABanner, GeneralMeasure); 396 397 CTABanner.EVENT_TYPES = { 398 CLICK: 'click', 399 CLICK_IMAGE_SCHEMA_LINK: 'click_image_schema_link', 400 CLICK_MOVIE_SCHEMA_LINK: 'click_movie_schema_link', 401 SHOW: 'show', 402 SHOW_IMAGE_SCHEMA: 'show_image_schema', 403 SHOW_MOVIE_SCHEMA: 'show_movie_schema', 404 CLOSE: 'close', 405 CLICK_IMAGE_SCHEMA_CLOSE: 'click_image_schema_close', 406 CLICK_MOVIE_SCHEMA_CLOSE: 'click_movie_schema_close', 407 }; 408 409 CTABanner.prototype.getRawEventCategory = function (eventType) { 410 var category = ''; 411 412 switch (eventType) { 413 case CTABanner.EVENT_TYPES.CLICK_IMAGE_SCHEMA_LINK: 414 case CTABanner.EVENT_TYPES.CLICK_IMAGE_SCHEMA_CLOSE: 415 case CTABanner.EVENT_TYPES.SHOW_IMAGE_SCHEMA: 416 category = 'ModalCTA-image'; 417 break; 418 case CTABanner.EVENT_TYPES.CLICK_MOVIE_SCHEMA_LINK: 419 case CTABanner.EVENT_TYPES.CLICK_MOVIE_SCHEMA_CLOSE: 420 case CTABanner.EVENT_TYPES.SHOW_MOVIE_SCHEMA: 421 category = 'ModalCTA-movie'; 422 break; 423 default: 424 break; 425 } 426 427 return category; 428 }; 429 430 CTABanner.prototype.getRawEventAction = function (eventType) { 431 var actionName = ''; 432 433 switch (eventType) { 434 case CTABanner.EVENT_TYPES.CLICK_IMAGE_SCHEMA_LINK: 435 case CTABanner.EVENT_TYPES.CLICK_MOVIE_SCHEMA_LINK: 436 actionName = CTABanner.EVENT_TYPES.CLICK; 437 break; 438 case CTABanner.EVENT_TYPES.SHOW_IMAGE_SCHEMA: 439 case CTABanner.EVENT_TYPES.SHOW_MOVIE_SCHEMA: 440 actionName = CTABanner.EVENT_TYPES.SHOW; 441 break; 442 case CTABanner.EVENT_TYPES.CLICK_IMAGE_SCHEMA_CLOSE: 443 case CTABanner.EVENT_TYPES.CLICK_MOVIE_SCHEMA_CLOSE: 444 actionName = CTABanner.EVENT_TYPES.CLOSE; 445 break; 446 default: 447 break; 448 } 449 450 return actionName; 451 }; 452 453 CTABanner.prototype.getRawEventLabel = function (element) { 454 var eventLabel = ''; 455 var bannerName = ''; 456 457 if (win.ctaSettings && win.ctaSettings.component_name) { 458 bannerName = win.ctaSettings.component_name; 459 } 460 461 if (element) { 462 if (element.href && element.href.length) { 463 if (element.classList.contains('of-inquiry')) { 464 eventLabel = bannerName + ' â ' + 'Price'; 465 } else if (element.classList.contains('of-download')) { 466 eventLabel = bannerName + ' â ' + 'Download'; 467 } else { 468 eventLabel = bannerName; 469 } 470 } else { 471 eventLabel = bannerName; 472 } 473 } 474 475 return eventLabel; 476 }; 477 478 return CTABanner; 479 }()); 480 481 win.KeyenceAnalytics.SideCTA = (function () { 482 var GeneralMeasure = win.KeyenceAnalytics.GeneralMeasure; 483 484 var SideCTA = function () { 485 GeneralMeasure.call(this); 486 }; 487 488 win.KeyenceAnalytics.Analytics.inherits(SideCTA, GeneralMeasure); 489 490 SideCTA.EVENT_TYPES = { 491 CLICK_LINK: 'click', 492 CLICK_REMOVE_BUTTON: 'hide', 493 }; 494 495 SideCTA.prototype.getRawEventCategory = function () { 496 var category = 'Side CTA'; 497 498 return category; 499 }; 500 501 SideCTA.prototype.getRawEventAction = function (eventType) { 502 var actionName = ''; 503 504 switch (eventType) { 505 case SideCTA.EVENT_TYPES.CLICK_LINK: 506 actionName = SideCTA.EVENT_TYPES.CLICK_LINK; 507 break; 508 case SideCTA.EVENT_TYPES.CLICK_REMOVE_BUTTON: 509 actionName = SideCTA.EVENT_TYPES.CLICK_REMOVE_BUTTON; 510 break; 511 default: 512 break; 513 } 514 515 return actionName; 516 }; 517 518 SideCTA.prototype.getRawEventLabel = function (element) { 519 var eventLabel = ''; 520 521 if (element) { 522 if (element.href && element.href.length) { 523 eventLabel = element.href; 524 } else if (element.classList.contains('js-menuConversion-removeButton')) { 525 eventLabel = 'hide-sideCTA'; 526 } 527 } 528 529 return eventLabel; 530 }; 531 532 return SideCTA; 533 }()); 534 535 win.KeyenceAnalytics.MykDeqwasModal = (function () { 536 var GeneralMeasure = win.KeyenceAnalytics.GeneralMeasure; 537 538 var MykDeqwasModal = function () { 539 GeneralMeasure.call(this); 540 }; 541 542 win.KeyenceAnalytics.Analytics.inherits(MykDeqwasModal, GeneralMeasure); 543 544 MykDeqwasModal.EVENT_TYPES = { 545 SHOW: 'show', 546 CLOSE: 'close', 547 CLICK_ASSET_LINK: 'click', 548 }; 549 550 MykDeqwasModal.prototype.getRawEventCategory = function (eventType) { 551 var category = 'myK Deqwas Modal'; 552 553 return category; 554 }; 555 556 MykDeqwasModal.prototype.getRawEventAction = function (eventType) { 557 var actionName = ''; 558 559 switch (eventType) { 560 case MykDeqwasModal.EVENT_TYPES.SHOW: 561 actionName = MykDeqwasModal.EVENT_TYPES.SHOW; 562 break; 563 case MykDeqwasModal.EVENT_TYPES.CLOSE: 564 actionName = MykDeqwasModal.EVENT_TYPES.CLOSE; 565 break; 566 case MykDeqwasModal.EVENT_TYPES.CLICK_ASSET_LINK: 567 actionName = MykDeqwasModal.EVENT_TYPES.CLICK_ASSET_LINK; 568 break; 569 default: 570 break; 571 } 572 573 return actionName; 574 }; 575 576 MykDeqwasModal.prototype.getRawEventLabel = function (element) { 577 var eventLabel = ''; 578 var url; 579 var params; 580 581 if (element.href && element.href.length) { 582 url = new URL(element.href); 583 params = url.searchParams; 584 eventLabel = params.get('dlAssetId'); 585 } else if (element.dataset.recommendModalAsset) { 586 eventLabel = element.dataset.recommendModalAsset; 587 } 588 589 return eventLabel; 590 }; 591 592 return MykDeqwasModal; 593 }()); 594 595 win.KeyenceAnalytics.MykOneMorePRBanner = (function () { 596 var GeneralMeasure = win.KeyenceAnalytics.GeneralMeasure; 597 598 var MykOneMorePRBanner = function () { 599 GeneralMeasure.call(this); 600 }; 601 602 win.KeyenceAnalytics.Analytics.inherits(MykOneMorePRBanner, GeneralMeasure); 603 604 MykOneMorePRBanner.EVENT_TYPES = { 605 SHOW: 'show', 606 CLICK: 'click', 607 }; 608 609 MykOneMorePRBanner.prototype.getRawEventCategory = function (eventType) { 610 var category = 'myK OneMorePR Banner'; 611 612 return category; 613 }; 614 615 MykOneMorePRBanner.prototype.getRawEventAction = function (eventType) { 616 var actionName = ''; 617 618 switch (eventType) { 619 case MykOneMorePRBanner.EVENT_TYPES.SHOW: 620 actionName = MykOneMorePRBanner.EVENT_TYPES.SHOW; 621 break; 622 case MykOneMorePRBanner.EVENT_TYPES.CLICK: 623 actionName = MykOneMorePRBanner.EVENT_TYPES.CLICK; 624 break; 625 default: 626 break; 627 } 628 629 return actionName; 630 }; 631 632 MykOneMorePRBanner.prototype.getRawEventLabel = function (element) { 633 var eventLabel = ''; 634 var src; 635 var videoName; 636 637 if (element.href && element.href.length) { 638 eventLabel = element.href; 639 } else if (element.src && element.src.lengt
639h) { 640 src = element.src.split('/'); 641 videoName = src.length ? src[src.length - 1] : src; 642 eventLabel = videoName; 643 } 644 645 return eventLabel; 646 }; 647 648 return MykOneMorePRBanner; 649 }()); 650 651 win.KeyenceAnalytics.ModalWindow = (function () { 652 var GeneralMeasure = win.KeyenceAnalytics.GeneralMeasure; 653 654 var ModalWindow = function () { 655 GeneralMeasure.call(this); 656 }; 657 658 win.KeyenceAnalytics.Analytics.inherits(ModalWindow, GeneralMeasure); 659 660 ModalWindow.EVENT_TYPES = { 661 SHOW: 'show', 662 CLOSE: 'close', 663 }; 664 665 ModalWindow.prototype.getRawEventCategory = function (eventType) { 666 var category = 'ModalWindow'; 667 668 return category; 669 }; 670 671 ModalWindow.prototype.getRawEventAction = function (eventType) { 672 var actionName = ''; 673 674 switch (eventType) { 675 case ModalWindow.EVENT_TYPES.SHOW: 676 actionName = ModalWindow.EVENT_TYPES.SHOW; 677 break; 678 case ModalWindow.EVENT_TYPES.CLOSE: 679 actionName = ModalWindow.EVENT_TYPES.CLOSE; 680 break; 681 default: 682 break; 683 } 684 685 return actionName; 686 }; 687 688 ModalWindow.prototype.getRawEventLabel = function (element) { 689 var eventLabel = ''; 690 691 if (element.dataset.modalWindow) { 692 eventLabel = element.dataset.modalWindow; 693 } 694 695 return eventLabel; 696 }; 697 698 return ModalWindow; 699 }()); 700 701 win.KeyenceAnalytics.PopupMypage = (function () { 702 var GeneralMeasure = win.KeyenceAnalytics.GeneralMeasure; 703 704 var PopupMypage = function () { 705 GeneralMeasure.call(this); 706 }; 707 708 win.KeyenceAnalytics.Analytics.inherits(PopupMypage, GeneralMeasure); 709 710 PopupMypage.EVENT_TYPES = { 711 SHOW: 'show', 712 CLICK: 'click', 713 CLOSE: 'close', 714 }; 715 716 PopupMypage.prototype.getRawEventCategory = function () { 717 return 'Popup-Mypage'; 718 }; 719 720 PopupMypage.prototype.getRawEventAction = function (eventType) { 721 var actionName = ''; 722 723 switch (eventType) { 724 case PopupMypage.EVENT_TYPES.SHOW: 725 actionName = PopupMypage.EVENT_TYPES.SHOW; 726 break; 727 case PopupMypage.EVENT_TYPES.CLICK: 728 actionName = PopupMypage.EVENT_TYPES.CLICK; 729 break; 730 case PopupMypage.EVENT_TYPES.CLOSE: 731 actionName = PopupMypage.EVENT_TYPES.CLOSE; 732 break; 733 default: 734 break; 735 } 736 737 return actionName; 738 }; 739 740 PopupMypage.prototype.getRawEventLabel = function () { 741 return ''; 742 }; 743 744 return PopupMypage; 745 }()); 746 747}(window));
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.