Skip to content

fix(playground): add debug console logs for event flow#368

Merged
anonvt merged 1 commit into
mainfrom
fix/playground-debug-logs
Apr 16, 2026
Merged

fix(playground): add debug console logs for event flow#368
anonvt merged 1 commit into
mainfrom
fix/playground-debug-logs

Conversation

@anonvt
Copy link
Copy Markdown
Collaborator

@anonvt anonvt commented Apr 16, 2026

Summary

  • Adds console.debug logs throughout the playground to trace the full event lifecycle
  • Helps diagnose why impressions aren't firing on the deployed playground

Debug points

  • ensureAnalyticsLoaded(): token presence, script load success/failure, window.TS state after load
  • Form submit: element type, card attributes, DOM insertion confirmation
  • attachEventListener: which elements get topsort listeners
  • topsort CustomEvent: event type and product when received
  • Token change handler: when it fires and whether it sets the token
  • Clear button: reset confirmation

Notes

  • Uses console.debug which only shows with DevTools "Verbose" log level enabled
  • No runtime behavior changes

Test plan

  • Deploy, open DevTools with Verbose logging, add a product element, check for [Playground] logs

🤖 Generated with Claude Code

Adds console.debug logs throughout the playground to trace:
- analytics.js initialization (token presence, script load/error)
- Element creation and DOM insertion
- topsort CustomEvent attachment and receipt
- Token change handler firing
- Clear/reset actions

These logs only appear with DevTools verbose logging enabled.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@anonvt anonvt merged commit 48ed55a into main Apr 16, 2026
4 checks passed
@anonvt anonvt deleted the fix/playground-debug-logs branch April 16, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant