XFL Football League

Official home of the XFL


XFL – Official home of the XFL { const target = e.currentTarget; const styles = { backgroundColor: ‘rgb(182, 2, 23)’, color: ‘rgb(255, 255, 255)’ }; const isCTA = getComputedStyle(target).backgroundColor == styles.backgroundColor && getComputedStyle(target).color == styles.color; if (isCTA) { window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: ‘cta’ }); } }); $(document).on(‘submit’, ‘.s-newsletter__form’, e => { window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: ‘cta’ }); }); $(document).on(‘click’, ‘.s-feed-cards__load-more-button’, e => { window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: ‘cta’ }); }); $(‘form[action*=”salesforce”]:not([class*=”c-form”]) [type=submit]’).click(function (e) { const {pathname} = document.location; const formType = $(e.currentTarget).closest(‘form’)[0].dataset.formtype; const $formTitle = $(e.currentTarget).closest(‘form’).find(‘h1’); const formTitle = $formTitle.text().toLowerCase(); const hasTeamOptions = $(e.currentTarget).closest(‘form’).find(‘select[title=”Team”]’)[0]; const isTeamPage = () => pathname.includes(‘teams’); if (formTitle.length) { window.dataLayer = window.dataLayer || []; if (hasTeamOptions) { const favoriteTeam = hasTeamOptions.value; window.dataLayer.push({ event: ‘form-submit’, formType, favoriteTeam }); } else { if (isTeamPage()) { window.dataLayer.push({ event: ‘form-submit’, formType, favoriteTeam: teamNameFinder(pathname) }); } else { window.dataLayer.push({ event: ‘form-submit’, formType }); } } } }); $(document).on(‘click’, ‘.s-navigation__menu-link, .s-navigation__submenu-link’, e => { const target = e.currentTarget; const link = target.href; const isLink = link !== undefined; const {text, href: navClickUrl} = target; const navClickText = text.trim(); let navClickMenu = ”; let navClickPosition; if (isLink) { const isSubmenuLink = target.className.includes(‘submenu-link’); let isPrimaryMenuLink; if (isSubmenuLink) { const translate3d = target.closest(‘.s-navigation__submenu’).style.transform; const abscissa = parseInt(translate3d.split(/w+(|);?/)[1].split(/,s?/g)[0]); let submenuTitle = document.body.dataset.activelink; isPrimaryMenuLink = abscissa { const target = e.currentTarget; const link = target.href; const isLink = link !== undefined; const {text: navClickText, href: navClickUrl} = target; let navClickMenu = ‘Primary’; const isSubmenuLink = target.closest(‘.s-navigation-mobile__menu-list’).className.includes(‘submenu’); let navClickPosition = String([…target.closest(‘.s-navigation-mobile__menu-list’).children].indexOf(target.parentElement) + 1); if (isSubmenuLink) { navClickMenu = `Primary – ${target.closest(‘.s-navigation-mobile__simplebar-container’).firstElementChild.lastElementChild.text}`; } if (isLink) { window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: ‘nav-click’, navLevel: `nav level 1`, navClickText, navClickUrl, navClickMenu, navClickPosition, navType: ‘burger’ }); } }); /*if (pathname.includes(‘search’)) { document.querySelector(‘.s-search-results__form’).addEventListener(‘submit’, () => { setTimeout(() => { siteSearchEvent(); }, 1000); }); }*/ dataLayerInitialized(); siteSearchEvent(); teamSelection(); ticketOption(); tileClickEvent(); }); const teamNameFinder = pathname => { if (pathname.includes(‘teams’)) { const urlItems = pathname.split(‘/’); const teamNameFromUrl = teamNames[urlItems[urlItems.indexOf(‘teams’) + 1]]; return teamNameFromUrl; } return undefined; }; const dataLayerInitialized = () => { const {href, pathname} = window.location; const {head, body, documentElement} = document; const arr = href.split(‘/’); const pageType = head.querySelector(‘[data-pagetype]’).dataset.pagetype; const deviceType = body => { const screenWidth = parseInt(getComputedStyle(body).width); if (screenWidth >= 320 && screenWidth = 768 && screenWidth { const {pathname} = window.location; if (pathname.includes(‘search’)) { const searchTerm = document.querySelector(‘.s-search-results__input’).value; const resultsQty = document.querySelector(‘.s-search-results__quantity’); const searchResults = resultsQty ? +resultsQty.firstChild.nodeValue : 0; if (searchTerm) { window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: ‘site-search’, searchTerm, searchResults }); } /*$(document).on(‘click’, ‘.s-search-results__title’, e => { window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: ‘search-click’, searchTerm, searchResults }); });*/ } }; const teamSelection = () => { $(document).on(‘click’, ‘.s-embed-teams__link’, e => { const target = e.currentTarget; const link = target.href; const isLink = link !== undefined; if (isLink) { const team = teamNames[target.classList[1].replace(‘s-embed-teams__link–‘, ”)]; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: ‘team-selection’, team }); } }); }; const ticketOption = () => { const {pathname} = window.location; const isTicketCentral = urlChecker(‘teams’) && urlChecker(‘tickets’); if (isTicketCentral) { $(document).on(‘click’, ‘.s-slider-slide__button, .s-feed-card__title-link, .s-feed-card__link’, e => { const target = e.currentTarget; const link = target.href; const isLink = link !== undefined; if (isLink) { const ticketOptions = [‘Season Tickets’, ‘Group Tickets’, ‘Single Game Tickets’]; let ticketOption; window.dataLayer = window.dataLayer || []; if (target.className.includes(‘slide’)) { window.dataLayer.push({ event: ‘ticket-option’, ticketOption: target.text === ‘BUY TICKETS’ ? ‘Single Game Tickets’ : target.text, teamName: teamNameFinder(pathname), }); } else { let textContent; if (target.className.includes(‘s-feed-card__link’)) { textContent = target.nextSibling.nextSibling.querySelector(‘.s-feed-card__title-link’).text; } else { textContent = target.textContent } ticketOption = textContent.substr(textContent.indexOf(‘ ‘) + 1); if (ticketOptions.includes(ticketOption)) { window.dataLayer.push({ event: ‘ticket-option’, ticketOption, teamName: teamNameFinder(pathname), }); } } } }); } }; const urlChecker = word => window.location.pathname.split(‘/’).includes(word); const pushTileEvent = (event, tileType, tileTitle, tilePosition, articleCategory) => { window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event, tileType, tileTitle, tilePosition, articleCategory }); }; const tileClickEvent = () => { $(document).on(‘click’, ‘.s-feed-card__title-link, .s-feed-card__link’, e => { const target = e.currentTarget; const link = target.href; const isLink = link !== undefined; const isExternal = new URL(link).host !== window.location.host; if (isLink) { let tileTitle; if (target.className.includes(‘s-feed-card__link’)) { tileTitle = target.closest(‘.s-feed-card’).querySelector(‘.s-feed-card__title-link’).text; } else { tileTitle = target.textContent } const isTicketmaster = new URL(link).host.includes(‘ticketmaster’); const isTicketsLink = new URL(link).href.includes(‘/tickets’); const isTicket = isTicketmaster || isTicketsLink; const tileType = isTicket ? ‘ticket’ : ‘content’; const tileItem = target.closest(‘.s-feed-cards__item’); const tilePosition = String([…tileItem.parentElement.children].indexOf(tileItem) + 1); const tileTags = tileItem.querySelector(‘.s-feed-card__content’).dataset.tags; const articleCategory = tileTags || undefined; pushTileEvent(’tile-click’, tileType, tileTitle, tilePosition, articleCategory); } ; }); }; const trackCarouselEvent = ({event, carouselSlidePosition, slide}) => { const image = slide.image.id; const title = slide.title || ‘undefined’; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event, carouselSlidePosition: `${carouselSlidePosition + 1}`, carouselSlideCreative: image, carouselSlideText: title }); }; const trackYoutubeVideoEvents = function ({player, event, state, autoplay}) { const title = player.getVideoData().title; const duration = player.getDuration(); const eventsMapping = { ‘0’: ‘video-complete’, ‘1’: ‘video-play’, ‘2’: ‘video-pause’, ‘onReady’: ‘video-impression’ }; const eventData = eventsMapping[state]; if (eventData) { window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: eventData, videoTitle: title, videoLength: String(parseInt(duration)), videoSource: ‘youtube’, videoPlayType: autoplay ? ‘autoplay’ : ‘not autoplay’ }); } }; const trackArticleEvent = ({event, virtualPath, virtualTitle}) => { window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event, virtualPath, virtualTitle }); }; const trackSocialEvent = ({event, socialNetwork}) => { if (event === ‘social-share’) { return; } window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event, socialNetwork }); }; ]]> Skip to content “},”loop”:false,”autoPlay”:false,”muted”:false,”controls”:true}}]}, document.getElementById(“id-87633115”) ,function(){ document.getElementById(“id-87633115”).classList.remove(‘is-server-markup’) } ); }); ]]>

Source