โ† Back to skills
extension
Category: Marketing & GrowthNo API key required

spitakolus-tracking-analytics

Understand and work with Spitakolus shared tracking infrastructure. GTM containers, GA4 properties, BigQuery datasets, consent mode, and event naming.

personAuthor: jakexiaohubgithub

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 loads
  • scroll - 90% scroll depth
  • click - Outbound links
  • file_download - File downloads
  • video_start, video_progress, video_complete

Custom Events Format

Format: [action]_[object]

Examples:

  • sign_up - User registration
  • app_install - App installation
  • listing_created - New listing
  • message_sent - Message sent

UTM Parameters

Always include for attribution:

  • utm_source - Traffic source
  • utm_medium - Marketing medium
  • utm_campaign - Campaign name (use cid!)
  • utm_content - Ad variation

๐Ÿš€ Adding New Project to Tracking

Step 1: Create GA4 Property

  1. Google Analytics โ†’ Create Property
  2. Save Measurement ID (G-XXXXXXXXXX)

Step 2: Add to GTM

  1. GTM โ†’ Container GTM-PD5N4GT3
  2. Create new Google Tag with Measurement ID
  3. 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

  1. GA4 โ†’ Admin โ†’ BigQuery Linking
  2. Project: nastahem-tracking
  3. Location: EU
  4. 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:

  1. GTM Preview Mode: Is the right tag firing?
  2. Hostname check: Is the condition correct?
  3. Consent check: Did user accept cookies?
  4. Network tab: Are requests going to google-analytics.com?
  5. GA4 Realtime: Is data appearing?
  6. BigQuery: Is export enabled and working?

๐Ÿ“Š Growth Loop Integration

Tracking is the foundation of the AI Growth Loop:

  1. Data Collection โ† GTM + GA4 + BigQuery
  2. Analysis โ† Query BigQuery for patterns
  3. AI Generation โ† Use insights for new ads
  4. Optimization โ† Track performance, pause losers

Every event you track becomes data for the Growth Loop.


๐Ÿ”— Detailed Documentation