A 1st-Party Attribution Suite for eCommerce
  • Introducing Fueled
  • How Fueled Works
    • Key Concepts
    • Use Cases
    • Is Fueled a CDP?
  • Apps
    • Shopify App
      • Shopify Event Tracking
        • Customizing Client-Side Shopify Events
        • Custom Pixel
          • Custom Pixel For Tracking ATC Events
          • Custom Pixel For Tracking Checkout Steps
        • Working with Fueled’s Shopify Data Layer
      • Google Analytics Connector
        • Configuring Google Analytics 4
        • Configuring GA4 Settings in Shopify
          • Shopify Order Source IDs
        • GA4 Shopify App Event Definitions
      • Google Ads Connector
      • Facebook Pixel/CAPI Connector
      • Segment Connector
      • Google Tag Manager Integration
      • Data Warehouse Connector
      • Domain Name Proxy
    • BigCommerce App
      • Google Analytics 4 Connector
        • Configuring Google Analytics 4 for BigCommerce
        • Configuring Fueled’s BigCommerce App
        • BigCommerce Event Tracking
          • Working with Fueled’s BigCommerce Data Layer
          • Customizing Client-Side BigCommerce Events
        • GA4 BigCommerce App Event Definitions
      • Google Ads Connector
      • Segment Connector
      • Data Warehouse Connector
  • Integrations
    • Sources
      • Shopify
      • BigCommerce
      • Headless eCommerce
        • Pack Digital
        • TakeShape
        • Next Commerce
      • Gorgias
        • Ticket Created
        • Ticket Updated
      • Loop Returns
      • Klaviyo
        • Email Opened
        • Email Bounced
        • Email Unsubscribed
        • Email Marked as Spam
        • Email Link Clicked
        • Newsletter Signup Started/Completed
      • KnoCommerce Surveys
      • ReCharge Payments
      • Yotpo Reviews
        • Identify
        • Product Reviewed/Review Updated
        • Site Reviewed/Review Updated
      • WordPress
    • Destinations
      • Google Analytics 4
      • Google Ads
      • Facebook Pixel/CAPI
      • Data Warehouses
      • Segment.com
        • Segment Event Specifications
          • Page
          • Identify
          • Account Created/Updated
          • Cart Viewed
          • Checkout Started
          • Order Completed
          • Product Added/Removed
          • Product List Viewed
          • Product Viewed
          • Products Searched
      • RudderStack
      • MixPanel and Amplitude
  • Resources
    • Recipes & Open Source
      • BigCommerce, dbt & BigQuery
      • Working With GA4 Data In BigQuery
        • Simple 'Page View to Purchase' Funnel Analysis
        • Querying Device Information for Shoppers with Purchases
        • Debugging User IDs in GA4 Events
      • Downgrading To Shopify's Free GA4 Connector
      • Demos
        • Configuration In Under 5 Minutes
    • News, Articles & Podcasts
      • Upgrading To A Paid Fueled Plan On Shopify
      • Feature Comparisons
  • More Info
    • About Us
    • Get Support
Powered by GitBook
On this page
  1. Resources
  2. Recipes & Open Source
  3. Working With GA4 Data In BigQuery

Querying Device Information for Shoppers with Purchases

If you are sending purchase events to Google Analytics 4 via the Measurement Protocol API, you cannot directly send geolocation or user device parameters to Google for the purchase.

However, if you're sending page_view events client-side, and are stitching together the server-side purchase event tracking before sending to the Measurement Protocol API, you can use simple session stitching to build this report.

See the SQL script below. Update the FROM statement with your Google BigQuery dataset ID.

WITH UsersWithPurchase AS (
    -- Identify users who have made a purchase between Sept 19 to October 19
    SELECT DISTINCT 
        user_pseudo_id
    FROM 
        `PROJECT.DATASET.events_intraday_*`
    WHERE 
        event_name = 'purchase' AND
        event_timestamp BETWEEN UNIX_MICROS(TIMESTAMP("2023-09-19 00:00:00 UTC")) AND UNIX_MICROS(TIMESTAMP("2023-10-19 23:59:59 UTC"))
)

-- Retrieve device details for page views of users who made a purchase and group by device combination
SELECT 
    IFNULL(e.device.category, 'Unknown') AS device_category,
    IFNULL(e.device.mobile_brand_name, 'Unknown') AS device_brand,
    IFNULL(e.device.mobile_model_name, 'Unknown') AS device_model,
    IFNULL(e.device.web_info.browser, 'Unknown') AS browser,
    COUNT(DISTINCT e.user_pseudo_id) AS user_count
FROM 
    `ga-bigquery-integration-367223.analytics_266861172.events_intraday_*` e
JOIN 
    UsersWithPurchase u ON e.user_pseudo_id = u.user_pseudo_id
WHERE 
    e.event_name = 'page_view' AND
    e.event_timestamp BETWEEN UNIX_MICROS(TIMESTAMP("2023-09-19 00:00:00 UTC")) AND UNIX_MICROS(TIMESTAMP("2023-10-19 23:59:59 UTC"))
GROUP BY
    device_category, device_brand, device_model, browser
ORDER BY 
    user_count DESC
PreviousSimple 'Page View to Purchase' Funnel AnalysisNextDebugging User IDs in GA4 Events

Last updated 1 year ago