File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed
packages/sources/datalayer/src/__tests__ Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -66,4 +66,52 @@ describe('consent', () => {
6666 gtag ( 'consent' ) ;
6767 expect ( elb ) . toHaveBeenLastCalledWith ( 'walker consent' , { } ) ;
6868 } ) ;
69+
70+ test ( 'usercentrics' , ( ) => {
71+ gtag ( {
72+ action : 'onInitialPageLoad' ,
73+ event : 'consent_status' ,
74+ type : 'explicit' ,
75+ ucCategory : {
76+ essential : true ,
77+ functional : true ,
78+ marketing : true ,
79+ } ,
80+ ga4 : true ,
81+ 'meta pixel' : true ,
82+ declined : false ,
83+ 'gtm.uniqueEventId' : 1 ,
84+ } ) ;
85+
86+ sourceDataLayer ( {
87+ elb,
88+ mapping : {
89+ consent_status : {
90+ name : 'walker consent' ,
91+ custom : {
92+ command : {
93+ condition : ( event ) => event . type == 'explicit' , // Only process explicit consent
94+ map : {
95+ essential : 'ucCategory.essential' ,
96+ functional : 'ucCategory.functional' ,
97+ marketing : 'ucCategory.marketing' ,
98+ ga4 : 'ga4' ,
99+ meta : 'meta pixel' ,
100+ declined : 'declined' ,
101+ } ,
102+ } ,
103+ } ,
104+ } ,
105+ } ,
106+ } ) ;
107+
108+ expect ( elb ) . toHaveBeenCalledWith ( 'walker consent' , {
109+ essential : true ,
110+ functional : true ,
111+ marketing : true ,
112+ ga4 : true ,
113+ meta : true ,
114+ declined : false ,
115+ } ) ;
116+ } ) ;
69117} ) ;
You can’t perform that action at this time.
0 commit comments