@@ -14,6 +14,12 @@ const getPIIDestinationList = () => {
1414 return event && event . message && event . message . context && event . message . context . traits ;
1515 } ;
1616
17+ const getPageEventBlockedDestinationsList = ( ) => {
18+ return ( process . env . BLOCKED_PAGE_DESTINATIONS || "mp" )
19+ . trim ( )
20+ . split ( "," ) ;
21+ } ;
22+
1723const handleFirstLoginGA4Property = ( destination , event , traits ) => {
1824 // delete firstLoginGA4 property from traits when destination is not GA4
1925 if ( destination !== 'ga4' ) {
@@ -27,7 +33,7 @@ const handleFirstLoginGA4Property = (destination, event, traits) => {
2733 traits . value = 0 ;
2834 }
2935
30- } ;
36+ } ;
3137
3238 const changeDateFormatForCustomerio = ( contextTraitsPresent , eventTraitsPresent , checkDestinationList , event ) => {
3339 if ( checkDestinationList ) {
@@ -51,6 +57,13 @@ const handleFirstLoginGA4Property = (destination, event, traits) => {
5157 const contextTraitsPresent = doesEventContainContextTraits ( event ) ;
5258 const eventTraitsPresent = doesEventContainsTraits ( event ) ;
5359 const checkDestinationList = getPIIDestinationList ( ) . includes ( destination ) ;
60+ const checkPageEventBlockedDestination = getPageEventBlockedDestinationsList ( ) . includes ( destination ) ;
61+ if ( event . message . type === EventType . PAGE && checkPageEventBlockedDestination ) {
62+ // eslint-disable-next-line no-param-reassign
63+ return null ;
64+ }
65+
66+
5467 changeDateFormatForCustomerio ( contextTraitsPresent , eventTraitsPresent , checkDestinationList , event ) ;
5568
5669 if ( ! checkDestinationList && eventTraitsPresent ) {
@@ -82,6 +95,7 @@ const handleFirstLoginGA4Property = (destination, event, traits) => {
8295
8396 // eslint-disable-next-line no-console
8497 // if(doesEventContainsTraits(event)) console.log("event log=>destination : ", JSON.stringify(destination), " , ==> event traits : ", JSON.stringify(event.message.traits), " , ==> event here : ",JSON.stringify(event));
98+
8599 return event ;
86100 } ;
87101
0 commit comments