# UTM Tracking Verification Checklist

**Last Updated:** 2026-01-29

Use this checklist to verify UTM tracking is working correctly on any landing page.

## Pre-Testing Setup

- [ ] Enable debug mode: Add `?utm_debug=true` to test URL
- [ ] Open browser DevTools (F12)
- [ ] Go to Console tab
- [ ] Go to Application tab → Cookies (for cookie inspection)
- [ ] Go to Network tab (for form submission testing)

## Test 1: URL Parameter Extraction

**Test URL:** `https://www.ordio.com/schichtbetriebe?utm_source=adwords&utm_medium=ppc&utm_campaign=test&utm_term=keyword&hsa_acc=1887350035&hsa_cam=20035390960&utm_debug=true`

- [ ] Page loads without redirect
- [ ] Console shows "UTM Tracker initialized"
- [ ] Console shows "UTM parameters extracted"
- [ ] All UTM parameters visible in initial URL
- [ ] `hsa_*` parameters visible in initial URL

## Test 2: Cookie Storage

**Wait 1 second after page load**

- [ ] Console shows "UTM cookies set" (if debug mode enabled)
- [ ] Check cookies: `document.cookie` contains `utm_source=adwords`
- [ ] Check cookies: `document.cookie` contains `utm_campaign=test`
- [ ] Check cookies: `document.cookie` contains `hsa_acc=1887350035`
- [ ] Check cookies: `document.cookie` contains `hsa_cam=20035390960`
- [ ] Verify cookie domain: `.ordio.com` (check DevTools → Application → Cookies)
- [ ] Verify cookie expiration: 90 days from now
- [ ] Verify cookie attributes: `Secure`, `SameSite=None` (for HTTPS)

## Test 3: localStorage Fallback

**Check localStorage**

- [ ] `localStorage.getItem('ordio_utm_data')` returns JSON object
- [ ] JSON contains all UTM parameters
- [ ] JSON contains all `hsa_*` parameters
- [ ] JSON contains `timestamp` field
- [ ] Data age is less than 90 days

## Test 4: URL Cleanup

**Wait 1.5 seconds after page load**

- [ ] Console shows "UTM parameters cleaned from URL" (if debug mode enabled)
- [ ] URL no longer contains `utm_source`, `utm_medium`, `utm_campaign`, `utm_term`, `utm_content`
- [ ] URL no longer contains `gclid`
- [ ] URL still contains `hsa_*` parameters (preserved)
- [ ] URL still contains `gad_source`, `gbraid` (if present, preserved)
- [ ] Console shows cleanup event: `utmCleanupComplete` event fired

## Test 5: UTM Tracker Methods

**Check JavaScript methods**

- [ ] `typeof window.utmTracker` returns `"object"`
- [ ] `window.utmTracker.getAllUTMData()` returns object with UTM data
- [ ] `window.utmTracker.getUTMCookies()` returns object with cookie data
- [ ] `window.utmTracker.getCookie('utm_source')` returns `"adwords"`
- [ ] `window.utmTracker.getUTMDataForAPI()` returns object (for form submission)

## Test 6: Cross-Page Tracking

**Navigate to another page**

- [ ] Cookies persist after navigation
- [ ] `document.cookie` still contains UTM parameters
- [ ] `localStorage.getItem('ordio_utm_data')` still contains data
- [ ] UTM tracker can read from cookies on new page

## Test 7: Form Submission

**Submit a form on the page**

- [ ] Form includes UTM hidden fields (check HTML)
- [ ] Form JavaScript reads from `window.utmTracker.getUTMDataForAPI()`
- [ ] Network tab shows form submission includes UTM parameters
- [ ] Form data includes: `utm_source`, `utm_medium`, `utm_campaign`, `utm_term`
- [ ] Form data includes: `hsa_acc`, `hsa_cam`, `hsa_grp`, etc.
- [ ] Form data includes: `gclid` (if present)
- [ ] Form data includes: `leadSource`, `partner` (if present)

## Test 8: HubSpot Integration

**Check HubSpot contact record**

- [ ] Contact record created/updated in HubSpot
- [ ] UTM fields populated: `utm_source`, `utm_medium`, `utm_campaign`, `utm_term`, `utm_content`
- [ ] Google Ads fields populated: `hsa_acc`, `hsa_cam`, `hsa_grp`, etc.
- [ ] `gclid` field populated (if present)
- [ ] `leadSource` field populated correctly
- [ ] Campaign attribution correct in HubSpot

## Test 9: Google Ads Specific

**Test with full Google Ads URL**

**Test URL:** `https://www.ordio.com/schichtbetriebe?utm_term=zeiterfassungssystem&utm_campaign=DE_Search_G_Zeiterfassung&utm_source=adwords&utm_medium=ppc&hsa_acc=1887350035&hsa_cam=20035390960&hsa_grp=147983147426&hsa_ad=794209776392&hsa_src=g&hsa_tgt=kwd-481676113&hsa_kw=zeiterfassungssystem&hsa_mt=e&hsa_net=adwords&hsa_ver=3&gad_source=1&gad_campaignid=20035390960&gbraid=0AAAAA-VBNudgaT4zVhWHssiv-zEfYkJTO&gclid=Cj0KCQiAp-zLBhDkARIsABcYc6uSljY89kZjnUBqF02QSjhW58HJJF-u25EwhVr3jCdMhs6PpqR2e20aAq9gEALw_wcB&utm_debug=true`

- [ ] All `hsa_*` parameters extracted correctly
- [ ] All `hsa_*` parameters stored in cookies
- [ ] All `hsa_*` parameters preserved in URL after cleanup
- [ ] `gclid` extracted and stored in cookies
- [ ] `gclid` cleaned from URL (not preserved)
- [ ] `gad_source`, `gbraid` preserved in URL
- [ ] Form submission includes all `hsa_*` parameters
- [ ] HubSpot receives all `hsa_*` parameters

## Test 10: Edge Cases

**Test various scenarios**

- [ ] URL with UTMs only (no hsa\_\*)
- [ ] URL with hsa\_\* only (no UTMs)
- [ ] URL with both UTMs and hsa\_\*
- [ ] URL with gclid only
- [ ] URL with duplicate parameters (last value used)
- [ ] Empty/null parameter values handled correctly
- [ ] Special characters in parameters encoded correctly
- [ ] Very long parameter values handled correctly

## Test 11: Browser Compatibility

**Test in different browsers**

- [ ] Chrome (primary)
- [ ] Firefox
- [ ] Safari
- [ ] Edge
- [ ] Mobile Chrome
- [ ] Mobile Safari

## Test 12: Performance

**Check performance impact**

- [ ] Page load time not significantly affected
- [ ] Cookie setting doesn't block rendering
- [ ] URL cleanup doesn't cause layout shift
- [ ] Script execution time < 100ms
- [ ] No console errors or warnings

## Automated Testing

**Use test scripts**

- [ ] Run basic test: `/v2/scripts/dev-helpers/test-utm-tracking.php`
- [ ] Run comprehensive test: `/v2/scripts/dev-helpers/test-utm-tracking-comprehensive.php`
- [ ] All test cases pass
- [ ] No errors in test output

## Production Verification

**Test on production**

- [ ] Test with real Google Ads link
- [ ] Verify cookies persist across sessions
- [ ] Test form submission end-to-end
- [ ] Monitor HubSpot contact records
- [ ] Check analytics tracking
- [ ] Verify conversion tracking works

## Troubleshooting

If any test fails:

1. **Enable debug mode:** Add `?utm_debug=true` to URL
2. **Check console logs:** Look for error messages
3. **Verify cookies:** Check DevTools → Application → Cookies
4. **Check localStorage:** `localStorage.getItem('ordio_utm_data')`
5. **Review documentation:** [UTM Tracking Debugging Guide](./UTM_TRACKING_DEBUGGING.md)
6. **Contact development team:** Provide test results and console logs

## Success Criteria

All tests should pass for UTM tracking to be considered working correctly:

- ✅ UTMs extracted from URL
- ✅ Cookies set correctly (90-day expiration)
- ✅ localStorage fallback works
- ✅ URL cleaned after 1.5 seconds (UTMs removed)
- ✅ hsa\_\* parameters preserved in URL
- ✅ Forms read from cookies
- ✅ HubSpot receives complete UTM data
- ✅ Cross-page tracking works
- ✅ All browsers supported
- ✅ Performance acceptable

## Related Documentation

- [UTM Tracking Debugging Guide](./UTM_TRACKING_DEBUGGING.md)
- [Canonical Tags & Tracking Preservation](../../seo/CANONICAL_TAGS_TRACKING_PRESERVATION.md)
- [Google Ads UTM Fix](../../google-ads/UTM_PARAMETER_FIX_SCHICHTBETRIEBE.md)
