How shingzhanho/openinsteam-chrome works
Project type and purpose
• Type: Browser extension (Chrome).
• Purpose: On Steam website pages, inject a button that opens the current page in the locally installed Steam client, and send usage metrics to Google Analytics.
File structure
• manifest.json – extension descriptor (permissions, content scripts).
• js/
– script.js: content script runs in page context to inject UI and handle clicks.
– ga.js, gtag.js: analytics libraries for event tracking.
• css/page-element-style.css – styling for the injected button.
• README.md – high-level description, usage guide, privacy policy.
Extract key components
a. Chrome Browser (extension host)
b. OpenInSteam Extension
– Manifest (registration, permissions)
– Analytics Modules (ga.js, gtag.js)
c. Steam Web Page (target domain)
d. Steam Client (native handler via steam:// protocol)
e. Google Analytics (external service)
Interactions and data flows
1. Chrome user navigates to a Steam page (e.g., store.steampowered.com).
2. Chrome’s extension engine injects script.js and page-element-style.css into the page.
4. On button click:
– script.js triggers navigation to steam://… URI → OS launches Steam Client.
– script.js (via ga.js/gtag.js) sends an event to Google Analytics servers.
5. Google Analytics aggregates usage metrics.
Architectural patterns and design principles
• Separation of concerns:
– manifest.json defines capabilities and injection points.
– Content script handles UI and protocol calls.
– Analytics modules isolated from business logic.
• Client-side-only architecture: no backend; all logic runs in browser or native Steam handler.
• Minimal external dependency: only Google Analytics.
Essential elements
• File grouping to show how the project’s directory maps to components.