In my previous post, I covered basic metrics that define user behavior, such as total visits, average page views, and traffic source distribution.
While these metrics are essential for understanding overall site performance, advanced engagement analysis can provide deeper insights into how users interact with your site.
In this post, we’ll look at more sophisticated engagement metrics using the Google Analytics Sample Dataset in BigQuery.
We’ll explore engagement depth, content engagement, user flow, event-based engagement, and time to purchase.
1. Engagement Depth Analysis
Understanding how deeply users engage with your site can help identify the correlation between engagement and conversion rates. We’ll analyze sessions based on the number of page views.
- Depth of Engagement: Examine how the number of pages viewed per session relates to session duration and conversion rate.
- Insights: Sessions with higher pageviews tend to have longer durations and higher conversion rates, indicating more engaged users are more likely to convert.
SELECT
CASE
WHEN totals.pageviews = 1 THEN '1 page'
WHEN totals.pageviews BETWEEN 2 AND 5 THEN '2-5 pages'
WHEN totals.pageviews BETWEEN 6 AND 10 THEN '6-10 pages'
ELSE '10+ pages'
END AS pageview_bucket,
COUNT(*) AS sessions,
AVG(totals.timeOnSite) AS avg_session_duration,
ROUND(100 * COUNTIF(totals.transactions > 0) / COUNT(*), 2) AS conversion_rate
FROM
`bigquery-public-data.google_analytics_sample.ga_sessions_*`
WHERE
_TABLE_SUFFIX BETWEEN '20170101' AND '20170331'
GROUP BY
pageview_bucket
ORDER BY
sessions DESC;
Explanation
- pageview_bucket: Categorizes sessions based on the number of pages viewed.
- sessions: Counts the number of sessions in each pageview bucket.
- avg_session_duration: Calculates the average duration of sessions in each bucket.
- conversion_rate: Computes the conversion rate for each pageview bucket by dividing the number of transactions by the number of sessions and multiplying by 100.
2. Content Engagement Analysis
Identifying top-performing and underperforming content can help optimize your site.
- Top-Performing Content: Identify pages with the highest pageviews and longest average time on page.
- Underperforming Content: Detect pages with high exit rates to find areas needing improvement.
SELECT
hits.page.pagePath,
COUNT(*) AS pageviews,
AVG(hits.time) AS avg_time_on_page,
SUM(CAST(hits.isExit AS INT64)) AS exits,
ROUND(100 * SUM(CAST(hits.isExit AS INT64)) / COUNT(*), 2) AS exit_rate
FROM
`bigquery-public-data.google_analytics_sample.ga_sessions_*`,
UNNEST(hits) AS hits
WHERE
_TABLE_SUFFIX BETWEEN '20170101' AND '20170331'
AND hits.type = 'PAGE'
GROUP BY
hits.page.pagePath
ORDER BY
pageviews DESC
LIMIT 20;
Explanation
- pagePath: The URL path of the page.
- pageviews: Counts the number of pageviews for each page.
- avg_time_on_page: Calculates the average time users spend on each page.
- exits: Counts the number of times users exited from each page.
- exit_rate: Computes the exit rate for each page by dividing the number of exits by the number of pageviews and multiplying by 100.
3. User Flow Analysis
Understanding the common user paths through your site can help optimize navigation.
- Common User Paths: Identify the most frequent page sequences to understand user navigation.
- Optimization Opportunities: Improve user flow by enhancing navigation and linking related content.
WITH page_sequence AS (
SELECT
fullVisitorId,
visitId,
hits.page.pagePath,
hits.hitNumber,
LEAD(hits.page.pagePath) OVER (PARTITION BY fullVisitorId, visitId ORDER BY hits.hitNumber) AS next_page
FROM
`bigquery-public-data.google_analytics_sample.ga_sessions_*`,
UNNEST(hits) AS hits
WHERE
_TABLE_SUFFIX BETWEEN '20170101' AND '20170331'
AND hits.type = 'PAGE'
)
SELECT
pagePath AS current_page,
next_page,
COUNT(*) AS frequency
FROM
page_sequence
WHERE
next_page IS NOT NULL
GROUP BY
current_page, next_page
ORDER BY
frequency DESC
LIMIT 20;
Explanation
- page_sequence: Creates a sequence of pages visited within each session.
- current_page: The current page in the sequence.
- next_page: The page that follows the current page in the sequence.
- frequency: Counts the number of times users navigate from the current page to the next page.
4. Event-Based Engagement Analysis
Analyze user interactions with specific site elements.
- Popular Features: Identify the most frequent events to understand user interactions.
- Improvement Areas: Detect less-used features to identify potential areas for improvement.
SELECT
hits.eventInfo.eventCategory,
hits.eventInfo.eventAction,
COUNT(*) AS event_count
FROM
`bigquery-public-data.google_analytics_sample.ga_sessions_*`,
UNNEST(hits) AS hits
WHERE
_TABLE_SUFFIX BETWEEN '20170101' AND '20170331'
AND hits.type = 'EVENT'
GROUP BY
hits.eventInfo.eventCategory,
hits.eventInfo.eventAction
ORDER BY
event_count DESC
LIMIT 20;
Explanation
- eventCategory: The category of the event.
- eventAction: The action of the event.
- event_count: Counts the number of occurrences of each event.
5. Time to Purchase Analysis
Analyze the time it takes for users to make a purchase.
- Time to Purchase: Understand the distribution of time it takes for users to make a purchase.
- Optimization: Develop strategies to shorten the purchase funnel and reduce time to purchase.
WITH purchase_sessions AS (
SELECT
fullVisitorId,
visitId,
MAX(hits.time) / 1000 AS time_to_purchase
FROM
`bigquery-public-data.google_analytics_sample.ga_sessions_*`,
UNNEST(hits) AS hits
WHERE
_TABLE_SUFFIX BETWEEN '20170101' AND '20170331'
AND totals.transactions > 0
GROUP BY
fullVisitorId, visitId
)
SELECT
CASE
WHEN time_to_purchase < 60 THEN '< 1 min'
WHEN time_to_purchase < 300 THEN '1-5 mins'
WHEN time_to_purchase < 900 THEN '5-15 mins'
ELSE '15+ mins'
END AS time_bucket,
COUNT(*) AS purchase_count,
AVG(time_to_purchase) AS avg_time_to_purchase
FROM
purchase_sessions
GROUP BY
time_bucket
ORDER BY
purchase_count DESC;
Explanation
- purchase_sessions: Identifies sessions with transactions and calculates the time to purchase for each session.
- time_bucket: Categorizes sessions based on the time taken to make a purchase.
- purchase_count: Counts the number of purchases in each time bucket.
- avg_time_to_purchase: Calculates the average time to purchase in each bucket.
You can find the complete code in my GitHub repository.
Results
1. Engagement Depth Analysis
The analysis of engagement depth categorizes sessions based on the number of page views per session and provided insights into session duration and conversion rates for each category.
The data shows a clear correlation between the depth of engagement and session duration, as well as conversion rates. Users who viewed more pages per session had significantly longer session durations and higher conversion rates.
Notably, sessions with more than 10 page views had an average duration of over 13 minutes and a conversion rate of 14.19%, indicating that deeply engaged users are more likely to convert.
Pageview Bucket | Sessions | Avg. Session Duration (seconds) | Conversion Rate (%) |
1 page | 98,842 | 62.10 | 0.00 |
2-5 pages | 63,785 | 127.58 | 0.01 |
6-10 pages | 18,794 | 320.01 | 0.53 |
10+ pages | 15,396 | 804.08 | 14.19 |
2. Content Engagement Analysis
This analysis focuses on identifying top-performing and underperforming content by evaluating pageviews, average time on page, and exit rates.
The homepage (/home) has the highest number of pageviews but also a high exit rate of 42.32%, indicating that while many users land on the homepage, a large proportion leave without further interaction.
Pages related to “google+redesign” showe high engagement with long average time on page, but some also have high exit rates, suggesting potential areas for content improvement or user flow optimization.
For example, the “shop+by+brand/youtube” page has a high exit rate of 43.74%, indicating that users may not find what they are looking for or that the page could be optimized further.
Page Path | Pageviews | Avg. Time on Page (seconds) | Exits | Exit Rate (%) |
/home | 201,478 | 78,501 | 85,267 | 42.3 |
/basket.html | 49,173 | 571,742 | 5,860 | 11.9 |
/google+redesign/shop+by+brand/youtube | 39,801 | 92,584 | 17,408 | 43.7 |
/signin.html | 22,229 | 272,627 | 4,232 | 19.0 |
/store.html | 15,669 | 423,165 | 2,079 | 13.3 |
/google+redesign/apparel/men++s/men++s+t+shirts | 15,127 | 182,574 | 4,796 | 31.7 |
/asearch.html | 14,770 | 238,278 | 4,928 | 33.4 |
/google+redesign/apparel/men++s/men++s+outerwear | 13,688 | 183,383 | 3,146 | 23.0 |
/google+redesign/shop+by+brand/google | 12,453 | 221,810 | 3,476 | 27.9 |
/google+redesign/apparel | 10,672 | 247,376 | 2,192 | 20.5 |
/google+redesign/bags/backpacks/home | 10,139 | 252,731 | 1,436 | 14.2 |
/google+redesign/electronics | 8,986 | 260,675 | 2,306 | 25.7 |
/google+redesign/bags | 8,923 | 264,973 | 1,992 | 22.3 |
/google+redesign/accessories | 8,549 | 311,126 | 1,449 | 17.0 |
/google+redesign/accessories/fun | 8,215 | 341,145 | 989 | 12.0 |
/yourinfo.html | 8,176 | 812,068 | 920 | 11.3 |
/google+redesign/drinkware | 7,633 | 248,357 | 2,219 | 29.1 |
/google+redesign/accessories/stickers/home | 7,273 | 283,394 | 1,198 | 16.5 |
/google+redesign/shop+by+brand/youtube/quickview | 6,856 | 205,615 | 892 | 13.0 |
/payment.html | 6,774 | 1,006,741 | 531 | 7.8 |
3. User Flow Analysis
The user flow analysis shows the most common paths users take on the site, which can be critical for understanding how to improve site navigation and user experience.
For instance, many users transition from the homepage to revisiting the homepage or exploring product categories like “shop+by+brand/youtube” and “shop+by+brand/google.”
The frequent navigation from “basket.html” to “signin.html” and then to “yourinfo.html” suggests that users are actively moving through the checkout process.
Enhancing these commonly traversed paths can help streamline user journeys and improve overall site usability.
Understanding these common pathways allows for targeted improvements to keep users engaged and reduce drop-off rates.
Current Page | Next Page | Frequency |
/home | /home | 45,199 |
/basket.html | /basket.html | 9,407 |
/home | /google+redesign/shop+by+brand/youtube | 7,700 |
/basket.html | /signin.html | 6,648 |
/google+redesign/shop+by+brand/youtube | /home | 6,227 |
/home | /google+redesign/shop+by+brand/google | 6,174 |
/basket.html | /yourinfo.html | 5,322 |
/home | /google+redesign/apparel/men++s/men++s+outerwear | 5,164 |
/signin.html | /signin.html | 4,582 |
/yourinfo.html | /payment.html | 4,440 |
/myaccount.html?mode=vieworder | /myaccount.html?mode=vieworderdetail | 4,018 |
/google+redesign/shop+by+brand/youtube | /google+redesign/shop+by+brand/youtube/quickview | 3,950 |
/signin.html | /registersuccess.html | 3,915 |
/home | /asearch.html | 3,698 |
/registersuccess.html | /store.html | 3,651 |
/basket.html | /store.html | 3,383 |
/payment.html | /revieworder.html | 3,136 |
/asearch.html | /asearch.html | 2,905 |
/google+redesign/bags/backpacks/home | /google+redesign/bags/backpacks//quickview | 2,896 |
/store.html | /basket.html | 2,734 |
4. Event-Based Engagement Analysis
This analysis focuses on user interactions with specific site elements by evaluating the frequency of different events.
Event-based engagement analysis reveals that “Quickview Click” and “Add to Cart” are the most frequent actions, indicating high user interest in viewing product details and adding items to their cart.
The significant number of “Remove from Cart” events suggests that users may reconsider their choices, highlighting a potential area to investigate for improving cart retention and reducing abandonment rates.
Understanding these interactions can help refine features to better meet user needs and preferences.
Event Category | Event Action | Event Count |
Enhanced Ecommerce | Quickview Click | 70,047 |
Enhanced Ecommerce | Add to Cart | 23,478 |
Enhanced Ecommerce | Product Click | 15,519 |
null | null | 7,155 |
Enhanced Ecommerce | Remove from Cart | 2,968 |
Contact Us | Onsite Click | 1,481 |
Enhanced Ecommerce | Promotion Click | 17 |
5. Time to Purchase Analysis
This analysis examined the time it takes for users to make a purchase.
The time to purchase analysis shows that most users make purchases within 5-15 minutes of their session, followed by those taking longer than 15 minutes.
This suggests that while many users make quick decisions, a substantial number require more time to decide, indicating opportunities to streamline the purchase process and reduce decision time for users.
Time Bucket | Purchase Count | Avg. Time to Purchase (seconds) |
5-15 mins | 1,084 | 573.0 |
15+ mins | 963 | 1,795.8 |
1-5 mins | 240 | 223.3 |
< 1 min | 1 | 0.0 |
Conclusion
Advanced engagement analysis provides a comprehensive understanding of how users interact with an e-commerce site.
By examining deeper metrics such as engagement depth, content engagement, user flow, event interactions, and time to purchase, we can gain valuable insights that go beyond basic metrics.
These insights enable more targeted and effective strategies to enhance user experience, optimize site performance, and ultimately drive higher conversion rates.
Implementing these findings can lead to a more engaging, user-friendly website that not only attracts visitors but also retains them and encourages them to complete their transactions.
As the digital landscape continues to evolve, ongoing analysis and optimization are crucial for maintaining a competitive edge and meeting the ever-changing needs of users.