WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@tjmw
Copy link
Member

@tjmw tjmw commented Nov 7, 2025

What does this change?

This PR extends the expiration of all user benefits cookies to 30 days - GU_AF1, gu_allow_reject_all, gu_hide_support_messaging. The cookie which tracks when the other cookies need refreshing (gu_user_benefits_expiry) continue to have an expiry of 1 day.

Previously these cookies were short lived (1-2 days) but this resulted in edge cases where if a signed in user didn't visit the site for more than a couple of days, when they returned their first page view wouldn't reflect their benefits (i.e. they would see ads). This is due to a race condition between the user benefits refresh and the ads code. However, we don't want to delay ads until after the user benefits have been refreshed as that would impact performance. So instead, extend the expiry of the cookie.

Note: this may result in a user getting benefits they no longer have on the first returning pageview, but this will be correct from the second page view onwards. We think this is OK.

See also:

guardian/frontend#28352
guardian/dotcom-rendering#14810
guardian/support-frontend#7559

How to test

Sign in and inspect expiration of user benefits cookies (tested in CODE).

How can we measure success?

Fewer complaints from signed-in supporters about seeing ads.

Have we considered potential risks?

It shouldn't result in any noticable changes for signed in users - other than a better experience in the scenario described above. We'll still refresh the cookies daily ensuring users are only getting the benefits they're entitled to.

tjmw added a commit to guardian/support-frontend that referenced this pull request Dec 2, 2025
The cookie which tracks when to refresh benefits cookies is reduced to 1
day, like everywhere else.

This is part of a wider change to benefits cookie expiration to fix an
issue where signed-in users with ad free benefits who didn't visit the
site for time period would sometimes see ads on their first returning
pageview. This change makes this less likely to happen by extending the
expiration of user benefits cookies.

This is due to a race condition between the user benefits refresh and
the ads code. However, we don't want to delay ads until after the user
benefits have been refreshed as that would impact performance. So
instead, extend the expiry of the cookie.

See also:
guardian/frontend#28352
guardian/dotcom-rendering#14810
guardian/gateway#3285
Previouly they were short lived (1-2 days) but this resulted in edge
cases where if a signed in user didn't visit the site for more than a
couple of days, when they returned their first page view wouldn't reflect
their benefits (i.e. they would see ads). This is due to a race
condition between the user benefits refresh and the ads code. However,
we don't want to delay ads until after the user benefits have been
refreshed as that would impact performance. So instead, extend the
expiry of the cookie.

Note: this may result in a user getting benefits they no longer have on
the first returning pageview, but this will be correct from the second
page view onwards. We think this is OK.
@github-actions
Copy link

github-actions bot commented Dec 4, 2025

tjmw added 2 commits December 4, 2025 10:03
The gu_user_benefits_expiry cookie should keep a 1 day expiry. The
actual benefits cookies extend to 30 days.
@tjmw tjmw marked this pull request as ready for review December 4, 2025 10:18
@tjmw tjmw requested a review from a team as a code owner December 4, 2025 10:18
Copy link
Member

@rupertbates rupertbates left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, well done for updating the comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants