Practical Examples and Use Cases
1. Analysing User Behaviour
By examining the event table, you can identify which pages are most popular, where users drop off, and what actions they take.
Example: Use SQL queries to find the most viewed pages.
``sql SELECT event_params.value.string_value AS page_location, COUNT() as page_views FROM your_project.your_dataset.events_, UNNEST(event_params) AS event_params WHERE event_name = 'page_view' AND event_params.key = 'page_location' GROUP BY page_location ORDER BY page_views DESC; ``
2. E-commerce Performance
Track the performance of your products and transactions using e-commerce-specific fields.
Example: Query to extract e-commerce transaction data.
``sql SELECT ecommerce.total_item_quantity, ecommerce.purchase_revenue, ecommerce.tax_value, ecommerce.shipping_value, ecommerce.transaction_id, ecommerce.unique_items FROM your_project.your_dataset.events_* WHERE event_name = 'purchase' LIMIT 100; ``
3. Item Performance
Dive deeper into item-level data to understand which products are driving sales.
Example: Query to extract item performance data.
``sql SELECT items.item_id, items.item_name, items.item_brand, items.item_category, items.item_variant, items.item_price, items.item_quantity FROM your_project.your_dataset.events_*, UNNEST(items) AS items WHERE event_name = 'purchase' LIMIT 100; ``