|
| 1 | +# Prioritized Test Plan for `Universal-Federated-Analytics.js` |
| 2 | + |
| 3 | +## Priority 1 |
| 4 | + |
| 5 | +These cover the highest-value public behavior with the least setup risk. |
| 6 | + |
| 7 | +1. `gas()` legacy API |
| 8 | + - `gas('send','pageview', ...)` emits `page_view` |
| 9 | + - `gas('send','pageview', ..., title)` uses explicit title |
| 10 | + - `gas('send','event', ...)` emits `dap_event` |
| 11 | + - `gas('send','event', ...)` defaults `event_value` to `0` when missing or invalid |
| 12 | + - `gas('send','event', ..., nonInteraction=true)` maps `non_interaction` |
| 13 | + - invalid `gas()` calls do not emit unexpected events |
| 14 | + |
| 15 | +2. `gas4()` core helper coverage |
| 16 | + - `gas4('page_view', {...})` emits `page_view` |
| 17 | + - unsupported `gas4()` name falls back to `dap_event` |
| 18 | + - supported event with empty params object still emits event |
| 19 | + - `gas4()` with malformed args does not emit |
| 20 | + - `gas4('view_search_results', ...)` explicit call emits expected event |
| 21 | + |
| 22 | +3. Autotracker link classifications |
| 23 | + - internal `mailto:` emits `email_click` |
| 24 | + - external `mailto:` emits `email_click` |
| 25 | + - formatted telephone link emits `telephone_click` |
| 26 | + - invalid or ignored telephone link does not emit |
| 27 | + - generic external link emits `click` |
| 28 | + - social share link emits `share` |
| 29 | + |
| 30 | +4. Existing config behavior hardening |
| 31 | + - agency-only config sets expected defaults |
| 32 | + - omitted site topic/platform fall back to `unspecified:<domain>` |
| 33 | + - autotracker toggle off suppresses tracked click classes beyond downloads |
| 34 | + |
| 35 | +## Priority 2 |
| 36 | + |
| 37 | +These cover important user-visible functionality but need a bit more page interaction logic. |
| 38 | + |
| 39 | +1. `gas4()` event family matrix |
| 40 | + - `social_click` |
| 41 | + - `share` |
| 42 | + - `navigation_click` |
| 43 | + - `accordion_click` |
| 44 | + - `faq_click` |
| 45 | + - `cta_click` |
| 46 | + - `content_view` |
| 47 | + - `sort` |
| 48 | + - `filter` |
| 49 | + - `error` |
| 50 | + - `was_this_helpful_submit` |
| 51 | + |
| 52 | +2. Parameter-shape resilience |
| 53 | + - “incorrect parameter” examples still emit the supported event name |
| 54 | + - emitted payload preserves only provided keys |
| 55 | + - invalid event name plus valid payload falls back to `dap_event` |
| 56 | + |
| 57 | +3. Search and querystring handling |
| 58 | + - page URL with search param emits `view_search_results` |
| 59 | + - search term is preserved in event payload |
| 60 | + - non-search query params are scrubbed from tracked page location |
| 61 | + - allowlisted agency query params remain in tracked page location |
| 62 | + - disallowed query params are removed |
| 63 | + |
| 64 | +4. Dynamic DOM tracking |
| 65 | + - dynamically inserted links are tracked by autotracker |
| 66 | + - dynamic downloadable link emits `file_download` |
| 67 | + |
| 68 | +## Priority 3 |
| 69 | + |
| 70 | +These are valuable but slower, more brittle, or likely to need harness work. |
| 71 | + |
| 72 | +1. HTML5 media tracking |
| 73 | + - video start |
| 74 | + - video pause |
| 75 | + - video progress milestone |
| 76 | + - video complete |
| 77 | + - audio start/pause/progress/complete if applicable on page |
| 78 | + |
| 79 | +2. YouTube tracking |
| 80 | + - YouTube enabled loads tracker and emits `video_start` |
| 81 | + - emits `video_play` |
| 82 | + - emits `video_pause` |
| 83 | + - emits `video_progress` |
| 84 | + - emits `video_complete` |
| 85 | + - handles player error with `video_error` |
| 86 | + |
| 87 | +3. Environment/config toggles |
| 88 | + - `youtube=true` enables YouTube tracking |
| 89 | + - `htmlvideo=false` suppresses HTML5 media tracking |
| 90 | + - `webvitals=true` or homepage conditions inject/report vitals behavior |
| 91 | + - dev env switches GA property ID as expected |
| 92 | + - production/staging query handling stays correct |
| 93 | + |
| 94 | +4. Parallel/custom-dimension variants |
| 95 | + - parallel tracker custom dimension mapping |
| 96 | + - alternate dimension names via query params |
| 97 | + - script source / protocol / hostname dimensions present when expected |
| 98 | + |
| 99 | +## Priority 4 |
| 100 | + |
| 101 | +These are lower ROI or better suited to unit-style tests around pure helpers. |
| 102 | + |
| 103 | +1. URL/PII sanitization internals |
| 104 | + - scrub email-like values from URLs |
| 105 | + - scrub phone-like values |
| 106 | + - nested querystring redaction |
| 107 | + - allowed-querystring merging behavior |
| 108 | + - object-to-query / query-to-object round trips where relied upon |
| 109 | + |
| 110 | +2. Defensive/error-tolerance paths |
| 111 | + - malformed URLs do not break tracking |
| 112 | + - missing `dataLayer` initialization path recovers |
| 113 | + - bad media state changes do not throw |
| 114 | + - missing banner element is harmless |
| 115 | + |
| 116 | +## Recommended Rollout |
| 117 | + |
| 118 | +1. Add `10-15` Priority 1 scenarios first. |
| 119 | +2. Add `10-12` Priority 2 scenarios next. |
| 120 | +3. Decide whether media/video coverage belongs in Cucumber or a thinner harness. |
| 121 | +4. Cover the remaining helper/sanitization logic with lower-level tests if possible. |
0 commit comments