@@ -298,7 +298,8 @@ export const initialize = async ({
298298 ) ;
299299
300300 /**
301- * Apply calculated automated consent to experience defaults BEFORE updating cookie
301+ /**
302+ * Apply calculated automated consent to experience defaults and save to browser cookie
302303 */
303304 if ( automatedApplied && fides . experience . privacy_notices ) {
304305 // Update experience privacy_notices with calculated automated consent
@@ -319,6 +320,22 @@ export const initialize = async ({
319320 } ,
320321 ) ;
321322 fidesDebugger ( "Applied automated consent to experience defaults" ) ;
323+
324+ // save the cookie to the browser prior to updating the experience
325+ Object . assign ( fides . cookie . fides_meta , {
326+ consentMethod : automatedMethod ,
327+ } ) ;
328+ // eslint-disable-next-line no-param-reassign
329+ fides . cookie = {
330+ ...fides . cookie ,
331+ consent : automatedNoticeConsent ,
332+ } ;
333+ await saveFidesCookie ( fides . cookie , options ) ;
334+
335+ fidesDebugger (
336+ "Saved automated consent to browser cookie" ,
337+ fides . cookie ,
338+ ) ;
322339 }
323340
324341 /**
@@ -376,20 +393,6 @@ export const initialize = async ({
376393 // eslint-disable-next-line no-param-reassign
377394 fides . cookie = updatedCookie ;
378395
379- // If automated consent was applied, save the cookie to the browser
380- if ( automatedApplied ) {
381- // Set the consentMethod on fides_meta before saving
382- Object . assign ( fides . cookie . fides_meta , {
383- consentMethod : automatedMethod ,
384- } ) ;
385-
386- await saveFidesCookie ( fides . cookie , options ) ;
387- fidesDebugger (
388- "Saved automated consent to browser cookie" ,
389- fides . cookie ,
390- ) ;
391- }
392-
393396 // Initialize the i18n singleton before we render the overlay
394397 const i18n = setupI18n ( ) ;
395398 initializeI18n (
0 commit comments