1/** 2 * @file 3 * Injects Marketo munchkin tracking. 4 */ 5(function (Drupal, cookies) { 6 'use strict'; 7 8 Drupal.behaviors.marketoMunchkin = { 9 10 attach: function (context, settings) { 11 12 /** 13 * Init Munchkin tracking. 14 */ 15 const init = function () { 16 17 // Integrate with the GDPR module if it is installed. 18 let cookiesAccepted = true; 19 if (typeof GDPR !== 'undefined') { 20 cookiesAccepted = GDPR.cookiesAccepted(); 21 } 22 23 if (cookiesAccepted && typeof Munchkin !== 'undefined') { 24 let config = getMunchkinID(); 25 Munchkin.init(config); 26 } 27 else if (!cookiesAccepted) { 28 cookies.remove('_mkto_trk'); 29 } 30 }; 31 32 /** 33 * Get Munchkin ID from Marketo Settings. 34 */ 35 const getMunchkinID = function () { 36 if (typeof(settings.marketoForms) != 'undefined' && 37 typeof(settings.marketoForms.munchkinId) != 'undefined' && 38 settings.marketoForms.munchkinId) { 39 40 return settings.marketoForms.munchkinId; 41 } 42 43 return false; 44 }; 45 46 // Delay init if GDPR module is installed. 47 if (typeof GDPR !== 'undefined' && !GDPR.initialisationComplete) { 48 window.addEventListener("gdpr:load", function () { 49 init(); 50 }); 51 } 52 else { 53 init(); 54 } 55 } 56 } 57 58})(Drupal, window.Cookies);
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.