1/*global pwlGtmDataLayer:true*/ 2 3/** 4 * Set the array for the Page Naming Conventions JS 5 * 6 * PEI Media Data Layer Instructions v2.0 7 * 2. Page Naming Conventions 8 * 9 * @type {Object} 10 */ 11var specificPageEvents = {}; 12 13( function () { 14 'use strict'; 15 16 specificPageEvents = { 17 18 /** 19 * Detects when a user interacts with modals 20 * 21 * PEI Media Data Layer Instructions v2.0 22 * 2.3.6 Identity Pages 23 */ 24 identityPages: { 25 26 modalOpened: function ( modalTriggerSelector ) { 27 28 jQuery( document ).on( 'click', modalTriggerSelector, function () { 29 30 var modalType = ''; 31 if ( modalTriggerSelector === 'a[href="#blaize-register-form"]' ) { 32 modalType = 'register'; 33 } else if ( modalTriggerSelector === 'a[href="#blaize-login-form"]' ) { 34 modalType = 'login'; 35 } 36 37 var pushArray = { 38 'event': 'virtual page view', 39 'pageType': 'identity', 40 'pageName': '/ga-virtual/identity/' + modalType 41 }; 42 43 pwlGtmDataLayer.push( pushArray ); 44 } ); 45 46 }, 47 48 modalClosed: function () { 49 50 jQuery( document ).on( 'pwl_modal_closed', function () { 51 52 var pageType = pwlGtmDataLayer.findDlValue( 'pageType' ), 53 pageName = pwlGtmDataLayer.findDlValue( 'pageName' ); 54 55 var pushArray = { 56 'event': 'virtual page view', 57 'pageType': pageType, 58 'pageName': pageName, 59 }; 60 61 pwlGtmDataLayer.push( pushArray ); 62 } ); 63 64 }, 65 66 modalSubmitSuccess: function ( modalIdCollection ) { 67 68 /** 69 * Check if a modal exists and then if a success message has either been injected or already exists but is not displayed, when either of these events are reversed then submission has been successful 70 * @param modalId 71 */ 72 function checkSuccess ( modalId ) { 73 74 var modal = document.getElementById( modalId ); 75 if ( modal ) { 76 77 var successMessage = modal.querySelector( '.success-message, #success-message' ); 78 var modalType; 79 80 switch ( modalId ) { 81 82 case 'blaize-register-form': 83 modalType = 'registration'; // This ref is from the doc 84 break; 85 86 case 'blaize-login-form': 87 case 'blaize-top_menu_login-form': 88 modalType = 'login'; 89 break; 90 91 } 92 93 var pushArray = { 94 'event': 'virtual page view', 95 'pageType': 'identity', 96 'pageName': '/ga-virtual/identity/' + modalType + '-nearly-there' 97 }; 98 99 if ( modal ) { 100 101 if ( !successMessage || window.getComputedStyle( successMessage ).display === 'none' ) { 102 setTimeout( checkSuccess.bind( null, modalId ), 1000 ); 103 } else { 104 pwlGtmDataLayer.push( pushArray ); 105 } 106 107 } 108 109 } 110 111 }; 112 113 jQuery.map( modalIdCollection, checkSuccess ); 114 115 } 116 117 }, 118 119 /** 120 * Detects When a User Clicks Contacts Us on Subscription Page ( Secondariesinvestor ) 121 * 122 * PEI Media Data Layer Instructions v2.0 123 * 2.3.11 Help & Support Pages 124 */ 125 helpAndSupport: { 126 127 subcribeContactUs: function ( modalTriggerClass ) { 128 129 if ( modalTriggerClass === '.team-wide-access-modal-js' ) { 130 131 var pushArray = { 132 'event': 'virtual page view', 133 'pageType': 'help and support', 134 'pageName': '/help-and-support/subscription-contact-us' 135 }; 136 137 jQuery( modalTriggerClass ).click( function () { 138 pwlGtmDataLayer.push( pushArray ); 139 } ); 140 } 141 } 142 143 }, 144 145 /** 146 * Add pageName to Google Tag Manager if we're on a database page. 147 * We need to push the pageName with Javascript as Odin uses 148 * hashes in order to differentiate the database pages. 149 */ 150 liveFundraisingCharts: function () { 151 var interactions = visitorInteractions || false; 152 153 // If the visitorInteractions object is not available abort. 154 if ( interactions === false ) { 155 return; 156 } 157 158 // Check if we are on a database page. 159 if ( interactions.extractPageName() === 'rna directory' ) { 160 161 // Grab the url hash. 162 if ( window.location.hash ) { 163 var hash = window.location.hash.substring( 1 ).split( '?' ); 164 165 if ( hash.length > 0 ) { 166 167 var pushArray = { 168 'pageName': '/ga-virtual/rna-directory' 169 }; 170 171 // Check if we are on the charts page. 172 if ( hash[ 0 ].indexOf( '/charts' ) !== -1 ) { 173 pushArray.pageName += '/live-fundraising'; 174 } 175 176 pwlGtmDataLayer.push( pushArray ); 177 178 } 179 180 } 181 182 } 183 } 184 }; 185 186} )(); 187 188jQuery( document ).ready( function () { 189 190 specificPageEvents.identityPages.modalOpened( 'a[href="#blaize-login-form"]' ); 191 specificPageEvents.identityPages.modalOpened( 'a[href="#blaize-register-form"]' ); 192 specificPageEvents.identityPages.modalClosed(); 193 specificPageEvents.identityPages.modalSubmitSuccess( [ 'blaize-login-form', 'blaize-top_menu_login-form' ] ); 194 specificPageEvents.helpAndSupport.subcribeContactUs( '.team-wide-access-modal-js' ); // Not specified in doc but will work 195 specificPageEvents.liveFundraisingCharts(); 196 197} );
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.