game-analytics
Analyzes game data metrics for player behavior tracking and performance optimization.
What this skill does
## Purpose
This skill analyzes game data metrics to track player behavior and optimize performance, processing logs, sessions, and metrics from games.
## When to Use
Use this skill for processing in-game data during development, such as identifying player drop-off in levels, optimizing resource usage, or debugging performance bottlenecks in real-time multiplayer games.
## Key Capabilities
- Parse JSON-formatted game logs to extract metrics like session duration and player actions (e.g., via `claw game-analytics parse --input logs.json`).
- Generate reports for behavior tracking, such as heatmaps of player movement using API endpoint `GET /api/analytics/reports/heatmap?gameId=123`.
- Perform optimization queries, like querying for high-latency events with SQL-like filters (e.g., config in YAML: `metrics: [latency > 500ms]`).
- Integrate with ML models for predictive analytics, e.g., predict churn based on play patterns using embedded functions like `claw game-analytics predict --model churn.json`.
## Usage Patterns
Always initialize with authentication via environment variable `$GAME_ANALYTICS_API_KEY`. For CLI, run commands in a project directory with game data files. In code, import as a module and call functions directly. Use asynchronous patterns for large datasets to avoid blocking. For example, chain commands: first parse data, then analyze. Handle outputs as JSON streams for piping to other tools.
## Common Commands/API
- CLI Command: `claw game-analytics analyze --file data.json --metric player-session --output report.csv` (parses file, filters by metric, saves to CSV; requires $GAME_ANALYTICS_API_KEY).
- API Endpoint: `POST /api/analytics/track` with body `{ "event": "player_login", "data": { "sessionId": "abc123", "timestamp": "2023-10-01T12:00:00Z" } }` (sends tracking data; authenticate with Bearer token from $GAME_ANALYTICS_API_KEY).
- Code Snippet (Python):
```python
import claw
api_key = os.environ.get('GAME_ANALYTICS_API_KEY')
response = claw.analytics.track(event='level_complete', data={'level': 5}, api_key=api_key)
print(response.json())
```
- Config Format: YAML file for custom metrics, e.g.,
```
metrics:
- name: session_length
threshold: 300 # seconds
filters:
- player_type: 'new'
```
Load with `claw game-analytics load-config config.yaml`.
## Integration Notes
Integrate by setting $GAME_ANALYTICS_API_KEY in your environment before running commands. For web apps, use OAuth via `claw game-analytics auth --provider google` to get a token. In Node.js projects, require the module and handle promises:
```javascript
const claw = require('claw');
claw.analytics.setKey(process.env.GAME_ANALYTICS_API_KEY);
claw.analytics.analyze({ file: 'data.json' }).then(data => console.log(data));
```
Ensure data formats match (e.g., JSON inputs only). For cluster integration, link with 'game-dev' tools by prefixing commands, like `claw game-dev game-analytics analyze`.
## Error Handling
Check for errors by inspecting exit codes in CLI (e.g., code 401 means auth failure; retry with `claw game-analytics retry --command analyze`). In API calls, catch HTTP errors: if status 403, log "Invalid API key" and prompt for $GAME_ANALYTICS_API_KEY reset. Use try-except in code snippets:
```python
try:
result = claw.analytics.analyze(file='data.json')
except claw.AnalyticsError as e:
if e.code == 'AUTH_FAILED':
print("Set GAME_ANALYTICS_API_KEY and retry")
```
Always validate inputs before processing to avoid parsing errors (e.g., ensure JSON is well-formed).
## Concrete Usage Examples
1. To track player behavior in a mobile game: First, export logs to JSON, then run `claw game-analytics analyze --file player_logs.json --metric drop-off` to identify levels with high quit rates. Use the output to adjust game design, e.g., via API: `POST /api/analytics/optimize` with { "suggestions": true }.
2. For performance optimization in a multiplayer server: Load config with `claw game-analytics load-config perf.yaml`, then execute `claw game-analytics query --metric latency --filter 'server=prod'` to get reports. Integrate into a CI/CD pipeline to automate checks, using code:
```javascript
claw.analytics.query({ metric: 'latency' }).then(results => {
if (results.avg > 100) console.log('Optimize server');
});
```
## Graph Relationships
- Related to: game-dev cluster (parent), player-tracking skill (dependency), data-metrics skill (sibling).
- Connects with: game-logging for input data, performance-optimization for action outputs.
Related in Data & Analytics
clawarr-suite
IncludedComprehensive management for self-hosted media stacks (Sonarr, Radarr, Lidarr, Readarr, Prowlarr, Bazarr, Overseerr, Plex, Tautulli, SABnzbd, Recyclarr, Unpackerr, Notifiarr, Maintainerr, Kometa, FlareSolverr). Deep library exploration, analytics, dashboard generation, content management, request handling, subtitle management, indexer control, download monitoring, quality profile sync, library cleanup automation, notification routing, collection/overlay management, and media tracker integration (Trakt, Letterboxd, Simkl).
querying-soql
IncludedSOQL query generation, optimization, and analysis with 100-point scoring. Use this skill when the user needs SOQL/SOSL authoring or optimization: natural-language-to-query generation, relationship queries, aggregates, query-plan analysis, and performance or safety improvements for Salesforce queries. TRIGGER when: user writes, optimizes, or debugs SOQL/SOSL queries, touches .soql files, or asks about relationship queries, aggregates, or query performance. DO NOT TRIGGER when: bulk data operations (use handling-sf-data), Apex DML logic (use generating-apex), or report/dashboard queries.
app-store-optimization
IncludedApp Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklists, and tracking ranking changes.
habit-flow
IncludedAI-powered atomic habit tracker with natural language logging, streak tracking, smart reminders, and coaching. Use for creating habits, logging completions naturally ("I meditated today"), viewing progress, and getting personalized coaching.
app-store-optimization
IncludedApp Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklists, and tracking ranking changes.
visualizing-data
IncludedBuilds dashboards, reports, and data-driven interfaces requiring charts, graphs, or visual analytics. Provides systematic framework for selecting appropriate visualizations based on data characteristics and analytical purpose. Includes 24+ visualization types organized by purpose (trends, comparisons, distributions, relationships, flows, hierarchies, geospatial), accessibility patterns (WCAG 2.1 AA compliance), colorblind-safe palettes, and performance optimization strategies. Use when creating visualizations, choosing chart types, displaying data graphically, or designing data interfaces.