| @@ -342,9 +342,11 @@ | ||
| 342 | 342 | if ( ! Analytics::instance()->is_enabled() ) { |
| 343 | 343 | // A queued event outlives an undecided answer. Once the answer is |
| 344 | 344 | // no, drop it rather than leaving it to sit in the options table |
| 345 | 345 | // waiting for a consent that is not coming. |
| 346 | - if ( 'denied' === Settings::instance()->tracking_consent() ) { | |
| 346 | + // The persisted answer: a settings filter must not be able to keep a | |
| 347 | + // declined merchant's queued events sitting in the options table. | |
| 348 | + if ( 'denied' === Settings::instance()->raw_tracking_consent() ) { | |
| 347 | 349 | delete_option( self::PENDING_OPTION ); |
| 348 | 350 | } |
| 349 | 351 | |
| 350 | 352 | return; |
| @@ -491,10 +493,12 @@ | ||
| 491 | 493 | * @param string $event Event name. |
| 492 | 494 | * @param array $properties Event properties. |
| 493 | 495 | */ |
| 494 | 496 | private function record( string $event, array $properties = array() ): void { |
| 495 | - // An explicit "no" is an answer, not a delay. | |
| 496 | - if ( 'denied' === Settings::instance()->tracking_consent() ) { | |
| 497 | + // An explicit "no" is an answer, not a delay. Read the persisted value: | |
| 498 | + // nothing should be queued about a merchant who declined, even if a | |
| 499 | + // settings filter presents a different answer. | |
| 500 | + if ( 'denied' === Settings::instance()->raw_tracking_consent() ) { | |
| 497 | 501 | return; |
| 498 | 502 | } |
| 499 | 503 | |
| 500 | 504 | $pending = get_option( self::PENDING_OPTION ); |