1(function applyParselyConversions(){ 2 const DEBUG_MODE = true; 3 4 window.addEventListener("DOMContentLoaded", function applyTracking() { 5 6 function isCorporateSubscriptionPage() { 7 const target = "corporate-subscriptions"; 8 const url = new URL( window.location.href ); 9 if ( url.pathname.indexOf( target) > 0 ) { 10 return true; 11 } 12 return false; 13 } 14 15 16 const loginTracker = () => 17 PARSELY.conversions.trackLinkClick( "SiteLogin" ); 18 19 const freeRegTracker = () =>{ 20 var conversion_from=jQuery("#aw_reg_conversion_from").val(); 21 var label= "Free Registration"; 22 if(conversion_from=="article"){ 23 label="Article Registration"; 24 } 25 PARSELY.conversions.trackLinkClick( label ); 26 } 27 const paidSubTracker = () => 28 PARSELY.conversions.trackSubscription( "Paid Subscription" ) ; 29 const accountTracker = () =>{ 30 PARSELY.conversions.trackLinkClick( "My Account" ); 31 } 32 33 const articleSubTracker = () => 34 PARSELY.conversions.trackSubscription( "Article Subscription" ); 35 const articleRegTracker = () => 36 PARSELY.conversions.trackSubscription( "Article Registration" ); 37 38 const magazineSubTracker = () => 39 PARSELY.conversions.trackSubscription( "Magazine Subscription" ); 40 const magazineRegTracker = () => 41 PARSELY.conversions.trackSubscription( "Magazine Registration" ); 42 43 const whitepaperTracker = () => 44 PARSELY.conversions.trackLinkClick( "Whitepaper" ); 45 46 const webinarTracker = () => 47 PARSELY.conversions.trackLinkClick( "Webinar" ); 48 49 const microLearningClickTracker = () => 50 PARSELY.conversions.trackLinkClick( "Microlearning" ); 51 52 handlePageload(); 53 function handlePageload() { 54 if ( jQuery( ".login-page" ).length > 0 ) { 55 applyLoginListeners(); 56 } 57 58 if ( jQuery( ".registration-page" ).length > 0 ) { 59 applyRegistrationListeners(); 60 } 61 62 if ( jQuery( ".post-type-archive-webinar" ).length > 0 ) { 63 applyWebinarListeners(); 64 } 65 66 if ( jQuery( ".sponsored_post-template-default,.sponsored_post-template-sponsor-asset-download, .adw_resource-template-sponsor-asset-download" ).length > 0 ) { 67 applyWhitepaperListeners(); 68 } 69 70 if ( jQuery( ".issue,.aw-issue-message a" ).length > 0 ) { 71 applyIssueListeners(); 72 } 73 74 if ( jQuery ( ".aw_learning-template-default" ).length > 0 ) { 75 applyMicrolearningListeners(); 76 } 77 78 if ( jQuery( ".adw-article-body,.single-post" ).length > 0 ) { 79 applyArticleListeners(); 80 } 81 82 if ( jQuery( "form.parsely-type-lead-capture" ).length > 0 ) { 83 //applyContactForm7Listeners(); 84 } 85 if ( jQuery( ".user-profile-settings-page" ).length > 0 ) { 86 applyAccountListeners(); 87 } 88 if(jQuery("#aw-navbar").length>0){ 89 //applySubscribeBtnListeners() 90 } 91 if ( jQuery( ".aw_learning-template-default .aw-course-tile .aw-course-btn" ).length > 0 ) { 92 applyMicroClickListeners(); 93 } 94 } 95 96 function applyMicroClickListeners(){ 97 jQuery( ".aw_learning-template-default .aw-course-tile .aw-course-btn").on('click',microLearningClickTracker); 98 } 99 100//Article Listener Function 101 function applyArticleListeners() { 102 const iframeCTASelector = "iframe[id^=lightbox-iframe]"; 103 104 // Re-register event listeners when the paywall is lifted or Read More button is clicked 105 jQuery( document ).on( "aw_article_content_loaded", applyArticleListeners ); 106 jQuery( iframeCTASelector ).on("load", function applyIframeListeners() { 107 const digiohRegisterSelector = "#button3"; 108 const digiohLoginSelector = "#button2"; 109 const digiohSubscribeSelector = "#button1"; 110 const iframe = jQuery( iframeCTASelector ).contents(); 111 112 iframe.find( digiohRegisterSelector ).off( "click" ).on( "click", articleRegTracker ); 113 iframe.find( digiohLoginSelector ).off( "click" ).on( "click", loginTracker ); 114 //iframe.find( digiohSubscribeSelector ).off( "click" ).on( "click", articleSubTracker ); 115 }) 116 } 117 118 119 function applyContactForm7Listeners() { 120 const label = isCorporateSubscriptionPage() 121 ? "Corporate Subscription" 122 : "Contact Form" 123 124 const tracker = ()=> 125 PARSELY.conversions.trackLeadCapture( label ); 126 127 jQuery("form.parsely-type-lead-capture").on( "submit", tracker ); 128 } 129 130 function applyAccountListeners(){ 131 jQuery( "#aw-update-profile-btn").on('click',accountTracker); 132 } 133 function applySubscribeBtnListeners(){ 134 jQuery("#aw-navbar").on("click",".btn-subscribe",paidSubTracker); 135 } 136 137 138 function applyMicrolearningListeners() { 139 jQuery( ".aw-course-subscribe-link" ).on( "click", loginTracker ); 140 } 141 142 function applyIssueListeners() { 143 //jQuery( ".issues a,.aw-issue-message a" ).on( "click", magazineSubTracker ); 144 } 145 146 function applyWhitepaperListeners() { 147 const iframeCTASelector = "iframe[id^=lightbox-iframe]"; 148 149 // Re-register event listeners when the paywall is lifted or Read More button is clicked
150 jQuery( document ).on( "aw_article_content_loaded", applyArticleListeners ); 151 152 jQuery( iframeCTASelector ).on("load", function applyIframeListeners() { 153 const downloadSelector = "#button1"; 154 const iframe = jQuery( iframeCTASelector ).contents(); 155 jQuery( downloadSelector ).on( "click", whitepaperTracker ); 156 }); 157 } 158 159 160 function applyWebinarListeners() { 161 jQuery(".section--index-item a").on( "click", webinarTracker ); 162 jQuery(".js-load-more-btn").on( "click", function resetListeners() { 163 jQuery(".section--index-item a").off( "click" ); 164 jQuery(".js-load-more-btn").off( "click" ); 165 setTimeout( applyWebinarListeners, 1000 ); 166 }); 167 } 168 169 function applyRegistrationListeners() { 170 const $form = jQuery( "#registration-page form"); 171 //$form.on( "submit", freeRegTracker ); 172 } 173 174 175 // Passes the LinkClick event to Parsely with the login label on login 176 function applyLoginListeners() { 177 const loginButton = document.querySelector( "#aw_login_button" ); 178 const magicLinkButton = document.querySelector( "#aw_magic_link_button" ); 179 180 loginButton && loginButton.addEventListener( "click", loginTracker, {once: true} ); 181 magicLinkButton && magicLinkButton.addEventListener( "click", loginTracker, {once: true} ); 182 } 183 }); 184 185})(); 186
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.