 core/modules/tracker/src/Tests/TrackerTest.php | 3 ++-
 core/modules/tracker/tracker.pages.inc         | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/core/modules/tracker/src/Tests/TrackerTest.php b/core/modules/tracker/src/Tests/TrackerTest.php
index d1fc792..246e163 100644
--- a/core/modules/tracker/src/Tests/TrackerTest.php
+++ b/core/modules/tracker/src/Tests/TrackerTest.php
@@ -84,7 +84,8 @@ function testTrackerAll() {
     $this->assertLink(t('My recent content'), 0, 'User tab shows up on the global tracker page.');
 
     // Assert cache contexts, specifically the pager and node access contexts.
-    $this->assertCacheContexts(['languages:language_interface', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'url.query_args.pagers:0', 'user.node_grants:view', 'user.permissions']);
+    $this->assertCacheContexts(['languages:language_interface', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'url.query_args.pagers:0', 'user.node_grants:view', 'user.permissions', 'user.roles:authenticated']);
+    // Assert cache tags for the visible node and node list cache tag.
     $expected_tags = Cache::mergeTags($published->getCacheTags(), $published->getOwner()->getCacheTags());
     $expected_tags = Cache::mergeTags($expected_tags, ['node_list', 'rendered']);
     $this->assertCacheTags($expected_tags);
diff --git a/core/modules/tracker/tracker.pages.inc b/core/modules/tracker/tracker.pages.inc
index 3be3966..4b2d679 100644
--- a/core/modules/tracker/tracker.pages.inc
+++ b/core/modules/tracker/tracker.pages.inc
@@ -140,6 +140,9 @@ function tracker_page($account = NULL) {
   $page['#cache']['tags'] = $cache_tags;
   $page['#cache']['contexts'][] = 'user.node_grants:view';
 
+  // Cacheable per "authenticated or not", because we can only track (and show)
+  // reading history for authenticated users, not for anonymous users.
+  $page['#cache']['contexts'][] = 'user.roles:authenticated';
   if (Drupal::moduleHandler()->moduleExists('history') && \Drupal::currentUser()->isAuthenticated()) {
     $page['#attached']['library'][] = 'tracker/history';
   }
