Back to Guides
    getting startedbeginner10 minutesNov 20, 2024

    Google Analytics 4 Integration Guide

    Connect GA4 to Cogny for AI-powered website analytics and behavioral insights. Complete 10-minute integration guide with troubleshooting tips.

    Google Analytics 4 Integration Guide

    TL;DR

    Connect GA4 to Cogny via BigQuery export for unsampled, unlimited analysis of every website event with AI-powered attribution and journey insights.

    What you'll accomplish:

    • Enable BigQuery export in your GA4 property (free for 1M events/day)
    • Configure daily or streaming data export to BigQuery
    • Connect BigQuery to Cogny for AI analysis
    • Access complete event-level data without sampling or API limits

    Time required: 10 minutes | Difficulty: Beginner | Prerequisites: GA4 property with data, Google Cloud project

    Quick Start: In GA4, navigate to Admin → Property → BigQuery Links → Link → Select your Google Cloud project → Enable daily export.


    Related Resources

    Maximize your GA4 integration with these complementary guides:


    Question

    How do I connect Google Analytics 4 to Cogny for AI-powered insights?

    Answer

    Connect GA4 to BigQuery (free, takes 5 minutes). Then connect BigQuery to Cogny.

    Cogny's AI analyzes your complete GA4 data—no sampling, no limits.

    Quick Tip: GA4's BigQuery export is completely free for up to 1 million events per day. This is more than enough for most businesses. If you haven't set up BigQuery yet, follow our BigQuery Connection Guide first—it takes just 5 minutes and unlocks unsampled data analysis.

    Why GA4 Through BigQuery?

    The GA4 interface shows you aggregated data. Sampled reports. API limits.

    BigQuery gives you:

    • Every. Single. Event.
    • Zero sampling.
    • Unlimited analysis depth.
    • Custom queries across millions of sessions.

    This is what Cogny needs to find insights the GA4 UI will never show you.

    What You'll Discover

    After connecting GA4:

    Attribution insights Which channels actually drive conversions (not just last-click)

    User journey analysis Exact paths from first visit to purchase

    Cohort behavior How different user segments behave over time

    Funnel drop-offs Precisely where users abandon (and why)

    Revenue optimization Which campaigns drive highest LTV customers

    Note: The GA4 interface limits you to sampled data for large datasets and restricts historical analysis to 14 months. BigQuery export stores unlimited event-level data with zero sampling, enabling deep analysis like cohort tracking, LTV prediction, and custom attribution models that aren't possible in the GA4 UI alone.


    Step 1: Enable BigQuery Export in GA4

    Log into analytics.google.com

    Select your GA4 property.

    Click Admin (gear icon, bottom left)

    Under Property column, click BigQuery Links

    Click Link

    Time: 1 minute


    Step 2: Choose Google Cloud Project

    You'll see "Choose a BigQuery project"

    Options:

    1. Use existing project (if you have one)
    2. Create new project (Cogny can help with this)

    Select your project.

    Don't have a Google Cloud project?

    Click "Create a new project" Name it something like company-analytics Google gives you $300 free credits.

    Time: 2 minutes (if creating new project)


    Step 3: Configure Export Settings

    Data location: Choose region closest to you

    • US: us (multi-region)
    • EU: eu (multi-region)
    • Asia: asia-northeast1 (Tokyo) or asia-southeast1 (Singapore)

    Export frequency:

    • Daily (recommended - free)
    • Streaming (real-time but costs more)

    Export type:

    • Daily export (includes all events)
    • Fresh daily export (only recent data)

    Choose Daily export unless you need real-time data.

    Time: 2 minutes


    Step 4: Confirm and Link

    Click Next

    Review settings:

    • Project ID
    • Dataset location
    • Export frequency

    Click Submit

    GA4 starts exporting.

    Important: First export takes 24-48 hours. After that, daily exports arrive every morning (around 9 AM local time).

    Time: 1 minute


    Step 5: Verify BigQuery Dataset

    Go to console.cloud.google.com/bigquery

    In the Explorer panel (left side), expand your project.

    You should see a new dataset: analytics_PROPERTY_ID

    Example: analytics_123456789

    Inside, you'll see tables like:

    • events_20241120 (today's events)
    • events_20241119 (yesterday's events)
    • events_YYYYMMDD (one table per day)

    Time: 1 minute


    Step 6: Connect to Cogny

    Now connect this BigQuery dataset to Cogny.

    Follow our BigQuery Connection Guide if you haven't already. You'll need to create a service account with read-only access to query your GA4 data.

    Steps:

    1. Create service account in Google Cloud
    2. Grant BigQuery Data Viewer permissions
    3. Add JSON key to Cogny
    4. Select the analytics_* dataset

    Time: 5 minutes (if you haven't done this yet)


    Step 7: Let AI Analyze

    Once connected, Cogny's AI:

    1. Catalogs your GA4 schema (2 minutes)

      • Identifies all event types
      • Maps parameters and user properties
      • Builds relationship graph
    2. Analyzes historical data (24 hours)

      • User journey patterns
      • Conversion paths
      • Funnel performance
      • Revenue attribution
    3. Generates growth tickets (ongoing)

      • Specific optimization opportunities
      • Channel reallocation recommendations
      • Audience targeting improvements

    What's in the GA4 BigQuery Export?

    Every table has these fields:

    event_date - Date of the event (YYYYMMDD format) event_timestamp - Precise microsecond timestamp event_name - Event type (page_view, purchase, etc.) user_pseudo_id - Anonymous user identifier user_id - Logged-in user ID (if set)

    User properties:

    • Device category
    • Operating system
    • Browser
    • Geographic location
    • Traffic source

    Event parameters:

    • Page location
    • Page title
    • Revenue
    • Currency
    • Item details (for e-commerce)

    Custom parameters: Whatever you've configured in GA4 shows up here too.


    Example: Finding Your Best Conversion Path

    Question you can now answer: "What's the typical journey for customers who spend >$500?"

    SQL query Cogny generates:

    WITH high_value_users AS (
      SELECT user_pseudo_id
      FROM `project.analytics_123456789.events_*`
      WHERE event_name = 'purchase'
        AND event_value > 500
    )
    SELECT
      event_name,
      COUNT(*) as event_count,
      AVG(event_timestamp) as avg_time_in_journey
    FROM `project.analytics_123456789.events_*`
    WHERE user_pseudo_id IN (SELECT user_pseudo_id FROM high_value_users)
    GROUP BY event_name
    ORDER BY avg_time_in_journey
    

    Result: You see the exact sequence of events that lead to high-value purchases.

    Maybe they:

    1. Read blog post
    2. Watch demo video
    3. View pricing
    4. Sign up for trial
    5. Purchase

    Now you know what content to create more of.

    This type of analysis powers the insights in our funnel optimization guide, where AI identifies exact drop-off points and recommends fixes.


    Common Issues

    "No data appearing in BigQuery"

    GA4 export takes 24-48 hours for first run. After that, data appears daily around 9 AM.

    Check back tomorrow.

    "Permission denied" when querying

    Your service account needs BigQuery Data Viewer role. Go to BigQuery → Dataset → SHARING Add your service account Grant viewer permission

    "Dataset not found in Cogny"

    Make sure:

    1. BigQuery export is enabled in GA4
    2. At least 24 hours have passed
    3. Service account has access to the dataset

    "Events look incomplete"

    Check your GA4 setup:

    • Is GA4 tag installed correctly?
    • Are events firing properly?
    • Is Enhanced Measurement enabled?

    Use GA4 DebugView to verify events are being collected.

    "Costs are higher than expected"

    BigQuery charges for data storage and queries.

    Typical costs:

    • Storage: ~$20/month per TB
    • Queries: ~$5/TB scanned

    For most businesses: <$50/month total.

    Cogny optimizes queries to minimize costs.


    Pro Tips

    1. Enable Enhanced Measurement

    In GA4: Admin → Data Streams → [Your Stream] → Enhanced Measurement

    Turn on:

    • ✅ Page views
    • ✅ Scrolls
    • ✅ Outbound clicks
    • ✅ Site search
    • ✅ Video engagement
    • ✅ File downloads

    More events = better AI insights.

    2. Set up custom events

    Track business-specific actions:

    • "Start free trial"
    • "Add to cart"
    • "Complete onboarding"
    • "Upgrade to paid"

    These events appear in BigQuery automatically.

    3. Use User-ID for cross-device tracking

    If users log in, set User-ID:

    gtag('config', 'G-XXXXXXXXXX', {
      user_id: 'USER_ID_FROM_YOUR_DATABASE'
    });
    

    This lets you track the same person across devices.

    4. Configure data retention

    GA4 UI: 2-14 months maximum BigQuery: Unlimited (you control it)

    This is huge for long-term analysis.

    5. Partition tables for cost optimization

    BigQuery partitions GA4 tables by date automatically. When querying, always include date filter:

    WHERE _TABLE_SUFFIX BETWEEN '20241101' AND '20241130'
    

    This scans only November data, not the entire history. Cogny does this automatically.


    What You Can Do Now

    Immediate actions:

    1. Build attribution report

      • See all touchpoints in customer journey
      • Understand multi-channel impact
      • Optimize budget allocation
    2. Analyze conversion funnels

      • Identify exact drop-off points
      • See why users abandon
      • Get AI recommendations to fix
    3. Segment users by value

      • Find characteristics of high-LTV customers
      • Target similar audiences
      • Stop wasting budget on low-value segments
    4. Track cohort behavior

      • Compare user groups over time
      • Measure retention improvements
      • Predict churn before it happens

    Next Steps

    Recommended guides:

    Combine with other data sources:

    The more data sources you connect, the smarter Cogny's AI becomes.


    Next Steps

    After completing your GA4 BigQuery integration, unlock these advanced capabilities:

    Immediate Actions:

    1. Configure custom event tracking to capture business-specific user actions
    2. Connect Google Ads to merge ad performance with website behavior
    3. Review AI-generated funnel analysis to identify conversion bottlenecks

    Advanced Analysis:

    E-commerce Next Steps:

    Need help? We're here to assist:


    FAQ

    Q: Does this work with Universal Analytics (old GA)?

    No. Only GA4.

    Universal Analytics stopped collecting data in July 2023. If you haven't migrated to GA4 yet, do that first.

    Q: Can I use this with GA4 + Shopify?

    Yes.

    GA4 tracks the front-end events. Connect Shopify to BigQuery separately for order data. Cogny merges them automatically.

    Q: How much BigQuery storage will I use?

    Rough estimate:

    • Small site (10K sessions/month): ~1 GB/month
    • Medium site (100K sessions/month): ~10 GB/month
    • Large site (1M sessions/month): ~100 GB/month

    Storage costs $0.02/GB/month. So even a large site costs ~$2/month in storage.

    Q: What if I need real-time data?

    Enable "Streaming export" in GA4 BigQuery settings. Events appear within minutes instead of next day.

    Cost: ~$0.05 per GB streamed. For most sites: $10-50/month.

    Q: Can I use the free BigQuery sandbox?

    For testing, yes. For production, you need a billing account.

    But remember: Google gives $300 free credits. That's enough for months of analysis.

    Q: What happens to my historical data?

    Only data AFTER you enable BigQuery export is stored. Historical data from before stays in GA4 UI only.

    Plan ahead: Enable export now, even if you're not ready to use Cogny yet.

    Q: Can I access the raw BigQuery data myself?

    Yes!

    You own the BigQuery dataset. Query it directly anytime. Cogny doesn't lock you in.


    Ready to See AI-Powered GA4 Insights?

    Most teams discover they've been over-attributing credit to last-click channels.

    Your Facebook ads might be driving awareness. But Google Ads gets the conversion credit.

    You've been over-investing in Google, under-investing in Facebook.

    The AI finds this in minutes.

    Not set up yet?

    Schedule a demo and we'll walk you through the entire setup—GA4, BigQuery, and Cogny.


    About This Guide

    Written by the Cogny team—built by the founders who created AI optimization systems for Netflix, Zalando, and Momondo at Campanja, and scaled growth for Kry, Epidemic Sound, and Yubico through GrowthHackers.se.

    We've set up GA4 BigQuery exports for hundreds of companies. This is the battle-tested process.

    Last Updated: November 20, 2024

    Ready to Get Started?

    See Cogny in Action

    Schedule a demo to see how AI can transform your marketing analytics and automate your growth optimization.

    Schedule Demo