1 2function applyDataLayer() { 3 var componentList = [ 4 { class: ".nav-header", name: "Header Navigation" }, 5 { class: ".articleDetails", name: "Article Details" }, 6 { class: ".articleGrid", name: "Article Grid" }, 7 { class: ".articleLibrary", name: "Article Library" }, 8 { class: ".articleList", name: "Article List" }, 9 { class: ".articleTile", name: "Article Tile" }, 10 { class: ".relatedArticleList", name: "Related Article List" }, 11 { class: ".trendingArticles", name: "Trending Article" }, 12 { class: ".exploreInsight", name: "Explore Insight" }, 13 { class: ".insightsArticleBanner", name: "Insights Article Banner" }, 14 { class: ".insightsCategoryBanner", name: "Insights Category Banner" }, 15 { class: ".insightsHeroBanner", name: "Insights Hero Banner" }, 16 { class: ".primaryBanner", name: "Primary Text Banner" }, 17 { class: ".primaryHeroBanner", name: "Primary Hero Banner" }, 18 { class: ".primaryImageBanner", name: "Primary Image Banner" }, 19 { class: ".secondaryBanner", name: "Secondary Banner" }, 20 { class: ".secondaryCTABanner", name: "Secondary CTA Banner" }, 21 { class: ".secondaryHeroBanner", name: "Secondary Hero Banner" }, 22 { class: ".tertiaryHeroBanner", name: "Tertiary Hero Banner" }, 23 { class: ".altaReportHeader", name: "Alta Report Header" }, 24 { class: ".articleBanner", name: "Article Banner" }, 25 { class: ".newsBanner", name: "News Banner" }, 26 { class: ".profileDetailsComponent", name: "Profile Details Component" }, 27 { class: ".accordion", name: "Accordion" }, 28 { class: ".bentoBox", name: "Bento Box" }, 29 { class: ".cardCarousel", name: "Card Carousel" }, 30 { class: ".carouselComponent", name: "Carousel Component" }, 31 { class: ".columnStatsContent", name: "Column Stats Content" }, 32 { class: ".columnTextContent", name: "Column Text Content" }, 33 { class: ".contactUsFormComponent", name: "Contact Us Form" }, 34 { class: ".ctaComponent", name: "CTA Component" }, 35 { class: ".ctaTile", name: "CTA Tile" }, 36 { class: ".dynamicLinkComponent", name: "Dynamic Link Component" }, 37 { class: ".dynamicListComponent", name: "Dynamic List Component" }, 38 { class: ".dynamicListComponent", name: "Dynamic List Component" }, 39 { class: ".forms", name: "Forms" }, 40 { class: ".genericCarousel", name: "Generic Carousal" }, 41 { class: ".headerLink", name: "Header Link" }, 42 { class: ".horizontalLine", name: "Horizontal Line" }, 43 { class: ".iconRibbon", name: "Icon Ribbon Component" }, 44 { class: ".image", name: "Image" }, 45 { class: ".leadershipGridComponent", name: "Leadership Grid" }, 46 { class: ".locationComponent", name: "Location Component" }, 47 { class: ".mediaContactDetails", name: "Media Contact Details" }, 48 { class: ".pageListComponent", name: "Page-List" }, 49 { class: ".pdfReader", name: "PDF Reader Component" }, 50 { class: ".searchComponent", name: "Search-List Component" }, 51 { class: ".sidebysideComponent", name: "Side by Side Component" }, 52 { class: ".socialShareLinks", name: "Social Share Links" }, 53 { class: ".steppedCarousel", name: "Stepped Carousel" }, 54 { class: ".stickySubNavigationComponent", name: "Sticky Subnavigation Component" }, 55 { class: ".stockTicker", name: "Stock Ticker Component" }, 56 { class: ".tableComponent", name: "Table Component" }, 57 { class: ".tabs", name: "Tabs" }, 58 { class: ".teaserComponent", name: "Teaser Component" }, 59 { class: ".testimonials", name: "Testimonials" }, 60 { class: ".vantagePoints", name: "Vantage Points" }, 61 { class: ".verticalSpace", name: "Vertical Space" }, 62 { class: ".video", name: "Video" }, 63 { class: ".footer", name: "Footer" }, 64 { class: ".header", name: "Header" }, 65 { class: ".secondaryNavigation", name: "Secondary Navigation component" }, 66 { class: ".cards", name: "Cards" }, 67 { class: ".embeddedQuote", name: "Embedded Quote" }, 68 { class: ".feature", name: "Feature" }, 69 { class: ".standard", name: "Standard" }, 70 { class: ".heroBanner", name: "New Banner" }, 71 { class: ".aboutusarticle", name: "About Us Article" }, 72 { class: ".aboutusdetails", name: "Container: Multi-Column" }, 73 { class: ".aboutushistory", name: "AboutUs History Component" }, 74 { class: ".articledate", name: "Date" }, 75 { class: ".articleinfo", name: "Article Info" }, 76 { class: ".articleTile", name: "3 Tiles" }, 77 { class: ".banner", name: "Banner" }, 78 { class: ".breadcrumb", name: "Breadcrumb" }, 79 { class: ".brightTalkVideo", name: "BrightTalk Video" }, 80 { class: ".carousel", name: "Carousel" }, 81 { class: ".contactus", name: "Contact Us" }, 82 { class: ".contactus-variations", name: "Button" }, 83 { class: ".contactusform", name: "Contact Us Form" }, 84 { class: ".documentdownload", name: "Document Download" }, 85 { class: ".bnymAgenda", name: "Agenda" }, 86 { class: ".bnymCarousel", name: "Event Carousel" }, 87 { class: ".eventsinfo", name: "Events Info" }, 88 { class: ".eventslist", name: "Events List" }, 89 { class: ".expedite", name: "Expedite" }, 90 { class: ".featuredinsights", name: "Featured Insights" }, 91 { class: ".featuredinsightsinfo", name: "Featured Insights Info" }, 92 { class: ".featuredtabs", name: "Featured Tabs"}, 93 { class: ".herobanner", name: "Hero Banner"}, 94 { class: ".homepagenewsinsights", name: "News & Insights"}, 95 { class: ".homepageteaser", name: "HomePage Teaser Component"}, 96 { class: ".horizontalcardlist", name: "Horizontal Card List"}, 97 { class: ".insightsteaser", name: "Insights Teaser"}, 98 { class: ".insightVideo", name: "Insight Video"}, 99 { class: ".latestnewsteaser", name: "Latest News Teaser"}, 100 { class: ".leadercardinfo", name: "Leaders Card Info"}, 101 { class: ".leadercardtitle", name: "Leader Card Title"}, 102 { class: ".leaderscardlist", name: "Leaders Card List"}, 103 { class: ".leaderscardlistprofile", name: "Leaders Card List Profile"}, 104 { class: ".locationdetails", name: "Location Details"}, 105 { class: ".locationlist", name: "Location List"}, 106 { class: ".podcastaudio", name: "Podcast Audio"}, 107 { class: ".profiledetails", name: "Profile Details"}, 108 { class: ".quote", name: "Quote"}, 109 { class: ".recommended-content-by-tags", name: "Recommended Content (by Tag)"}, 110 { class: ".relatedarticles", name: "Related Articles"}, 111 { class: ".relatedarticlesinfo", name: "Related Articles Info"}, 112 { class: ".side-by-side-container", name: "Container: Two-Column"}, 113 { class: ".slideShow", name: "Slide Show Component"}, 114 { class: ".socialicons", name: "Social Icons"}, 115 { class: ".socialsharing", name: "Social Share"}, 116 { class: ".solutionbanner", name: "Solution Banner"}, 117 { class: ".solutioncardlist", name: "Solution card Lists"}, 118 { class: ".teaserbanner", name: "Teaser: Banner Centered"}, 119 { class: ".accordion", name: "Accordion"}, 120 { class: ".baseteaser", name: "Teaser (v1)"}, 121 { class: ".bootstrap-modal", name: "Modal"}, 122 { class: ".button", name: "Button - Core"}, 123 { class: ".bythenumbers", name: "By the Numbers"}, 124 { class: ".contributor", name: "Contributor"}, 125 { class: ".download", name: "Download"}, 126 { class: ".dynamic-link", name: "Dynamic Link"}, 127 { class: ".image", name: "Image"}, 128 { class: ".inlineframe", name: "Inline Frame"}, 129 { class: ".list", name: "List - Advanced"}, 130 { class: ".list-core", name: "List"}, 131 { class: ".separator", name: "Divider"}, 132 { class: ".tabs", name: "Tabs"}, 133 { class: ".teaser", name: "Teaser - Core"}, 134 { class: ".text", name: "Text"}, 135 { class: ".resource", name: "Resource"}, 136 { class: ".horizontalSeparator", name: "Horizontal Separator"}, 137 { class: ".iconTileComponent", name: "Icon Tile Component"},
138 { class: ".keyHighlights", name: "Key Highlights"}, 139 { class: ".quotesComponent", name: "Quotes"}, 140 { class: ".rateList", name: "Rate List"}, 141 { class: ".textBanner", name: "Text"}, 142 { class: ".alertBanner", name: "Alert Banner"}, 143 { class: ".generalBanner", name: "General Banner"}, 144 { class: ".heroBannerV2", name: "Hero Banner V2"}, 145 { class: ".cefComponent", name: "CEF Component"}, 146 { class: ".iconCTA", name: "Icon CTA List"}, 147 { class: ".countryRoleSelectorDialog", name: "Country Role Selector Dialog"}, 148 { class: ".disclosureList", name: "Disclosure List"}, 149 { class: ".featuredTile", name: "Featured Tile"}, 150 { class: ".fundDetails", name: "Fund Details"}, 151 { class: ".fundsDocumentTable", name: "Funds Document Table"}, 152 { class: ".glossaryList", name: "Glossary List"}, 153 { class: ".modelPortfolio", name: "Model Portfolio"}, 154 { class: ".portfolioManager", name: "Portfolio Manager"}, 155 { class: ".socialshare", name: "Social Share"}, 156 { class: ".strategyDetails", name: "Strategy Details"}, 157 { class: ".tile1x1", name: "Tile 1x1"}, 158 { class: ".attestationForm", name: "Attestation Form"}, 159 { class: ".changepassword", name: "Change Password"}, 160 { class: ".consentForm", name: "Consent Form"}, 161 { class: ".forgotpassword", name: "Forgot Password"}, 162 { class: ".forgotpasswordconfirmation", name: "Forgot Password Confirmation"}, 163 { class: ".lionAccessRequestForm", name: "Lion Access Request Form"}, 164 { class: ".loggedin", name: "Logged In"}, 165 { class: ".logouthandler", name: "Logout Handler"}, 166 { class: ".marketeye-subscription", name: "Marketeye-Subscription"}, 167 { class: ".orderconfirmation", name: "Order Confirmation"}, 168 { class: ".profile", name: "Profile"}, 169 { class: ".registration", name: "Registration"}, 170 { class: ".resetpassword", name: "Reset Password"}, 171 { class: ".resetpasswordconfirmation", name: "Reset Password Confirmation"}, 172 { class: ".shippingaddressform", name: "Shipping address Form"}, 173 { class: ".subscriptions", name: "Subscriptions"}, 174 { class: ".verifyregistration", name: "Verify Registration"}, 175 { class: ".exploreFund", name: "Explore Fund"}, 176 { class: ".fundFilters", name: "Fund Filters"}, 177 { class: ".fundListing", name: "Fund Listing"}, 178 { class: ".watchList", name: "Watch List"}, 179 { class: ".yieldSheet", name: "Yield Sheet"}, 180 { class: ".accordionVariation", name: "Accordion Variation"}, 181 { class: ".bioList", name: "Bio List"}, 182 { class: ".containerInfoComponent", name: "Container Info Component"}, 183 { class: ".dateTargetVideo", name: "Date Target Video"}, 184 { class: ".ebook", name: "Ebook"}, 185 { class: ".footerDisclosure", name: "Footer Disclosure"}, 186 { class: ".icontext", name: "Icon Text"}, 187 { class: ".imcontainer", name: "IM container"}, 188 { class: ".newsroom", name: "Newsroom"}, 189 { class: ".onVideoComponent", name: "On Video Component"}, 190 { class: ".overlayCardContainer", name: "Overlay Card Container"}, 191 { class: ".pagebanner", name: "Page Banner"}, 192 { class: ".overlayCardLink", name: "Overlay Card Link"}, 193 { class: ".pershingSiteletTable", name: "Pershing Sitelet Table"}, 194 { class: ".predictiveFundSearch", name: "Predictive Fund Search"}, 195 { class: ".sitelet", name: "Sitelet"}, 196 { class: ".slider", name: "Slider"}, 197 { class: ".strategiesListing", name: "Strategies Listing"}, 198 { class: ".staticHtmlFile", name: "Static Html File"}, 199 { class: ".fundsGrid", name: "Funds Grid"}, 200 { class: ".modelPortfolioGrid", name: "Model Portfolio Grid"}, 201 { class: ".portfolioManagerGrid", name: "Portfolio Manager Grid"}, 202 { class: ".about_us_basic_component", name: "about us basic component"}, 203 { class: ".image_and_text_multicolumns", name: "image and text multicolumns"}, 204 { class: ".investment_firms_logos", name: "investment firms logos"}, 205 { class: ".scrolling_image", name: "scrolling image"}, 206 { class: ".cusipRedirect", name: "Cusip Redirect"}, 207 { class: ".documentTable", name: "Document Table"}, 208 { class: ".holidaySchedule", name: "Holiday Schedule"}, 209 { class: ".literatureCentre", name: "Literature Centre"}, 210 { class: ".tableComponent", name: "Table Component"}, 211 { class: ".disclosureText", name: "Disclosure Text"}, 212 { class: ".cardTile", name: "Card Tile"}, 213 { class: ".dreyfuscardTile", name: "Dreyfus card Tile"}, 214 { class: ".dreyfusTwoTile", name: "Dreyfus Two Tile"}, 215 { class: ".tileLayout", name: "Tile Layout"}, 216 { class: ".articlegridbypath", name: "Article Grid by Path"}, 217 { class: ".articlegridbytag", name: "Article Grid by Tag"}, 218 { class: ".articleInfographics", name: "Article Infographics"}, 219 { class: ".articlePreview", name: "Article Preview"}, 220 { class: ".articleRichTextBox", name: "Article Rich TextBox"}, 221 { class: ".tileArticleWithFilter", name: "Tile Article With Filter"}, 222 { class: ".announcementBanner", name: "Announcement Banner"}, 223 { class: ".carouselAnnouncement", name: "Carousel Announcement"}, 224 { class: ".videoHeroBanner", name: "Video Hero Banner"}, 225 { class: ".fundCenter", name: "Fund Center"}, 226 { class: ".fundWatchlist", name: "Fund Watchlist"}, 227 { class: ".accordionV2", name: "Accordion V2"}, 228 { class: ".biography", name: "Biography"}, 229 { class: ".circularInfoTile", name: "Circular Info Tile"}, 230 { class: ".contactMap", name: "Contact Map"}, 231 { class: ".contactUs", name: "Contact Us"}, 232 { class: ".contactUsMap", name: "Contact-Us Map"}, 233 { class: ".featureCards", name: "Feature Cards"}, 234 { class: ".fundDICITable", name: "Fund DICI Table"}, 235 { class: ".gifWithInfo", name: "Gif With Info"}, 236 { class: ".globalAboutUs", name: "Global About-Us"}, 237 { class: ".ifmhFeatures", name: "IFMH Features"}, 238 { class: ".imageMulticolumns", name: "Image Multicolumns"}, 239 { class: ".investment_firms_logos", name: "investment_firms_logos"}, 240 { class: ".labellink", name: "Label Link"}, 241 { class: ".landingPage", name: "Landing Page"}, 242 { class: ".multiAlignmentButton", name: "Multi Alignment Button"}, 243 { class: ".pageLoadPopup", name: "Page Load Popup"}, 244 { class: ".pdfReader", name: "Pdf Reader"}, 245 { class: ".quoteTileSlider", name: "Quote Tile Slider"}, 246 { class: ".responsibleImageText", name: "Responsible Image Text"}, 247 { class: ".ribbon", name: "Ribbon"}, 248 { class: ".scrolling_image", name: "Scrolling Image"}, 249 { class: ".staticModalTiles", name: "Static Modal Tiles"},
250 { class: ".staticTile", name: "Static Tile"}, 251 { class: ".subscriptSuperscript", name: "Subscript Superscript"}, 252 { class: ".titleDescriptionButton", name: "Title Description Button"}, 253 { class: ".vidyardVideo", name: "Vidyard Video"}, 254 { class: ".fundTile", name: "Fund Tile"}, 255 { class: ".ifmhVideoTile", name: "IFMH Video Tile"}, 256 { class: ".insightTile", name: "Insight Tile"}, 257 { class: ".notificationTile", name: "Notification Tile"}, 258 { class: ".tileWithDetails", name: "Tile With Details"}, 259 { class: ".tileWithLink", name: "Tile With Link"}, 260 { class: ".tileWithModal", name: "Tile With Modal"}, 261 { class: ".fundBannerComponent", name: "Fund Banner Component"}, 262 { class: ".fundSecondaryBannerComponent", name: "Fund Secondary Banner Component"}, 263 { class: ".heroBannerComponent", name: "Hero Banner Component"}, 264 { class: ".primaryBannerComponent", name: "Primary Banner Component"}, 265 { class: ".secondaryBannerComponent", name: "Secondary Banner Component"}, 266 { class: ".bubbleChartComponent", name: "Bubble Chart Component"}, 267 { class: ".pieChartComponent", name: "Pie Chart Component"}, 268 { class: ".pieCircle", name: "Pie Circle"}, 269 { class: ".announcementComponent", name: "Announcement Component"}, 270 { class: ".articleGridComponent", name: "Article Grid Component"}, 271 { class: ".articlesCarouselComponent", name: "Articles Carousel Component"}, 272 { class: ".capabilitiesImageTileComponent", name: "Capabilities Image Tile Component"}, 273 { class: ".contactUsComponent", name: "Contact Us Component"}, 274 { class: ".downloadDocumentComponent", name: "Download Document Component"}, 275 { class: ".eventBannerComponent", name: "Event Banner Component"}, 276 { class: ".eventGridComponent", name: "Event Grid Component"}, 277 { class: ".eventTileComponent", name: "Event Tile Component"}, 278 { class: ".exploreMoreLinksComponent", name: "Explore More Links Component"}, 279 { class: ".exploreOurCapabilitiesComponent", name: "Explore Our Capabilities Component"}, 280 { class: ".featuredArticlesListComponent", name: "Featured Articles List Component"}, 281 { class: ".findLocalContactComponent", name: "Find Local Contact Component"}, 282 { class: ".firmGoalAUMComponent", name: "Firm Goal AUM Component"}, 283 { class: ".fundLiteratureListComponent", name: "Fund Literature List Component"}, 284 { class: ".fundRangeComponent", name: "Fund Range Component"}, 285 { class: ".imageAndTextComponent", name: "Image And Text Component"}, 286 { class: ".imageTabComponent", name: "Image Tab Component"}, 287 { class: ".inthePressComponent", name: "In The Press Component"}, 288 { class: ".keyPointsComponent", name: "Key Points Component"}, 289 { class: ".keyTopicsComponent", name: "Key Topics Component"}, 290 { class: ".mediaContactsComponent", name: "Media Contacts Component"}, 291 { class: ".meetTheTeamComponent", name: "Meet The Team Component"}, 292 { class: ".multiQuotesComponent", name: "Multi Quotes Component"}, 293 { class: ".ourFirmsComponent", name: "Our Firms Component"}, 294 { class: ".pageAssetCarouselComponent", name: "Page Asset Carousel Component"}, 295 { class: ".portfolioToolComponent", name: "Portfolio Tool Component"}, 296 { class: ".pressReleaseComponent", name: "Press Release Component"}, 297 { class: ".profileCarousel", name: "Profile Carousel"}, 298 { class: ".quotesComponent", name: "Quotes Component"}, 299 { class: ".relatedLinksComponent", name: "Related Links Component"}, 300 { class: ".researchAEMComponent", name: "Research AEM Component"}, 301 { class: ".textAndCtaComponent", name: "Text And Cta Component"}, 302 { class: ".textCarouselComponent", name: "Text Carousel Component"}, 303 { class: ".textColumnComponent", name: "Text Column Component"}, 304 { class: ".textTabComponent", name: "Text Tab Component"}, 305 { class: ".videoCarouselComponent", name: "Video Carousel Component"}, 306 { class: ".videoHighlightsComponent", name: "Video Highlights Component"}, 307 { class: ".videoTextComponent", name: "Video Text Component"}, 308 { class: ".investmentFirmsComponent", name: "Investment Firms Component"}, 309 { class: ".quoteSecondaryNavigationComponent", name: "Quote Secondary Navigation Component"}, 310 { class: ".relativeSentenceSecondaryNavigationComponent", name: "Relative Sentence Secondary Navigation Component"}, 311 { class: ".secondaryHeaderComponent", name: "Secondary Header Component"}, 312 { class: ".textSecondaryNavigationComponent", name: "Text Secondary Navigation Component"}, 313 { class: ".imageListComponent", name: "Image List Component"}, 314 { class: ".mapComponent", name: "Map Component"}, 315 { class: ".headerComponent", name: "Header Component"}, 316 { class: ".footerComponent", name: "Footer Component"}, 317 { class: ".imageBanner", name: "Image Banner"}, 318 { class: ".textBannerSingleTile", name: "Text Banner Single Tile"}, 319 { class: ".textBannerTwoTile", name: "Text Banner Two Tile"}, 320 { class: ".capabilityCard", name: "Capability Card"}, 321 { class: ".locationCards", name: "Location Cards"}, 322 { class: ".mediaContactCards", name: "Media Contact Cards"}, 323 { class: ".reletedAssetComponent", name: "Releted Asset Component"}, 324 { class: ".brightTalkVideo", name: "Bright Talk Video"}, 325 { class: ".insightContent", name: "Insight Content"}, 326 { class: ".insightDownload", name: "Insight Download"}, 327 { class: ".insightVideo", name: "Insight Video"}, 328 { class: ".relatedInsight", name: "Related Insight"}, 329 { class: ".secondaryAuthors", name: "Secondary Authors"}, 330 { class: ".capabilityTiles", name: "Capability Tiles"}, 331 { class: ".cardTile", name: "Card Tile"}, 332 { class: ".ctaTile", name: "CTA Tile"}, 333 { class: ".insightTiles", name: "Insight Tiles"}, 334 { class: ".strategyTiles", name: "Strategy Tiles"}, 335 { class: ".clientLogin", name: "Client Login"}, 336 { class: ".dataList", name: "Data List"}, 337 { class: ".errorBlock", name: "Error Block"}, 338 { class: ".featuredArticleList", name: "Featured Article List"}, 339 { class: ".infographic", name: "Infographic"}, 340 { class: ".infographicThreeImage", name: "Infographic Three Image"}, 341 { class: ".leadershipPortlet", name: "Leadership Portlet"}, 342 { class: ".onVideoComponent", name: "ON Video Component"}, 343 { class: ".subNavPortlet", name: "Sub Nav Portlet"}, 344 { class: ".verticalSpace", name: "Vertical Space"}, 345 { class: ".webContentPortlet", name: "Web Content Portlet"} 346 347 ]; 348 349 function getlinkCategory(element) { 350 for (j = 0; j < componentList.length; j++) { 351 if (element.closest(componentList[j].class)) return componentList[j].name; 352 } 353 return "AEM Component"; 354 } 355 356 let allAtags = document.body.getElementsByTagName("a"); 357 for (i = 0; i < allAtags.length; i++) { 358 let aNode = allAtags[i]; 359 if(!aNode.getAttribute('data-cmp-data-layer')){ 360 let linkCategory = aNode.getAttribute("data-linkCategory") || getlinkCategory(aNode); 361 let linkHref = aNode.getAttribute("href") || "#"; 362 let linkLocation = aNode.getAttribute("data-linkLocation") || ""; 363 let linkText = aNode.getAttribute("data-linkText") || aNode.textContent.replace(/\s\s+/g,' '); 364 if(linkCategory == "CTA Component") { 365 if (aNode.querySelector("i.material-icons")) { 366 linkText = aNode.querySelector("i.material-icons").textContent.trim(); 367 } 368 } 369 370 /*Cleaning Text*/ 371 var sanitizedLinkText = linkText.replaceAll("keyboard_arrow_down", "").replaceAll("arrow_forward", "").replaceAll("launch", "").replaceAll(/®/g, '').replaceAll(/™/g, '').replaceAll(/℠/g, '').trim(); 372 linkText = sanitizedLinkText || linkText; 373 let attrDataLayer = 374 "{"event":"cmp:click","linkCategory":"" + 375 linkCategory + 376 "","linkText":"" + 377 linkText + 378 "","linkLocation":"" + 379 linkLocation + 380 "","linkHref":"" + 381 linkHref + 382 "","custom":"true"}"; 383 aNode.setAttribute("data-cmp-data-layer", attrDataLayer); 384 aNode.setAttribute("data-cmp-clickable","true"); 385 } 386 } 387 let allButtons = document.body.getElementsByTagName("button"); 388 for (i = 0; i < allButtons.length; i++) { 389 let bNode = allButtons[i]; 390 if(!bNode.getAttribute('data-cmp-data-layer')){ 391 let linkCategory = bNode.getAttribute("data-linkCategory") || getlinkCategory(bNode); 392 let onclickAttr = bNode.getAttribute("onclick") || "Button Click"; 393 394 let linkHref = "Button Click"; 395 396 let urlMatch = onclickAttr.match(/window\.open\s*\(\s*'([^']+)'/); 397 if (urlMatch && urlMatch[1]) { 398 linkHref = urlMatch[1]; 399 } 400 401 let linkLocation = bNode.getAttribute("data-linkLocation") || ""; 402 let linkText = bNode.getAttribute("data-linkText") || bNode.textContent.trim() || bNode.getAttribute("class") || linkHref; 403 404 /*Cleaning Text*/ 405 linkText = linkText.replaceAll("keyboard_arrow_down", "").replaceAll("arrow_forward", "").replaceAll("launch", "").trim(); 406 407 let attrDataLayer = 408 "{"event":"cmp:click","linkCategory":"" + 409 linkCategory + 410 "","linkText":"" + 411 linkText + 412 "","linkLocation":"" + 413 linkLocation + 414 "","linkHref":"" + 415 linkHref + 416 "","custom":"true"}"; 417 bNode.setAttribute("data-cmp-data-layer", attrDataLayer); 418 bNode.setAttribute("data-cmp-clickable","true"); 419 } 420 } 421 422 const playButton = document.querySelector(".heroBanner .play-button"); 423 $(playButton).click(function () { 424 var linkText = $(playButton).attr("data-linktext"); 425 426 let linkCategory = $(this).attr("data-linkCategory") || getlinkCategory(this); 427 let onclickAttr = $(this).attr("onclick") || "Button Click"; 428 429 let linkHref = "Button Click"; 430 431 let urlMatch = onclickAttr.match(/window\.open\s*\(\s*'([^']+)'/); 432 if (urlMatch && urlMatch[1]) { 433 linkHref = urlMatch[1]; 434 } 435 436 let linkLocation = $(this).attr("data-linkLocation") || ""; 437 438 let attrDataLayer = ""; 439 if (linkText === "pause") { 440 let linkText = "pause"; 441 442 attrDataLayer = 443 "{"event":"cmp:click","linkCategory":"" + 444 linkCategory + 445 "","linkText":"" + 446 linkText + 447 "","linkLocation":"" + 448 linkLocation + 449 "","linkHref":"" + 450 linkHref + 451 "","custom":"true"}"; 452 } else if (linkText === "play") { 453 let linkText = "play"; 454 455 attrDataLayer = 456 "{"event":"cmp:click","linkCategory":"" + 457 linkCategory + 458 "","linkText":"" + 459 linkText + 460 "","linkLocation":"" + 461 linkLocation + 462 "","linkHref":"" + 463 linkHref + 464 "","custom":"true"}"; 465 } 466 467 $(this).attr("data-cmp-data-layer", attrDataLayer); 468 $(this).attr("data-cmp-clickable", "true"); 469 }); 470 471} 472window.addEventListener("DOMContentLoaded", applyDataLayer); 473 474 475"use strict"; 476 477//--- Global namespace bnyDataLayerApp -------------------------------- 478window.bnyDataLayerApp = window.bnyDataLayerApp || {}; 479 480//--- classnames for third parties ------------------- 481bnyDataLayerApp.bny_api_class = ".bny_api_link, .bny_api_button, .bny_api_checkbox, .bny_api_radio, .bny_api_click, .bny_disclaimer_modal, .bny_api_filter"; 482
483//--- bny internal class name, but not tracked by 'data-cmp-data-layer' (e.g. IM login/register buttons) 484bnyDataLayerApp.bny_internal_class = ".personalization-nav__trigger--login"; 485 486//----dataLayerObj --------------------------------- 487window.adobeDataLayer = window.adobeDataLayer || []; 488 489//----bny_getHostDomain --------------------------------- 490bnyDataLayerApp.bny_getHostDomain = function(urlparam, subdomainparam) { 491 let subdomain = subdomainparam || false; 492 let url = urlparam.replace(/(https?:\/\/)?(www.)?/i, ''); 493 494 if (!subdomain) { 495 url = url.split('.'); 496 url = url.slice(url.length - 2).join('.'); 497 } 498 499 if (url.indexOf('/') !== -1) { 500 return url.split('/')[0]; 501 } 502 503 return url; 504} 505 506//check if jQuery has been loaded 507bnyDataLayerApp.isjQueryLoaded = function() { 508 return new Promise(resolve => { 509 const nTimer = setInterval(() => { 510 if (window.jQuery) { 511 clearInterval(nTimer); 512 resolve(); 513 } 514 }, 300); 515 }); 516}; 517 518//----main function --------------------------------- 519(function(bnyDataLayerApp) { 520 let isContentLoaded = false; 521 522 function dataLayerMain() { 523 //--- CHECK AND SET, in case dataLayerObj was not presented on the page template --------------------------------- 524 if (typeof dataLayerObj == "object") { 525 526 dataLayerObj.form = {}; 527 bnyDataLayerApp.dataLayerObj = dataLayerObj; 528 529 } else { 530 //in case for some resons, there's no dataLayerObj 531 const local_dataLayerObj = { 532 "org": "bny", 533 "businessUnit": "corporate", 534 "page_name": "", 535 "site_section": "", 536 "site_section_L2": "", 537 "site_section_L3": "", 538 "site_section_L4": "", 539 "page_type": "", 540 "page_tags": "", 541 "is404": "", 542 "region": "", 543 "lang": "", 544 "publish_date": "", 545 "authors": "" 546 }; 547 local_dataLayerObj.form = {}; 548 bnyDataLayerApp.dataLayerObj = local_dataLayerObj; 549 } 550 551 const DLobj = bnyDataLayerApp.dataLayerObj; 552 553 //--------Set dataLayer default value--------------------------------- 554 555 const menuIcon = document.querySelector('.navbar-toggler'); //none should be desktop 556 const menuIconMellon = document.querySelector('.mellonpublic-header .hamburger'); //www.mellon.com 557 let experienceType = ""; 558 559 if (menuIcon) { 560 experienceType = getComputedStyle(menuIcon).getPropertyValue('display') == "none" ? "desktop" : "mobile"; 561 } else if (menuIconMellon) { 562 563 experienceType = getComputedStyle(menuIconMellon).getPropertyValue('display') == "none" ? "desktop" : "mobile"; 564 } else { 565 // 5/29/2025 - media queries to detect bnyadvisormatch.com Desktop/Mobile view 566 //@media (min-width: 992px) {.bnyadvisormatch-sidebysideComponent .sidebySide2Column ... 567 568 const mediaQuery = window.matchMedia('(min-width: 992px)'); 569 if (mediaQuery.matches) { 570 experienceType = "desktop"; 571 } else { 572 experienceType = "mobile"; 573 } 574 } 575 576 /*const _thebankofnewyorkmelloncorp = { 577 'lang': DLobj.lang, 578 'pageType': DLobj.page_type, 579 'region': DLobj.region, 580 'siteSection1': DLobj.site_section, 581 'siteSection2': DLobj.site_section_L2, 582 'siteSection3': DLobj.site_section_L3, 583 'siteSection4': DLobj.site_section_L4 584 } 585 586 //for webPageDetails 587 const webPageDetailsObj = { 588 'businessUnit': DLobj.businessUnit, 589 'org': DLobj.org, 590 'experienceType': experienceType, 591 'pageName': DLobj.page_name, 592 'previousPageName': '', 593 'is404': false, 594 '_thebankofnewyorkmelloncorp': _thebankofnewyorkmelloncorp 595 } 596 597 bnyDataLayerApp.webPageDetailsObj = webPageDetailsObj;*/ 598 599 /*const pageModalObj = { 600 'isModal': false, 601 'modalName': null 602 }; 603 604 bnyDataLayerApp.pageModalObj = pageModalObj;*/ 605 606 //-----------------------------Page loaded object --------------------------------------------------------------- 607 608 const pageLoadedObj = { 609 'event': 'pageLoaded', 610 'xdm': { 611 'eventType': 'pageView', 612 'marketing': { 613 'trackingCode': '' 614 }, 615 'web': { 616 'webPageDetails': { 617 'businessUnit': DLobj.businessUnit, 618 'org': DLobj.org, 619 'experienceType': experienceType, 620 'pageName': DLobj.page_name, 621 'previousPageName': '', 622 'is404': DLobj.is404.toLowerCase() == 'true' ? true : false, 623 '_thebankofnewyorkmelloncorp': { 624 'lang': DLobj.lang, 625 'pageType': DLobj.page_type, 626 'region': DLobj.region, 627 'siteSection1': DLobj.site_section, 628 'siteSection2': DLobj.site_section_L2, 629 'siteSection3': DLobj.site_section_L3, 630 'siteSection4': DLobj.site_section_L4, 631 'pageTags': DLobj.page_tags, 632 'publishDate': DLobj.publish_date ? DLobj.publish_date : "", 633 'authors': DLobj.authors 634 } 635 } 636 } 637 } 638 } 639 640 bnyDataLayerApp.pageLoadedObj = pageLoadedObj; 641 642 //-----------------------------Click event object ----------------------------------------------------------------- 643 const ctaClickObj = { 644 'event': 'click', 645 'xdm': { 646 'eventType': 'ctaClick', 647 'web': { 648 'webInteraction': { 649 'linkHref': '', 650 'linkLocation': '', 651 'linkName': '', 652 'linkText': '', 653 '_thebankofnewyorkmelloncorp': { 654 'linkCategory': '', 655 'isExitLink': false, 656 'linkQuestion': '', 657 'linkAnswer': '', 658 'isModal': false, 659 'modalName': null 660 } 661 } 662 } 663 } 664 } 665 666 bnyDataLayerApp.ctaClickObj = ctaClickObj; 667 668 //-----------------------------Click event object (download) not being used. using ctaClickObj ------------------------------------------------------- 669 670 /*const ctaFileDownloadObj = { 671 'event': "click", 672 'xdm': { 673 'eventType': 'fileDownload', 674 'web': { 675 'webInteraction': { 676 'linkHref': "", 677 'linkLocation': "", 678 'linkName': "", 679 'linkText': "", 680 '_thebankofnewyorkmelloncorp': { 681 'downloadedFile': "", 682 'downloadedFileType': "", 683 'linkCategory': "", 684 'isExitLink': false 685 } 686 } 687 } 688 } 689 } 690 691 bnyDataLayerApp.ctaFileDownloadObj = ctaFileDownloadObj;*/ 692 693 //--- pageLoaded ---------------------------------------- 694 function initCmpShow() {
695 const copyPageLoadedObj = structuredClone(pageLoadedObj); //deep copy pageLoadedObj 696 697 let prevPageName = sessionStorage.getItem('prevPageName'); //get prevPageName 698 const pageName = copyPageLoadedObj.xdm.web.webPageDetails.pageName; //get current pageName 699 700 prevPageName = prevPageName == pageName ? "" : prevPageName; //compare if same 701 copyPageLoadedObj.xdm.web.webPageDetails.previousPageName = prevPageName; //set previousPageName 702 703 copyPageLoadedObj.xdm.marketing.trackingCode = getCIDTrackingCode(); //2026-04-22, add CID trackingCode to xdm. 704 705 window.adobeDataLayer.push( 706 copyPageLoadedObj 707 ); 708 709 checkDianomiRules('pageName', pageName); 710 711 } 712 713 //--- check and fire for isModal and modalName---------------------------------------- 714 async function modalTracking() { 715 const copyCtaClickObj = structuredClone(ctaClickObj); //deep copy ctaClickObj 716 717 //------ Investments Country Dialog tracking---------------------------------------- 718 let IMCountryDialogPromise = new Promise(function(resolve) { 719 setTimeout(() => { 720 const investmentsIndex = location.pathname.indexOf('/investments/'); 721 let countryDialogOpen = false; 722 723 if (investmentsIndex !== -1) { 724 725 //https://www.bny.com/investments/ca/en/index.html dialog NOT open 8/22/2025 726 //https://www.bny.com/investments/uk/en/intermediary.html dialog open 727 728 const countryDialogEl = document.getElementById('country-dialog'); 729 if (countryDialogEl != null) { 730 //var hasDialog = countryDialog.classList.contains('full-screen'); 731 countryDialogOpen = countryDialogEl.getAttribute('open') == null ? false : true; 732 } 733 } 734 resolve(countryDialogOpen); 735 }, 3000); //---wait 3 seconds, due to country dialog modal rendering after DOM loaded. 736 }); 737 738 if (await IMCountryDialogPromise) { 739 copyCtaClickObj.xdm.web.webInteraction._thebankofnewyorkmelloncorp.isModal = true; 740 copyCtaClickObj.xdm.web.webInteraction._thebankofnewyorkmelloncorp.modalName = "investment country dialog"; 741 742 window.adobeDataLayer.push( 743 copyCtaClickObj 744 ); 745 } 746 } 747 748 //----------- Get CID tracking code 4/21/2026. Add CID trackingCode to dataLayer ------------------------------ 749 750 function getCIDTrackingCode() { 751 const url = new URL(window.location.href); 752 const cid = url.searchParams.get("cid"); 753 754 //if query string contains CID 755 if (cid) { 756 return cid; 757 758 } else { //get it from localStorage 759 const restored_cid_query = JSON.parse(localStorage['bny_cid_query'] || '""'); 760 const queryStr = restored_cid_query.query; 761 const urlParams = new URLSearchParams(queryStr); 762 return urlParams.get('cid'); 763 } 764 } 765 766 //---carousel component--------------------------------- 767 function getCarouselData(element) { 768 const slickIndex = element.closest('.slick-slide')?.dataset?.slickIndex ?? ''; 769 return { 770 slickIndex: slickIndex 771 }; 772 } 773 774 //---project-wonderful carousel component--------------------------------- 775 function getCarouselDataProjectWonderful(element) { 776 const slickIndex = element.closest('.carousel-content')?.dataset?.slickIndex ?? ''; 777 return { 778 slickIndex: slickIndex 779 }; 780 } 781 782 //-- Carousel new location and link text 783 //https://uat.bny.com/corporate/global/en/project-wonderful/Home-page.html# 784 785 //---accordion component--------------------------------- 786 function getAccordionData(element) { 787 const expanded = element.className.includes("cmp-accordion__button--expanded"); 788 return expanded == true ? "open" : "close"; 789 } 790 791 //----------- Check Exit Link ---------------------------------------------- 792 function checkExitLink(href) { 793 const baseURL = 'https://www.bny.com'; 794 const domain = new URL(href, baseURL); 795 796 //---exit_domains--------------------------------- 797 798 const internal_exit_domains = /(jobs\.bnymellon\.com)|(connect\.bnymellon\.com)|(liquiditydirect\.bnymellon\.com)|(news\.bnymellon\.com)|(im\.bnymellon\.com)/i; 799 800 const internal_exit_new_domains = /(jobs\.bny\.com)|(connect\.bny\.com)|(liquiditydirect\.bny\.com)|(news\.bny\.com)|(im\.bny\.com)/i; 801 const internal_domains = /bnymellon\.com|bny\.com|cphostaccess\.com|adobecqms\.net/i; 802 803 return ( 804 internal_exit_domains.test(domain.hostname) || 805 internal_exit_new_domains.test(domain.hostname) || 806 !internal_domains.test(domain.hostname) 807 ); 808 } 809 810 function remove_linebreaks_spacing(dataLayerJson) { 811 return dataLayerJson.replace(/[\r\n]+/gm, "").replace(/\s+/g, " "); 812 } 813 814 function htmlDecode(input) { 815 var doc = new DOMParser().parseFromString(input, "text/html"); 816 return doc.documentElement.textContent; 817 } 818 819 //---get links attributes dataset information--------------------------------- 820 function getComponentData(element) { 821 let dataLayerJson = element.dataset.cmpDataLayer; 822 if (dataLayerJson) { 823 dataLayerJson = remove_linebreaks_spacing(dataLayerJson); 824 return JSON.parse(htmlDecode(dataLayerJson)); 825 } else { 826 return undefined; 827 } 828 } 829
830 function checkElementNotToFire(eleClassName, eleID, element) { 831 //Don't push if the buttons/a tags are from Marketo form, search, etc., we have specified event for that 832 let shouldPush = true; 833 834 const notToFireEle = ['mktoButton', 'search-toggle', 'search-clear', 'newton-search-button']; 835 836 for (let i = 0; i < notToFireEle.length; i++) { 837 if (notToFireEle[i] == eleClassName || notToFireEle[i] == eleID) { 838 shouldPush = false; 839 } 840 } 841 842 if (element && element.attributes && element.attributes.type && element.attributes.type.value) { 843 if (element.attributes.type.value == "submit") { 844 shouldPush = false; 845 } 846 } 847 848 return shouldPush; 849 } 850 851 //---click event data layer push--------------------------------- 852 function addClickToDataLayer(event) { 853 const element = event; //event.currentTarget; 854 const component = getComponentData(element); 855 if (!component) return; // bail out if no JSON blob - Carousel next/prev buttons don't have cmp-data-layer attribute, so it wont fire twice. 856 /*9/24/2025 commented out custom Attr, ajax mockup wont have this plus its checking all elements. */ 857 const isCustomDataLayer = true; //component.custom == 'true' ? true : false; 858 const eleClassName = element.className; 859 const eleID = element.id; 860 const tagName = element.tagName; 861 //const linkedin = "https://linkedin.com/company/bnyglobal"; //siteLeavingPopupModal 862 const copyCtaClickObj = structuredClone(ctaClickObj); //deep copy ctaClickObj 863 864 if (isCustomDataLayer) { 865 if (component.linkCategory == "Carousel Component") { 866 component.linkLocation = getCarouselData(element).slickIndex; 867 } else if (component.linkCategory == "Accordion") { 868 component.linkLocation = getAccordionData(element); 869 } else if (component.linkCategory.toLowerCase().indexOf("carousel") > -1) { 870 /*---- project-wonderful Carousel indexOf--*/ 871 component.linkLocation = getCarouselDataProjectWonderful(element).slickIndex; 872 } 873 874 /*---- Header Navigation Logo --*/ 875 if (eleClassName.indexOf("navbar-brand") > -1) { 876 component.linkText = "navbar logo"; 877 } 878 879 const isExitLink = checkExitLink(component.linkHref); 880 881 const matchedFile = component.linkHref.match(/([^\\\/]+\.pdf)|([^\\\/]+\.docx)|([^\\\/]+\.doc)|([^\\\/]+\.txt)|([^\\\/]+\.xls)|([^\\\/]+\.xlsx)|([^\\\/]+\.zip)|([^\\\/]+\.csv)|([^\\\/]+\.ppt)|([^\\\/]+\.pptx)/); 882 883 const downloadedFile = matchedFile ? matchedFile[0] : null; 884 let downloadedFileType = null; 885 886 const linkObj = { 887 linkText: component.linkText, 888 linkLocation: component.linkLocation, 889 linkName: component.linkCategory + ':' + component.linkText, 890 linkHref: component.linkHref, 891 _thebankofnewyorkmelloncorp: { 892 linkCategory: component.linkCategory, 893 isExitLink: isExitLink 894 } 895 } 896 897 if (downloadedFile) { //for downloadedFile click event 898 downloadedFileType = downloadedFile.substring(downloadedFile.lastIndexOf('.') + 1, downloadedFile.length) || ''; 899 linkObj._thebankofnewyorkmelloncorp.downloadedFile = downloadedFile; 900 linkObj._thebankofnewyorkmelloncorp.downloadedFileType = downloadedFileType; 901 copyCtaClickObj.xdm.eventType = 'fileDownload'; 902 } 903 904 /*---- Social icons siteLeavingPopupModal --*/ 905 if (eleClassName.indexOf("siteLeavingPopupModal") > -1) { 906 linkObj._thebankofnewyorkmelloncorp.isExitLink = false;
907 } else if (eleClassName.indexOf("leavePage") > -1) { 908 linkObj._thebankofnewyorkmelloncorp.isExitLink = true; 909 } else if (eleClassName.indexOf("stayPage") > -1) { 910 linkObj._thebankofnewyorkmelloncorp.isExitLink = false; 911 } 912 913 //clearn object 914 const shouldPush = checkElementNotToFire(eleClassName, eleID, element); 915 916 if (shouldPush) { 917 copyCtaClickObj.xdm.web.webInteraction = linkObj; 918 919 window.adobeDataLayer.push( 920 copyCtaClickObj 921 ); 922 } 923 } 924 } 925 926 //---- track all links ----------------- 927 function linksTracking() { 928 929 function excludeElement(ele) { 930 let excludeClass = bnyDataLayerApp.bny_api_class; 931 excludeClass = excludeClass.replace(/\s+/g, "").replace(/\./g, ""); 932 excludeClass = excludeClass.split(','); 933 934 let eleClassName = ele.className; 935 eleClassName = eleClassName.split(' '); 936 937 return excludeClass.some(r => eleClassName.includes(r)); 938 } 939 940 document.addEventListener('click', function(evt) { 941 const a = evt.target.closest('a'); 942 if (a) { 943 if (!excludeElement(a) && a.hasAttribute('data-cmp-data-layer')) { 944 addClickToDataLayer(a); 945 } else { 946 carouselTracking(a); 947 948 } 949 } 950 951 const btn = evt.target.closest('button'); 952 if (btn) { 953 if (!excludeElement(btn) && btn.hasAttribute('data-cmp-data-layer')) { 954 addClickToDataLayer(btn); 955 } else { 956 carouselTracking(btn); 957 } 958 } 959 }, true); 960 961 } 962 963 //---- carouselBtn push ----------------- 964 function carouselBtn(action, linkCategory, id) { 965 const copyCtaClickObj = structuredClone(ctaClickObj); //deep copy ctaClickObj 966 967 const linkObj = { 968 linkText: action, 969 linkLocation: id ? id : '', 970 linkName: linkCategory + ':' + action, 971 linkHref: '', 972 _thebankofnewyorkmelloncorp: { 973 linkCategory: linkCategory, 974 isExitLink: false 975 } 976 } 977 978 copyCtaClickObj.xdm.web.webInteraction = linkObj; 979 980 window.adobeDataLayer.push( 981 copyCtaClickObj 982 ); 983 } 984 985 //---- Carousel Tracking ----------------- 986 function carouselTracking(nav) { 987 if ($(nav).is(".carousel .slick-next, .carousel .nextButton, .genericCarousel .nextButton, .cardCarousel .nextButton, .carouselInitContainer .nextButton")) { 988 const linkCategory = $(nav).dataset?.linkCategory ?? 'carousel'; 989 carouselBtn('next', linkCategory); 990 } 991 992 if ($(nav).is(".carousel .slick-prev, .carousel .backButton, .genericCarousel .backButton, .cardCarousel .backButton, .carouselInitContainer .backButton")) { 993 const linkCategory = $(nav).dataset?.linkCategory ?? 'carousel'; 994 carouselBtn('prev', linkCategory); 995 } 996 997 if ($(nav).is(".carousel .slick-dots button, .genericCarousel .slick-dots button, .cardCarousel .slick-dots button, .carouselInitContainer .slick-dots button")) { 998 const linkCategory = $(nav).dataset?.linkCategory ?? 'carousel'; 999 carouselBtn('dots', linkCategory, nav.id); 1000 } 1001 } 1002 1003 //------------- search form --------------- 1004 function searchFormTracking() { 1005 function searchFormFn(searchText) { 1006 const copyCtaClickObj = structuredClone(ctaClickObj); //deep copy ctaClickObj 1007 1008 const linkObj = { 1009 linkText: '', 1010 linkLocation: '', 1011 linkName: 'search form:' + searchText, 1012 linkHref: '', 1013 _thebankofnewyorkmelloncorp: { 1014 linkCategory: 'search form', 1015 searchText: searchText, 1016 isExitLink: false 1017 } 1018 } 1019 1020 copyCtaClickObj.xdm.web.webInteraction = linkObj; 1021 copyCtaClickObj.xdm.eventType = 'search'; 1022 1023 window.adobeDataLayer.push( 1024 copyCtaClickObj 1025 ); 1026 } 1027 1028 const searchForm = document.getElementById("searchForm"); //search element 1029 const searchFormMellon = document.getElementsByClassName("mellon-nav-search")[0]; //search element mellon.com 1030 const searchFormNewton = document.getElementById("newton-search-form"); //search element newton 1031 1032 if (searchForm) { 1033 searchForm.addEventListener("submit", function(event) { 1034 let searchText = document.getElementById('siteSearch').value; 1035 searchFormFn(searchText); 1036 }); 1037 } else if (searchFormMellon) { 1038 searchFormMellon.addEventListener("submit", function(event) { 1039 let searchText = searchFormMellon.getElementsByClassName('form-control')[0].value; 1040 searchFormFn(searchText); 1041 }); 1042 } else if (searchFormNewton) { 1043 searchFormNewton.addEventListener("submit", function(event) { 1044 let searchText = document.getElementById('search_val').value; 1045 searchFormFn(searchText); 1046 }); 1047 } 1048 } 1049 1050 //------------ vidyard Embed Videos ------------------------------------------------------------ 1051 function vidyardTracking() { 1052 function sendToThirdParty2(playerUuid, chapterTitle, percentProgress, videoName, videoLength) { 1053 console.log('addReadyListener : ' + playerUuid + ' % progres: ' + percentProgress); 1054 //https://www.bny.com/corporate/global/en/careers/students/internship-program.html 1055 1056 let playProgress = ""; 1057 1058 if (percentProgress == 1) { 1059 playProgress = "video:play" 1060 } else if (percentProgress == 25) { 1061 playProgress = "video:play:25" 1062 } else if (percentProgress == 50) { 1063 playProgress = "video:play:50" 1064 } else if (percentProgress == 75) { 1065 playProgress = "video:play:75" 1066 } else if (percentProgress == 95) { 1067 playProgress = "video:completed" 1068 } 1069 1070 const copyCtaClickObj = structuredClone(ctaClickObj); //deep copy ctaClickObj 1071 1072 const linkObj = { 1073 linkText: '', 1074 linkLocation: playProgress, 1075 linkName: videoName, 1076 linkHref: playerUuid, 1077 _thebankofnewyorkmelloncorp: { 1078 linkCategory: 'VidyardVideo', 1079 isExitLink: false 1080 } 1081 } 1082 1083 copyCtaClickObj.xdm.web.webInteraction = linkObj; 1084 copyCtaClickObj.xdm.eventType = playProgress; //clean object 1085 1086 window.adobeDataLayer.push( 1087 copyCtaClickObj 1088 ); 1089 } 1090 1091 function registerProgressEvents2(vidyardEmbed) { 1092 vidyardEmbed.api.progressEvents(function(result) { 1093 1094 sendToThirdParty2( 1095 result.player.uuid, 1096 result.chapter.title, 1097 result.event, 1098 result.player.metadata.chapters_attributes[result.chapter].video_attributes.name, 1099 result.player.metadata.chapters_attributes[result.chapter].video_attributes.length_in_seconds); 1100 }, [1, 25, 50, 75, 95]); 1101 1102 } 1103 1104 /*if (window.vidyardEmbed) { 1105 registerProgressEvents2(window.vidyardEmbed) 1106 } else { 1107 window.onVidyardAPI = function (vidyardEmbed) { 1108 return registerProgressEvents2(vidyardEmbed); 1109 }; 1110 }*/ 1111 1112 //---- make sure vidyard is presented and then register. 1113 let vidyardEmbedTimer = setInterval(() => { 1114 if (window.vidyardEmbed) { 1115 clearInterval(vidyardEmbedTimer); 1116 vidyardEmbed.api.addReadyListener(function(data, player) { 1117 console.log('the player is ready', player); 1118 registerProgressEvents2(window.vidyardEmbed); 1119 1120 }); 1121 } 1122 }, 1000); 1123 1124 //cancel vidyardEmbedTimer interval after 10 seconds. 1125 setTimeout(function() { 1126 clearInterval(vidyardEmbedTimer); 1127 }, 10000); 1128
1129 //Work around for some pages not using the video component 1130 //https://uat.bny.com/investments/uk/en/adviser/articles/reflections.html 1131 if ($('.video-card__image.videoDialogOpen').length) { 1132 $('.video-card__image.videoDialogOpen').on('click', function() { 1133 setTimeout(function() { 1134 if (window.vidyardEmbed) { 1135 registerProgressEvents2(window.vidyardEmbed); 1136 } 1137 }, 3000); 1138 }); 1139 } 1140 } 1141 1142 //---Send pageview from bfcache --------------------------------- 1143 function bfcacheTracking() { 1144 window.addEventListener('pageshow', (event) => { 1145 if (event.persisted) { 1146 window.adobeDataLayer.push( 1147 pageLoadedObj 1148 ); 1149 } 1150 }); 1151 } 1152 1153 /*--- 8/7/2025, updated for this ajax content dynamic generated download links 1154 https://www.bny.com/investments/us/en/institutional/products/cit.html#overview&v=1753470966452&module=fundsIndexTabs&tab=overview&module=fundsIndexTabs&tab=overview&module=fundsIndexTabs&tab=overview&module=fundsIndexTabs&tab=overview&module=fundsIndexTabs&tab=overview&module=fundsIndexTabs&tab=overview&module=fundsIndexTabs&tab=overview&module=fundsIndexTabs&tab=overview&module=fundsIndexTabs&tab=overview 1155 */ 1156 /* 9/17/2025 - use jquery live. 1157 function ajaxContainerTracking() { 1158 $('.ajax-containers').on('click', '.dL_fileDownload', function(event){ 1159 addClickToDataLayer(event); 1160 }); 1161 } 1162 */ 1163 1164 /*--------- 7/24/2025 - updated for Wealth client login page https://login.qa.bnymellonwealth.com/login/forms/Login.html -----------*/ 1165 function bnyWealthTracking() { 1166 if (bnyDataLayerApp.bny_getHostDomain(window.location.hostname) == 'bnymellonwealth.com') { 1167 $('#myAuthStatus .forgot-password a').click('on', function(e) { 1168 e.preventDefault(); 1169 1170 const copyCtaClickObj = structuredClone(ctaClickObj); //deep copy ctaClickObj 1171 1172 const linkObj = { 1173 linkText: 'forgot password', 1174 linkLocation: '', 1175 linkName: 'cta component:forgot password', 1176 linkHref: 'https://login.bnymellonwealth.com/fps/', 1177 _thebankofnewyorkmelloncorp: { 1178 linkCategory: 'cta component', 1179 isExitLink: false 1180 } 1181 } 1182 1183 copyCtaClickObj.xdm.web.webInteraction = linkObj; 1184 1185 window.adobeDataLayer.push( 1186 copyCtaClickObj 1187 ); 1188 1189 setTimeout(function() { 1190 location.href = "https://login.bnymellonwealth.com/fps/"; 1191 }, 500); 1192 }); 1193 } 1194 } 1195 1196 //------ Init load cmp:show--------------------------------------- 1197 //bnyDataLayerApp.isjQueryLoaded().then(function(){ 1198 initCmpShow(); 1199 modalTracking(); 1200 linksTracking(); 1201 carouselTracking(); 1202 searchFormTracking(); 1203 vidyardTracking(); 1204 bfcacheTracking(); 1205 bnyWealthTracking(); 1206 //}); 1207 }; 1208 1209 if (document.readyState !== 'loading') { 1210 if (!isContentLoaded) { 1211 isContentLoaded = true; 1212 console.log("readyState - call dataLayerMain"); 1213 dataLayerMain(); 1214 } 1215 } else { 1216 window.addEventListener("DOMContentLoaded", () => { 1217 if (!isContentLoaded) { 1218 isContentLoaded = true; 1219 console.log("DOMContentLoaded - call dataLayerMain"); 1220 dataLayerMain(); 1221 } 1222 }); 1223 } 1224 1225 bnyDataLayerApp.mainAPI = function() { 1226 if (!isContentLoaded) { 1227 isContentLoaded = true; 1228 console.log("mainAPI - call dataLayerMain"); 1229 dataLayerMain(); 1230 } 1231 } 1232 1233})(bnyDataLayerApp); 1234 1235//--- Target personalization adobeDataLayer --------------------------------- 1236//adobe.target.event.REQUEST_SUCCEEDED('at-request-succeeded') 1237 1238/*you do not need a separate Target data layer. Instead, you only need to define your XDM schema once, and the Web SDK will automatically pass that data to Adobe Target. 1239document.addEventListener('at-request-succeeded', function(event) { 1240 console.log('Target request', event); 1241 if(event.detail.responseTokens !== undefined){ 1242 const targetActivityObj = { 1243 'activityId': event.detail.responseTokens[0]['activity.id'], 1244 'activityName': event.detail.responseTokens[0]['activity.name'], 1245 'experienceId': event.detail.responseTokens[0]['experience.id'], 1246 'experienceName': event.detail.responseTokens[0]['experience.name'], 1247 'offerId': event.detail.responseTokens[0]['offer.id'] 1248 } 1249 1250 const pageLoadedObj = { 1251 event: "target", 1252 xdm: { 1253 eventType: "pageView", 1254 web: { 1255 //webPageDetails: {...bnyDataLayerApp.webPageDetailsObj, ...bnyDataLayerApp.pageModalObj}, 1256 target: targetActivityObj 1257 } 1258 } 1259 } 1260 1261 window.adobeDataLayer.push( 1262 pageLoadedObj 1263 ); 1264 } 1265}); 1266*/ 1267 1268/* 1269adobe.target.event.CONTENT_RENDERING_SUCCEEDED('at-content-rendering-succeeded') 1270document.addEventListener('at-content-rendering-succeeded', function(event) { 1271 console.log('Target rendering', event); 1272});
1273*/ 1274 1275/*-------------------------------------------------- 1276//Add class name to Third parties API mockup html elements. 1277bny_api_link (for all <a> tags. e.g. <a href="https://www.bny.com" class="bny_api_link">) 1278bny_api_button(for all button tags. e.g <button class="bny_api_button">) 1279bny_api_checkbox (for checkbox input tags. e.g. <input type="checkbox" class="bny_api_checkbox" name="name attribute">) 1280bny_api_radio (for radio input tags. e.g. <input type="radio" class="bny_api_radio" name="name attribute">) 1281bny_api_click (for all other click events other than list above. e.g. <div class="bny_api_click" name="name attribute">) 1282*/ 1283 1284bnyDataLayerApp.bnyAddToDataLayer = function(aNode) { 1285 const className = aNode.className; 1286 let linkCategory = ''; 1287 let linkHref = ''; 1288 let linkText = aNode.dataset?.linkText || aNode.getAttribute('name') || aNode.text || aNode.textContent; 1289 let ariaExpanded = aNode.getAttribute('aria-expanded'); 1290 console.log(ariaExpanded) 1291 1292 if (className.indexOf('bny_api_link') > -1) { 1293 linkHref = aNode.getAttribute("href") || "#"; 1294 linkText = aNode.dataset.linkText || aNode.textContent.replace(/\s\s+/g, ' '); 1295 linkCategory = 'bny_api_link'; 1296 } 1297 1298 if (className.indexOf('bny_api_button') > -1) { 1299 linkHref = "Button Click"; 1300 linkCategory = 'bny_api_button'; 1301 1302 let urlMatch = onclickAttr.match(/window\.open\s*\(\s*'([^']+)'/); 1303 if (urlMatch && urlMatch[1]) { 1304 linkHref = urlMatch[1]; 1305 } 1306 1307 linkText = aNode.dataset.linkText || aNode.textContent.trim() || aNode.getAttribute("class") || linkHref; 1308 /*Cleaning Text*/ 1309 linkText = linkText.replaceAll("keyboard_arrow_down", "").replaceAll("arrow_forward", "").replaceAll("launch", "").trim(); 1310 } 1311 1312 if (className.indexOf('bny_api_checkbox') > -1) { 1313 linkCategory = 'bny_api_checkbox'; 1314 } 1315 1316 if (className.indexOf('bny_api_radio') > -1) { //radio buttons are part of same group. linkText = group name:button value 1317 linkText = linkText + ":" + aNode.getAttribute("value"); 1318 linkCategory = 'bny_api_radio'; 1319 } 1320 1321 if (className.indexOf('bny_api_click') > -1) { 1322 linkCategory = 'bny_api_click'; 1323 } 1324 1325 if (className.indexOf('bny_api_filter') > -1) { 1326 linkCategory = 'bny_api_filter'; 1327 } 1328 1329 //--- linkCategory, if this element could be expanded or collapse 1330 if (ariaExpanded == 'false') { 1331 linkCategory = linkCategory + ' collapse'; 1332 } 1333 if (ariaExpanded == 'true') { 1334 linkCategory = linkCategory + ' expanded'; 1335 } 1336 1337 const linkObj = { 1338 linkText: linkText, 1339 linkLocation: '', 1340 linkName: linkCategory + ':' + linkText, 1341 linkHref: linkHref, 1342 _thebankofnewyorkmelloncorp: { 1343 linkCategory: linkCategory, 1344 isExitLink: false 1345 } 1346 } 1347 1348 if (className.indexOf('bny_disclaimer_modal') > -1) { //bny_disclaimer_modal 1349 linkObj._thebankofnewyorkmelloncorp.linkCategory = 'bny_disclaimer_modal'; 1350 linkObj._thebankofnewyorkmelloncorp.isModal = true; 1351 linkObj._thebankofnewyorkmelloncorp.modalName = 'bny_disclaimer_modal'; 1352 } 1353 1354 const copyCtaClickObj = structuredClone(bnyDataLayerApp.ctaClickObj); //deep copy ctaClickObj 1355 1356 copyCtaClickObj.xdm.web.webInteraction = linkObj; 1357 1358 /*-- https://www.bny.com/investments/us/en/intermediary.html# IM login/register link --*/ 1359 if (className.indexOf("personalization-nav__trigger--login") > -1) { 1360 linkText = linkText.replaceAll("\n", "").replaceAll("\t", ""); 1361 linkCategory = "client login"; 1362 copyCtaClickObj.xdm.eventType = 'clientLogin'; 1363 copyCtaClickObj.xdm.web.webInteraction._thebankofnewyorkmelloncorp.linkCategory = linkCategory; 1364 copyCtaClickObj.xdm.web.webInteraction.linkName = linkCategory + ':' + linkText; 1365 copyCtaClickObj.xdm.web.webInteraction.linkText = linkText; 1366 } 1367 1368 window.adobeDataLayer.push( 1369 copyCtaClickObj 1370 ); 1371} 1372 1373/* usage on third party's site, just place this at the end. 1374 bnyDataLayerApp.applyApiLinkTracking(); 1375*/ 1376 1377bnyDataLayerApp.applyApiLinkTracking = function() { 1378 $(document.body).on("click", bnyDataLayerApp.bny_api_class, function() { 1379 bnyDataLayerApp.bnyAddToDataLayer(this); 1380 }); 1381} 1382 1383/*--------- 9/10/2025 - For Newton API Json mockup Tracking -----------*/ 1384 1385if (bnyDataLayerApp.bny_getHostDomain(window.location.hostname) == 'newtonim.com') { 1386 bnyDataLayerApp.isjQueryLoaded().then(function() { 1387 bnyDataLayerApp.applyApiLinkTracking(); 1388 }); 1389} 1390 1391//------------------------- For API Tracking -------------------------------- 1392 1393bnyDataLayerApp.vendorTracking = function(apiLinkObj) { 1394 const linkObj = { 1395 'linkHref': apiLinkObj.linkHref, 1396 'linkLocation': apiLinkObj.linkLocation, 1397 'linkName': apiLinkObj.linkName, 1398 'linkText': apiLinkObj.linkText, 1399 '_thebankofnewyorkmelloncorp': { 1400 'linkCategory': apiLinkObj.linkCategory, 1401 'isExitLink': false,
1402 'linkAnswer': apiLinkObj.linkAnswer, 1403 'linkQuestion': apiLinkObj.linkQuestion 1404 } 1405 }; 1406 1407 const copyCtaClickObj = structuredClone(bnyDataLayerApp.ctaClickObj); //deep copy ctaClickObj 1408 1409 copyCtaClickObj.xdm.web.webInteraction = linkObj; 1410 1411 window.adobeDataLayer.push( 1412 copyCtaClickObj 1413 ); 1414}; 1415 1416bnyDataLayerApp.vendorTrackingCmpShow = function(apiLinkObj) { 1417 const copyPageLoadedObj = structuredClone(bnyDataLayerApp.pageLoadedObj); //deep copy pageLoadedObj 1418 1419 copyPageLoadedObj.xdm.web.webPageDetails.pageName = apiLinkObj.page_name; 1420 copyPageLoadedObj.xdm.web.webPageDetails.experienceType = apiLinkObj.experienceType; 1421 1422 window.adobeDataLayer.push( 1423 copyPageLoadedObj 1424 ); 1425}; 1426 1427/* 1428const ctaClickObj = { 1429 'event': "click", 1430 'xdm': { 1431 'eventType': 'ctaClick', 1432 'web': { 1433 'webInteraction': { 1434 'linkHref': "", 1435 'linkLocation': "", 1436 'linkName': "", 1437 'linkText': "", 1438 '_thebankofnewyorkmelloncorp': { 1439 'linkCategory': "", 1440 'isExitLink': false 1441 } 1442 } 1443 } 1444 } 1445} 1446*/ 1447 1448//--- For Marketo form Tracking -------------------------------- 1449 1450bnyDataLayerApp.formAPITracking = function(formObj) { 1451 const linkObj = { 1452 linkName: formObj.linkObj.linkName, 1453 _thebankofnewyorkmelloncorp: { 1454 formName: formObj.linkObj.formName, 1455 formType: formObj.linkObj.formType 1456 } 1457 } 1458 1459 const copyCtaClickObj = structuredClone(bnyDataLayerApp.ctaClickObj); //deep copy ctaClickObj 1460 1461 copyCtaClickObj.xdm.web.webInteraction = linkObj; 1462 copyCtaClickObj.xdm.eventType = formObj.eventType; 1463 1464 window.adobeDataLayer.push( 1465 copyCtaClickObj 1466 ); 1467 1468 1469 checkDianomiRules('formComplete', linkObj.linkName); 1470 1471 1472 1473 /* Sample: place this in Launch ---------- 1474 window.bnyDataLayerApp = window.bnyDataLayerApp || {}; 1475 bnyDataLayerApp.DianomiRules = { 1476 formComplete: { 1477 'form complete:2737': 'bny.gpandthomepage.contactus', 1478 'form complete:4121': 'bny.retailalts2025.contactus' 1479 }, 1480 pageName: { 1481 'bny:investments:adviser:adviser-support:research:thank-you': 1482 { 1483 'storageValue':'dianomi_fired_4995, 1484 'trackingId': 'bnyinvestments.ukretirementresearch2026.reportdownload' 1485 } 1486 } 1487 } 1488 */ 1489}; 1490 1491/* usage on the marketo form script. 1492const formObj = { 1493 eventType: "formStart/formError/formComplete", 1494 linkObj: { 1495 linkName: "form start:1121", //or form complete:1121 or form error:1121 1496 formName: "1121", 1497 formType: "marketo", 1498 errorType: "" //any errors 1499 } 1500} 1501bnyDataLayerApp.formAPITracking(formObj); 1502*/ 1503 1504 1505bnyDataLayerApp.isjQueryLoaded().then(function(){ 1506 /* To prevent flicker during Target activities, manually set #bny-target-section,#bny-target-section-2,#bny-target-section-3 to the AEM components hidden for 2 seconds. */ 1507 1508 $('head').append('<style type="text/css">#bny-target-section,#bny-target-section-2,#bny-target-section-3{visibility:hidden} #bny-target-hide{display:none}</style>'); 1509 1510 /*--------- 6/16/2026 - For IM login/register popup modal login Tracking -----------*/ 1511 1512 $(document.body).on("click", bnyDataLayerApp.bny_internal_class, function() { 1513 bnyDataLayerApp.bnyAddToDataLayer(this); 1514 }); 1515}); 1516 1517setTimeout(function() { 1518 $('head').append('<style type="text/css">#bny-target-section,#bny-target-section-2,#bny-target-section-3 {visibility:visible !important}</style>'); 1519}, 2000); 1520 1521function checkDianomiRules(type, data) { 1522 //------- fire Dianomi pixels on pageName match -------------- 1523 if (type == 'pageName') { 1524 if (bnyDataLayerApp.DianomiRules && bnyDataLayerApp.DianomiRules['pageName'] && !!bnyDataLayerApp.DianomiRules['pageName'][data]) { 1525 bny_launch_rule_DianomiConversionTag(bnyDataLayerApp.DianomiRules['pageName'][data]) 1526 } 1527 } 1528 1529 //------- fire Dianomi pixels on formComplete -------------- 1530 if (type == 'formComplete') { 1531 if (bnyDataLayerApp.DianomiRules && bnyDataLayerApp.DianomiRules['formComplete'] && !!bnyDataLayerApp.DianomiRules['formComplete'][data]) { 1532 bny_launch_rule_Dianomi(bnyDataLayerApp.DianomiRules['formComplete'][data]) 1533 } 1534 } 1535} 1536 1537 1538function bny_launch_rule_Dianomi(tValue) { 1539 var T = tValue; 1540 try { 1541 var click_id = window.localStorage.getItem("dianomi_click_id"); 1542 if (click_id !== null) { 1543 var img = document.createElement("img"); 1544 img.width = 1; 1545 img.height = 1; 1546 img.src = "https://www.dianomi.com/pixeltrack.pl?t=" + T + "&utm_click_id=" + click_id; 1547 document.body.appendChild(img); 1548 } 1549 } catch (e) { 1550 console.error("Unable to set Dianomi UTM click ID", e); 1551 } 1552} 1553 1554function bny_launch_rule_DianomiConversionTag(pageNameData) { 1555 if (sessionStorage.getItem(pageNameData[storageValue])) { 1556 console.log("[Dianomi] Already fired for this session. Skipping. " + pageNameData[storageValue]); 1557 return; 1558 } 1559 console.log("[Dianomi] Rule triggered (thank-you page)"); 1560 try { 1561 var clickId = window.localStorage.getItem("dianomi_click_id"); 1562 console.log("[Dianomi] clickId:", clickId); 1563 if (!clickId) { 1564 console.warn("[Dianomi] No dianomi_click_id found. Exiting."); 1565 return; 1566 } 1567 sessionStorage.setItem(pageNameData[storageValue], "true"); 1568 var trackingId = pageNameData[trackingId]; 1569 var url = 1570 "https://www.dianomi.com/pixeltrack.pl?t=" + 1571 encodeURIComponent(trackingId) + 1572 "&utm_click_id=" + encodeURIComponent(clickId) + 1573 "&_ts=" + Date.now(); 1574 console.log("[Dianomi] Pixel URL:", url); 1575 if (navigator.sendBeacon) { 1576 var result = navigator.sendBeacon(url); 1577 console.log("[Dianomi] sendBeacon result:", result); 1578 return; 1579 } 1580 fetch(url, { 1581 method: "GET", 1582 mode: "no-cors", 1583 keepalive: true, 1584 credentials: "omit" 1585 }).then(function() { 1586 console.log("[Dianomi] fetch sent"); 1587 }).catch(function(e) { 1588 console.error("[Dianomi] fetch failed:", e); 1589 }); 1590 } catch (e) { 1591 console.error("[Dianomi] Exception:", e); 1592 } 1593}
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.