Agent skill
spitakolus-tracking-analytics
Understand and work with Spitakolus shared tracking infrastructure. GTM containers, GA4 properties, BigQuery datasets, consent mode, and event naming.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/spitakolus-tracking-analytics
SKILL.md
Spitakolus Tracking & Analytics
π― Overview
All Spitakolus projects share tracking infrastructure with project separation via hostname routing.
Golden Rule: Data flows correctly when hostname conditions are set properly.
π Shared Infrastructure IDs
| System | ID | Purpose |
|---|---|---|
| GTM Web Container | GTM-PD5N4GT3 | Shared, hostname routing |
| GTM Server Container | GTM-THB49L3K | Server-side tracking |
| Server URL | gtm.nastahem.com | First-party domain |
| BigQuery Project | nastahem-tracking | Shared data warehouse |
GA4 Properties (per project)
| Project | Measurement ID | Domain |
|---|---|---|
| Flocken | G-7B1SVKL89Q | flocken.info |
| NΓ€sta Hem | G-7N67P0KT0B | nastahem.com |
π§ GTM Architecture
GTM-PD5N4GT3 (Shared Web Container)
βββ Tags
β βββ Google Tag - Flocken
β β βββ Tag ID: G-7B1SVKL89Q
β β βββ Condition: Page Hostname = flocken.info
β β
β βββ Google Tag - NΓ€sta Hem
β βββ Tag ID: G-7N67P0KT0B
β βββ Condition: Page Hostname = nastahem.com
β
βββ Triggers (hostname-based)
βββ Page View - Flocken (hostname = flocken.info)
βββ Page View - NΓ€sta Hem (hostname = nastahem.com)
Hostname Routing Rules
ALWAYS use hostname conditions:
- β
Page Hostname equals flocken.info - β
Page Hostname equals nastahem.com - β Never use URL-based conditions
- β Never omit conditions (causes cross-contamination)
π BigQuery Structure
nastahem-tracking/
βββ flocken_raw/ # Raw GA4 export
βββ flocken_curated/ # Cleaned data
βββ flocken_marts/ # Business metrics
β
βββ nastahem_raw/ # Raw GA4 export
βββ nastahem_curated/ # Cleaned data
βββ nastahem_marts/ # Business metrics
Dataset Naming Convention
Format: [project]_[type]
| Type | Purpose |
|---|---|
_raw |
Raw GA4 export (events_YYYYMMDD) |
_curated |
Cleaned, standardized events |
_marts |
Business intelligence metrics |
Important: Location = EU
All datasets MUST be created with location='EU' for GDPR compliance.
π Consent Mode v2
All projects use Consent Mode v2 with default denied:
window.dataLayer.push({
'event': 'consent_default',
'analytics_storage': 'denied',
'ad_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied',
'functionality_storage': 'granted',
'security_storage': 'granted'
});
Cookie Banner Updates Consent:
- User accepts β
gtag('consent', 'update', {...}) - Tracking only fires AFTER consent granted
GTM Tag Consent Controls
Every Google Tag must have these consent controls enabled:
ad_storageβad_personalizationβad_user_dataβanalytics_storageβ
π·οΈ Event Naming Convention
Standard Events (GA4 Enhanced Measurement)
page_view- Page loadsscroll- 90% scroll depthclick- Outbound linksfile_download- File downloadsvideo_start,video_progress,video_complete
Custom Events Format
Format: [action]_[object]
Examples:
sign_up- User registrationapp_install- App installationlisting_created- New listingmessage_sent- Message sent
UTM Parameters
Always include for attribution:
utm_source- Traffic sourceutm_medium- Marketing mediumutm_campaign- Campaign name (use cid!)utm_content- Ad variation
π Adding New Project to Tracking
Step 1: Create GA4 Property
- Google Analytics β Create Property
- Save Measurement ID (G-XXXXXXXXXX)
Step 2: Add to GTM
- GTM β Container GTM-PD5N4GT3
- Create new Google Tag with Measurement ID
- CRITICAL: Add hostname trigger condition
Step 3: Create BigQuery Datasets
CREATE SCHEMA `nastahem-tracking.[project]_raw` OPTIONS(location='EU');
CREATE SCHEMA `nastahem-tracking.[project]_curated` OPTIONS(location='EU');
CREATE SCHEMA `nastahem-tracking.[project]_marts` OPTIONS(location='EU');
Step 4: Link GA4 β BigQuery
- GA4 β Admin β BigQuery Linking
- Project: nastahem-tracking
- Location: EU
- Dataset: [project]_raw
β οΈ Common Mistakes to Avoid
| Mistake | Consequence | Fix |
|---|---|---|
| Missing hostname condition | Data goes to wrong GA4 | Always add hostname trigger |
| Wrong Measurement ID | Data lost | Double-check ID |
| Dataset location != EU | GDPR violation | Always use EU |
| Consent not implemented | Legal issues | Use Consent Mode v2 |
| Hardcoded tracking IDs | Works in dev, fails in prod | Use environment variables |
π Debugging Checklist
When tracking isn't working:
- GTM Preview Mode: Is the right tag firing?
- Hostname check: Is the condition correct?
- Consent check: Did user accept cookies?
- Network tab: Are requests going to google-analytics.com?
- GA4 Realtime: Is data appearing?
- BigQuery: Is export enabled and working?
π Growth Loop Integration
Tracking is the foundation of the AI Growth Loop:
- Data Collection β GTM + GA4 + BigQuery
- Analysis β Query BigQuery for patterns
- AI Generation β Use insights for new ads
- Optimization β Track performance, pause losers
Every event you track becomes data for the Growth Loop.
π Detailed Documentation
- GTM_SHARED_CONTAINER.md
- BIGQUERY_SHARED_PROJECT.md
- Project-specific: See each project's
docs/tracking/folder
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?