Attribution and page readiness checks

Two opt-in LTI catalog checks implement DONUI-T-026 and DONUI-T-005. Each takes one clean form URL, for example https://sandbox.donate.citizengo.org/en-us or its /md route. They require the configured acceptance environment and DonUI allowlist. Production-shaped legacy inputs are resolved through the existing target mapper; production execution itself is rejected.

UTM attribution

testUtmAttribution adds fixed synthetic source, medium, campaign, content and term values. It checks actual campaign session state, clicks one amount, compares the outgoing analytics payload locally, checks information-step state, then reloads. Request interception blocks the analytics write; no information is submitted, and no payment controls are touched.

The click schema intentionally puts the button ID in top-level utm_content. Incoming content and term are verified in campaign_info, where the existing DonUI contract preserves them; the checker must not confuse these two meanings.

Evidence is deliberately limited to the expanded destination/form/analytics boundary. This does not verify short-link creation, a FRAPI donation POST, provider settlement or accounting. Those require a separate approved synthetic transaction and shortener validation; do not label this as end-to-end revenue attribution. DonUI PaymentBase also uses the same campaign/source/medium state, but source inspection alone is not hosted payment evidence.

Readiness and stability

testPageReadiness instruments a fresh Chrome session before navigation and disables browser cache/service workers. From navigation start, it waits for the heading, enabled amounts, currency and next button; loaded fonts and rendered images; and 500 ms of geometry stability. This must finish within 3,000 ms. It then observes another second for late shifts. Geometry tolerance is 1 px. Hidden, disabled, missing and occluded controls cannot satisfy readiness. Text, currency and rendered-image changes also count as instability, including changes that preserve element dimensions. Normal vertical scrolling is allowed; horizontally unreachable controls and overlaid controls in the viewport are rejected. This is full-page readiness, not an above-the-fold design requirement. Scheduled monthly flags select /md.

This defines usable form readiness, not all third-party network activity. Navigation load-event time is recorded separately and may finish later. Checks use eager DOMContentLoaded navigation; a still-pending ancillary load is labeled pending_after_observation, not a false readiness failure or fabricated timing. Results are specific to the recorded viewport and unthrottled synthetic browser, not mobile-device population percentiles. Slow or moving pages fail and retain timings; never increase the budget solely to make a run pass.

Safety and validation

Non-read fetch/XHR, beacons and native submissions are blocked before navigation; provider and FRAPI network destinations are additionally blocked. No donor data is entered. Safe navigation combines these blocks with the production-host denylist, and evidence collection refreshes navigation load timing after load. Only allowlisted synthetic attribution fields are inspected. The choice-only migration creates no queue entries or schedules.

Offline positive/negative Chrome fixtures run through DJANGO_SETTINGS_MODULE=main.settings_ci LTI_LOCAL_BROWSER_TESTS=1 python manage.py test test_interface.tests_donui_observation. Use the repository's explicit CI module list, never unscoped live test discovery. Deployment does not authorize recurring enrollment or legacy queue replay.