Skip to content

Add Gandalf sign-in gate: daily-view triggered mandatory popup, hosting and Ophan identity - #16708

Open
juabara wants to merge 10 commits into
mainfrom
nz-non-auxia-sign-in-gate
Open

Add Gandalf sign-in gate: daily-view triggered mandatory popup, hosting and Ophan identity#16708
juabara wants to merge 10 commits into
mainfrom
nz-non-auxia-sign-in-gate

Conversation

@juabara

@juabara juabara commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the client-side half of the Gandalf sign-in gate journey: a Guardian-managed,
100% rollout sign-in gate for configured countries (decisioning stays in SDC via
gandalfSignInGateCountries, initially NZ), with no Auxia involvement.

  • Trigger: the reader's daily view count (gu.history.dailyArticleCount) is
    sent to SDC in the existing gandalfPageViewCount field; SDC returns the
    mandatory popup from the 4th view of the day. The dedicated Gandalf counter
    was dropped in favour of the existing daily count.
  • Mandatory popup renders on mount: the v2 gate no longer waits for the
    inline #sign-in-gate host to scroll into view (it sits below the fold on
    long pages, which previously suppressed the popup entirely). Dismissible
    inline gates keep the scroll-deferred behaviour.
  • No Auxia involvement for Gandalf traffic: interaction logging
    (VIEWED/CLICKED/DISMISSED) is suppressed; responses carry the
    gandalfSignInGate marker. Non-Gandalf countries keep existing behaviour.
  • Hosting: #sign-in-gate portal hosts for fronts, tag pages, galleries,
    liveblogs, pictures and full-page interactives (surfaces without
    ArticleRenderer), plus a short/empty-body fallback in withSignInGateSlot.
  • Ophan: test GandalfSignInGate, variant gandalf-<country>.
  • Display exclusions (legal/help/tips URLs + sections) are unchanged and are
    the only exclusion applied — counting uses the daily view count as-is.

Known coverage note

gu.history.dailyArticleCount only increments for article, liveblog, gallery,
video, interactive and audio pages. Fronts, tag pages and crosswords are
display-eligible but never counted — readers who only browse those never see
the gate; readers with 3 counted views will hit the modal on a front.

Support the Gandalf sign-in gate journey (the Guardian-managed, Auxia-free
100% rollout): a dedicated persistent pageview counter, kept per country
because campaigns differ by country group and idempotent per Ophan pageview
id, that only advances once SDC confirms an active, eligible pageview via
the gandalfSignInGate response marker; the counter is sent to
/auxia/get-treatments so SDC can decide between the free-view marker and
the non-dismissible popup treatment. Gandalf responses report to Ophan
under a stable GandalfSignInGate identity with a per-country variant
(gandalf-<country>) and never call Auxia for treatment interactions.
Sign-in gate mount points are added to fronts, tag pages, galleries,
pictures, liveblogs and full page interactives, and withSignInGateSlot now
guarantees a host for bodies with fewer than two elements so the v2 popup
can be selected everywhere the journey applies.
@juabara juabara added the feature Departmental tracking: work on a new feature label Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

Hello 👋! When you're ready to run Chromatic, please apply the run_chromatic label to this PR.

You will need to reapply the label each time you want to run Chromatic.

Click here to see the Chromatic project.

@juabara juabara added the run_chromatic Runs chromatic when label is applied label Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

🚀 Image pushed to AWS ECR

Image digest: sha256:68d3db61d11e4b3d93bfb64472ca62c87473afbf83cb46009eb92d2bf87a8ccc

🐛 Run the image locally

The following can be used to run the image locally:

# Refer to image using the immutable digest. Find alternatives below.
IMAGE_IDENTIFIER="@sha256:68d3db61d11e4b3d93bfb64472ca62c87473afbf83cb46009eb92d2bf87a8ccc"

# Refer to image using branch tag
# IMAGE_IDENTIFIER=":branch-nz-non-auxia-sign-in-gate"

# Refer to image using build tag
# IMAGE_IDENTIFIER=":build-31130"

# Refer to image via the GitHub commit SHA tag
# IMAGE_IDENTIFIER=":sha-f3ad7606efee2b1908322cceacfcb169ea3358ff"

# Set environment variables for the AWS CLI
AWS_PROFILE="<A_PROFILE_FROM_JANUS>"
AWS_DEFAULT_REGION="eu-west-1"

IMAGE_ACCOUNT_ID=$(aws ssm get-parameter --name /organisation/accounts/artifacts --query "Parameter.Value" --output text)
REGISTRY="${IMAGE_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com"
IMAGE="${REGISTRY}/guardian/dotcom-rendering${IMAGE_IDENTIFIER}"

# Login to AWS ECR https://docs.aws.amazon.com/AmazonECR/latest/userguide/registry_auth.html
aws ecr get-login-password | docker login --username AWS --password-stdin $REGISTRY

# Pull the image
docker pull $IMAGE

# Run the image. You'll likely need to set additional flags. See https://docs.docker.com/reference/cli/docker/container/run.
docker run $IMAGE

From guardian/actions-publish-image.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

@github-actions github-actions Bot removed the run_chromatic Runs chromatic when label is applied label Sep 9, 2026
Juarez Mota added 2 commits September 9, 2026 14:42
Support the Gandalf sign-in gate journey (the Guardian-managed, Auxia-free
100% rollout): a dedicated persistent pageview counter, kept per country
because campaigns differ by country group and idempotent per Ophan pageview
id, that only advances once SDC confirms an active, eligible pageview via
the gandalfSignInGate response marker; the counter is sent to
/auxia/get-treatments so SDC can decide between the free-view marker and
the non-dismissible popup treatment. Gandalf responses report to Ophan
under a stable GandalfSignInGate identity with a per-country variant
(gandalf-<country>) and never call Auxia for treatment interactions.
Sign-in gate mount points are added to fronts, tag pages, galleries,
pictures, liveblogs and full page interactives, and withSignInGateSlot now
guarantees a host for bodies with fewer than two elements so the v2 popup
can be selected everywhere the journey applies.
…m-rendering into nz-non-auxia-sign-in-gate
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

Juarez Mota and others added 5 commits September 10, 2026 12:17
The v2 gate only rendered once the inline #sign-in-gate host element
intersected the viewport (useIsInView). That is correct for the inline
dismissible gate, but the non-dismissible popup is a modal: on long pages
the host sits far below the fold, so the popup never appeared. Render it
on mount and record its VIEW event immediately.
…king

The mandatory popup now records its VIEW event exactly once per treatment
identity (treatmentId + treatmentTrackingId) by tracking the last recorded
view in a ref. Visibility changes, equivalent treatment objects supplied as
new props, and StrictMode effect replays no longer duplicate the view count,
Ophan event, or Auxia interaction. A new treatment identity or component
remount still records a fresh view as intended.
The Gandalf sign-in gate counter is now global rather than per-country. Storage keys, function signatures, and tests updated to remove countryCode parameter. Counter still advances once per eligible pageview via idempotent pageview ID tracking.
… gate

The Gandalf sign-in gate now uses gu.history.dailyArticleCount instead of a dedicated persistent counter. The daily count resets each day and is sent 0-based (current pageview excluded) to SDC. Remove gandalf.ts module, incrementGandalfPageViewCount calls, ophanPageViewId parameter from canShowSignInGatePortal, and update tests and comments to reflect the new counting mechanism.
@juabara juabara changed the title Add Gandalf sign-in gate counter, popup hosting and Ophan identity Add Gandalf sign-in gate: daily-view triggered mandatory popup, hosting and Ophan identity Sep 14, 2026
…m-rendering into nz-non-auxia-sign-in-gate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Departmental tracking: work on a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant