@@ -149,7 +149,10 @@ s._utils = {
149149 . getEntriesByType ( 'navigation' )
150150 . map ( ( nav ) => nav . type ) . toString ( ) ;
151151
152- }
152+ } ,
153+ isPageStatus : function ( expectedStatus ) {
154+ return this . getPageReloadStatus ( ) === expectedStatus ;
155+ } ,
153156} ;
154157
155158/**
@@ -316,12 +319,19 @@ s._articleViewTypeObj = {
316319
317320 isDirect : function ( referrer ) {
318321 const noReferrer = this . isWithoutReferrer ( referrer ) ;
322+ const newVisit = this . isNewVisit ( ) ;
323+
324+ return ( noReferrer && newVisit ) ;
325+
326+ } ,
327+
328+ isNewVisit : function ( ) {
319329 const sessionStart = s . _utils . isSessionStart ( ) ;
320330 const pageOneInSession = s . _utils . isPageOneInSession ( ) ;
321331
322- return ( noReferrer && ( sessionStart || pageOneInSession ) ) ;
332+ return ( sessionStart || pageOneInSession ) ;
323333
324- } ,
334+ } ,
325335
326336 isValidURL : function ( urlString ) {
327337 try {
@@ -340,11 +350,14 @@ s._articleViewTypeObj = {
340350 }
341351 } ,
342352
343- isNavigated : function ( ) {
344- const reloadStatus = s . _utils . getPageReloadStatus ( ) ;
345- return window . performance && ( window . performance . navigation && window . performance . navigation . type === 0 ) || reloadStatus === 'navigate' ;
353+ isNavigated : function ( ) {
354+ return s . _utils . isPageStatus ( 'navigate' ) ;
346355 } ,
347-
356+
357+ isReloaded : function ( ) {
358+ return s . _utils . isPageStatus ( 'reload' ) ;
359+ } ,
360+
348361 isSelfRedirect : function ( ) {
349362 return ( s . _ppvPreviousPage || '' ) . includes ( ( s . pageName || 'NEVER' ) . split ( ':' ) . pop ( ) ) ;
350363 } ,
@@ -379,9 +392,8 @@ s._articleViewTypeObj = {
379392
380393 getExternalType : function ( referrer ) {
381394 const referringDomain = s . _utils . getDomainFromURLString ( referrer ) ;
382- const isSessionStart = s . _utils . isSessionStart ( ) ;
395+ const isNewVisit = this . isNewVisit ( ) ;
383396 const isHomepage = s . _utils . isHomepage ( ) ;
384- const isArticle = s . _utils . isArticlePage ( ) ;
385397 let pageViewEvent ;
386398 let channel ;
387399 let mkt_channel_detail ;
@@ -410,27 +422,37 @@ s._articleViewTypeObj = {
410422 pageViewEvent = 'event205' ;
411423 channel = 'AS News' ;
412424 mkt_channel_detail = referringDomain ;
413- } else if ( ( this . isFromPremiumService ( referrer ) || this . isFromPaypal ( referrer ) ) && isSessionStart ) {
425+ } else if ( ( this . isFromPremiumService ( referrer ) || this . isFromPaypal ( referrer ) ) && isNewVisit ) {
414426 pageViewEvent = 'event208' ;
415427 channel = 'Register & Payment' ;
416428 mkt_channel_detail = referringDomain ;
417429 } else if ( this . isFromPremiumService ( referrer ) || this . isFromPaypal ( referrer ) ) {
418430 pageViewEvent = 'event23,event201' ; // Login via secure.mypass during session
419- } else if ( this . isDirect ( ) && this . isNavigated ( ) && isArticle ) {
431+ } else {
432+ pageViewEvent = 'event27,event203' ; // Other External (Referrer)
433+ channel = 'Other External' ;
434+ mkt_channel_detail = referringDomain ;
435+ }
436+ return { pageViewEvent, channel, mkt_channel_detail} ;
437+ } ,
438+
439+ noReferrerType : function ( ) {
440+ const isArticle = s . _utils . isArticlePage ( ) ;
441+ const isNewVisit = this . isNewVisit ( ) ;
442+ const isNavigated = this . isNavigated ( ) ;
443+ const isReloaded = this . isReloaded ( ) ;
444+ let pageViewEvent ;
445+ let channel ;
446+ let mkt_channel_detail ;
447+
448+ if ( isNewVisit && isNavigated && isArticle ) {
420449 pageViewEvent = 'event26,event202' ; // Dark Social
421450 channel = 'Dark Social' ;
422- } else if ( this . isDirect ( ) && this . isNavigated ( ) ) {
451+ } else if ( isNewVisit && ( isNavigated || isReloaded ) ) {
423452 pageViewEvent = 'event207' ; // Direct
424453 channel = 'Direct' ;
425- } else if ( this . isWithoutReferrer ( ) && this . isNavigated ( ) && isArticle ) {
426- pageViewEvent = 'event26,event202' ; // Dark Social Marketing Channel only with session start
427- } else if ( this . isDirect ( referrer ) ) {
428- pageViewEvent = 'event207' ; // Fallback
429- channel = 'Direct' ;
430- } else {
431- pageViewEvent = 'event27,event203' ; // Other External (Referrer)
432- channel = 'Other External' ;
433- mkt_channel_detail = referringDomain ;
454+ } else if ( isNavigated || isReloaded ) {
455+ pageViewEvent = 'event23,event201' ;
434456 }
435457 return { pageViewEvent, channel, mkt_channel_detail} ;
436458 } ,
@@ -441,7 +463,14 @@ s._articleViewTypeObj = {
441463 let channel ;
442464 let mkt_channel_detail ;
443465
444- if ( this . isFromInternal ( referrer ) ) {
466+ if ( ! referrer ) {
467+ // no Referrer is set
468+ const noReferrerType = this . noReferrerType ( referrer ) ;
469+ pageViewEvent = noReferrerType . pageViewEvent ;
470+ channel = noReferrerType . channel ;
471+ mkt_channel_detail = '' ;
472+
473+ } else if ( this . isFromInternal ( referrer ) ) {
445474 // Referrer is of same domain
446475 const internalType = this . getInternalType ( referrer ) ;
447476 pageViewEvent = internalType . pageViewEvent ;
@@ -470,9 +499,13 @@ s._articleViewTypeObj = {
470499 const isFromReco = this . isFromReco ( ) ;
471500 const pageNumberOne = s . _utils . isPageOneInSession ( ) ;
472501 const isFromRecoFf = this . isFromRecoFf ( ) ;
502+ const pageIsReloaded = this . isReloaded ( ) ;
503+ const newVisit = this . isNewVisit ( ) ;
473504
474-
475- if ( trackingValue . startsWith ( 'sea.' ) ) {
505+ if ( trackingValue && pageIsReloaded && newVisit ) {
506+ pageViewEvent = 'event207' ; // Direct
507+ channel = 'Direct' ;
508+ } else if ( trackingValue . startsWith ( 'sea.' ) ) {
476509 pageViewEvent = 'event24,event206,event242' ; // Search
477510 channel = 'Paid Marketing' ;
478511 channelCategory = 'Sea' ;
@@ -572,7 +605,8 @@ s._articleViewTypeObj = {
572605
573606 setExtraViewTypes : function ( s ) {
574607 const trackingChannel = this . isOtherTrackingValue ( ) ;
575- if ( trackingChannel ) {
608+ const pageIsReloaded = this . isReloaded ( ) ;
609+ if ( trackingChannel && ! pageIsReloaded ) {
576610 s . _setTrackingValueEvents ( s ) ;
577611 } else {
578612 s . _setExternalReferringDomainEvents ( s ) ;
0 commit comments