{
 "change": "Change 2 to the protocol",
 "made": "After the first results, after Change 1, and after a second pair of independent reviews, before any of the code below was written or run. One read-only probe ran first, only to confirm the fault a reviewer reported; its counts are under source_rule_correction.measured_before_this_change, and it measured no channel rate, share, forecast or prediction. The correction implements a rule declared before the first run; the readings are decided after results were seen, so each is a description, labelled so on the page where its number appears. No prediction is added and no frozen file changes.",
 "extends_protocol_sha256": "ef7c096f85747c0c22d7baca6ea3c1578063a67913d2a981093b228db12a199d",
 "frozen_files_sha256": {
  "protocol-r1.json": "ef7c096f85747c0c22d7baca6ea3c1578063a67913d2a981093b228db12a199d",
  "predictions-r1.json": "3820a6aa26ef3f66e57e793c3caf3fb28aa2de41b5a879eebf689c5398e43a16",
  "assumptions.json": "75b0e0b210d44b7bede5f979c30b94699178bfba779365350c0d0b182c282e85",
  "DESIGN-r1.md": "7da98586eb0b5290d795a9c71c2d769477362ffbd35426e2262acf49c9cebf2e",
  "protocol-r1-change-1.json": "a54d86705a0b773db7bffd1f241bf5c0ffc09dd7235f123878b1ee31e6652898"
 },
 "first_run_results_sha256": {
  "added_later.json": "fca205e84ba3d89d79e015af6c2e2d31d10401350faf3d468d5fe561bcc82a8a",
  "after_review.json": "87885fd9f8521274e3a453499c2d48355c4196f91b45d7b24cacb1ed37cac058",
  "attribution.json": "6aed8925aee874fcae8bee244a6461b113f387bc6a3a8fc4b8492acd0b9d67da",
  "audit.json": "0687e4cf74dd9a285373e2001506c7a4b834d12c226c23bdbac3b8617b68e315",
  "daily_by_channel.csv": "e5b8c4e3d31f1b992ce556b181ceb42fb8b15b119402b84c67a2d8f26a6039d0",
  "faults.json": "34e76eb27fafbbaad60255f524c67a7a3cce4f5fb9e2e11b1e469154cc268f9e",
  "forecast.json": "5138df99897884da0e45703c0621d74a0a9d4410e9aad8176f0259fc7708507a",
  "forecast_read_a.json": "b748716834b64ac399af1656c28bfb5b79da8342031c995b613ea046d130416e",
  "funnel.json": "05431bfc283580887e35f4c04986bc57ca472384ec6b6ff354cca658bf7eec6a",
  "structure.json": "f03b3833d603a1f07623f49f3b57798af1ade4571581ea6bbf0f971593f1363f",
  "summary.json": "93a85df002f31bacce6b8b5cbea3371266426e1ea14ea7e36d512692ae41501d",
  "weekly_flags.json": "ff6286b78ca1916d59a2cc7b0266f41df011d6af604da7fe21814d1fe21e6ee8"
 },
 "corrections": [
  {
   "id": "source_rule_correction",
   "declared_rule": "protocol-r1.json, sessions.source_medium: earliest event in the session carrying a source or medium parameter",
   "fault": "The first run's code (tools/ga4lib.py, sessions_sql) took the source from the earliest event carrying a source and, separately, the medium from the earliest event carrying a medium, because DuckDB's arg_min skips null values. Where a session's earliest tagged event carries a medium and no source, the two values came from different events, against the declared rule.",
   "measured_before_this_change": {
    "sessions": 360129,
    "sessions_where_a_value_comes_from_a_later_event": 3077,
    "sessions_whose_channel_changes": 2948,
    "organic_search_to_unknown": 2936,
    "referral_to_unknown": 12,
    "unknown_sessions_first_run": 152367,
    "unknown_sessions_under_the_declared_rule": 155315,
    "sessions_with_a_tie_at_the_earliest_tagged_timestamp": 0
   },
   "rule": "Both values come from one event: the earliest event in the session carrying a source or a medium, ordered by event timestamp and then by event id. A value that event lacks is missing, a placeholder under the protocol, so the session's channel is unknown.",
   "code": "tools/ga4lib.py: sessions_sql reads the environment variable STUDY_SOURCE_RULE. The value declared, the default from this change on, implements the rule above; first_run keeps the first run's code unchanged, so every file in results/ still reproduces. No other function of tools/ga4lib.py changes.",
   "rerun": "Every part that reads a session's source is re-run with the corrected code into results/corrected/, with the protocol's seeds and replicates: tools/run_study.py (the checks, both funnel reads, attribution, the daily table, the weekly flags and the faults), tools/summarize.py (the forecasts and the prediction scoring), tools/added_later.py and tools/after_review.py (Change 1). results/structure.json reads no session source and is not re-run.",
   "scoring": "The 15 predictions are scored as declared on the corrected run, beside the first run's scoring, which stays in results/summary.json. The page reports both scorings, and every first-run miss stays reported.",
   "presentation_rule": "The page's figures come from the corrected run, because it implements the declared rule. Where a headline or key figure moved, the page gives the first run's value at the number and says the code was corrected after review. A table compares the two runs on the figures that moved. No file in results/ outside results/corrected/ is edited."
  }
 ],
 "readings": [
  {
   "id": "referral_split",
   "why": "Under every rule the referral channel mixes outside sites with the store's own hosts, and last non-direct can hand an order's credit to an earlier store-host session, so the attribution table's referral row says nothing about outside referrers.",
   "store_host_session": "a session whose channel is referral and whose source contains googlemerchandisestore (the rule of Change 1)",
   "rule": "In the attribution table, referral is split into outside referral sites and the store's own hosts. Under session scope and last non-direct the split follows the session whose channel takes the credit; under user first touch it follows the user-level source and medium by the same rule. The two rows add up to the declared referral row, which stays in the table.",
   "orders": "the attribution table's orders: every purchase event kept by the flagged-removed read",
   "intervals": "differences against session scope with the store's own hosts split out: 95% percentile, Poisson bootstrap over users, 1,000 replicates, seed 5"
  },
  {
   "id": "store_host_return_attribution",
   "why": "Last non-direct looks back only from direct or unknown sessions, so a store-host session that brings back a visitor who first came another way keeps referral's credit; the Change 1 merge tests only a visit split within 30 minutes, which covers few store-host sessions.",
   "rule": "Last non-direct with store-host sessions treated like direct: an order whose session is direct, unknown or a store-host session takes the channel of the same user's latest earlier session, started in the previous 30 days, whose channel is known, not direct and not a store-host session. With no such session it keeps its own channel, a store-host session shown as the store's own hosts. The 30 days and the ordering by each session's first event are those of the declared last non-direct rule.",
   "reported": "share of orders per channel under this rule and its difference against session scope, with the store's own hosts split out in both, with the intervals of referral_split"
  },
  {
   "id": "store_host_return_rates",
   "why": "The channel purchase rates were never read with store-host sessions credited to the channel that first brought the visitor back, which is the case a split visit does not cover.",
   "rule": "Each store-host session takes the channel of the same user's latest earlier session, started in the previous 30 days, whose channel is known, not direct and not a store-host session, by the lookup of store_host_return_attribution. With no such session it stays in a row named the store's own hosts. Every other session keeps its channel. No session is merged, so each channel's rate is its sessions reaching a purchase over its sessions, in both reads.",
   "intervals": "the protocol's funnel: 95% percentile, Poisson bootstrap over users, 1,000 replicates, seed 4, both reads paired, through tools/ga4lib.py funnel()",
   "reported": "sessions and purchase rates per channel in both reads with intervals; how many store-host sessions took each channel, and how many of those reached a purchase",
   "presentation_rule": "The page says organic search stays above direct under this reading only if their 95% intervals are apart in both reads."
  },
  {
   "id": "return_counts",
   "rule": "Store-host sessions with an earlier session of the same user anywhere in the export, and with one whose first event is no more than 30 days before; for comparison, the share of all sessions that have an earlier session of the same user. Sessions are ordered by their first event.",
   "reported": "counts and shares, as a description"
  }
 ],
 "code": "tools/ga4lib.py (the switch above) and tools/change_2.py, writing results/corrected/change_2.json from the corrected sessions",
 "not_changed": "The channel rule, both reads, the checks, the attribution rules as declared, the forecasts, the faults, the seeds and the replicates. Change 1's rules stay as declared; only their input sessions follow the corrected source rule. Every first-run result keeps its file, and the page keeps reporting the first run's prediction verdicts."
}
