BigQuery + GA4: Output Pages Report

Remember from Universal Analytics the output reports? 

It was a default report that was within the behavioral heading under Content or Site content in which this table

was displayed.

It was a report of the main exit pages of our website, it is the report that is on the other side of the report of entry pages or landing pages. 

It was a report of the main exit pages of our website, it is the report that is on the other side of the report of entry pages or landing pages.

In the report as its name indicated it showed the main urls by which users leave our website.

UA - Exit pagesThe purpose of this query was to show the main urls by which users leave our website.

The purpose of this query is to identify which are the most common exit pages on a website, which can provide valuable information about user behavior, potential friction points in website design or user flow, and opportunities to improve user retention or optimize conversions.

We also provide you with a "UA - Exit pages" alt.

We also provide a description of what the query does in case you want to know, but you can skip the explanation and copy and paste the query directly.

This BigQuery query is designed to identify the exit pages of user sessions on a website using Google Analytics 4 data exported to BigQuery. Here's the breakdown of what the query does:

  • Subquery "prep":
      • Select user identifiers ('user_pseudo_id'), session identifiers ('session_id'), and the URLs of the pages ('page') where a page view event ('page_view') has occurred.
      • Pick up the 'event_timestamp' for each page view event.
      • Filters to include only events that are pageviews (event_name = 'page_view').
      • Sort the results by 'event_timestamp' to get a sequence of events by time.
  • Sub-query "prep_exit":
      • Use the temporary table 'prep' to select the same fields.
      • Apply the window function 'FIRST_VALUE' to get the last page viewed ('exit_page') in each session per user, sorting the events by 'event_timestamp' in a top-down manner, which means it gets the page with the last timestamp as the exit page.
  • Main inquiry:
    • Select the page ('exit_page') only if it matches the last page viewed in the session (indicating that it is the exit page).
    • Count the number of unique sessions ('exits') that ended at each specific exit page, using 'COUNT(DISTINCT ..') on the concatenation of 'user_pseudo_id' and 'session_id'..
    • Group the results by 'exit_page'..
    • Filters to include only those rows where 'exit_page' is not null, ensuring only exit pages are counted.
    • Sort the results by the number of exits in descending order.

We are going to pass you the query you have to use in Bigquery on your GA4 dataset or dataset of your website in order to see this type of report.

Remember that to do this you don't need to know Bigquery, just copy and paste what follows.


WITH prep AS (
  SELECT
    user_pseudo_id,
    (SELECT value.int_value FROM UNNEST(event_params) WHERE event_name = 'page_view'AND KEY = 'ga_session_id') AS session_id,
    (SELECT value.string_value FROM UNNEST(event_params) WHERE event_name = 'page_view'AND KEY = 'page_location') AS page,
    event_timestamp
  FROM
    -- In events_2023* you can put a specific date: _20231001 (October 1, 2023), _202310* (all of October 2023), _2023* (all of October 2023), _2023* (all of 2023 so far)....
    `<project>.<dataset>.events_2023*``
  WHERE
    event_name = 'page_view'
  ORDER BY
    event_timestamp
),
  prep_exit AS(
  SELECT
    user_pseudo_id,
    session_id,
    page,
    event_timestamp,
    FIRST_VALUE(CONCAT(page, event_timestamp)) OVER (PARTITION BY user_pseudo_id, session_id ORDER BY event_timestamp DESC) AS exit_page
  FROM
    rep
  ORDER BY
    event_timestamp
  )
SELECT
  CASE
    WHEN concat (page, event_timestamp) = exit_page THEN page
  ELSE
  NULL
END
  AS exit_page,
  COUNT(DISTINCT CONCAT(user_pseudo_id,session_id)) AS exits
FROM
  prep_exit
GROUP BY
  exit_page
HAVING
  exit_page IS NOT NULL
ORDER BY
  exits desc

If you want a "closed" date range, for example from August 8 to September 23. 

Take this snippet from the query above: 


FROM
  -- Here you put the name of your GA4 dataset.In events_2023* you can put a specific date: _20231001 (October 1, 2023), _202310* (all of October 2023), _2023* (all of 2023 so far)....
  `<project>.<dataset>.events_2023*``
WHERE
  event_name = 'page_view'

And you replace it with: 


FROM
  `<project>.<dataset>.events_*``
WHERE
  event_name = 'page_view'
  AND _TABLE_SUFFIX BETWEEN '20230808'
  AND '20230923'

And that's it!

When you run the query you would get a table like this:

BQ - Query Results

In the table we can already see the main exit pages of our website and the number of times that users have exited through them in the selected period.

This is the end of today's article. I hope it will be useful and helpful.

PREVIOUS
NEXT

TIPS DE EXPERTOS

Suscríbete para impulsar tu negocio.

LATESTS ARTICLES

Framework for Building Trustworthy and Efficient AI Agents

The Leap from Assistants to Intelligent Agents

For years, artificial intelligence tools have operated mainly as assistants: systems capable of answering questions, drafting texts, or handling specific tasks. However, in recent months, we’ve started to witness a fundamental shift. Intelligent agents have emerged—autonomous systems capable of pursuing complex goals without constant supervision.

ChatGPT Agent: the AI that thinks and acts is now in your business

OpenAI has just launched one of its most impactful updates since GPT-4: ChatGPT Agent, a leap that takes language models far beyond simple text generation. This is no longer about chatting. It’s about AI that can reason, make decisions, and carry out real-world tasks autonomously. For companies already using CRMs, analytics, or marketing automation, this changes the game entirely.

How to implement AI in Marketing to Achieve Real Results

Introduction: From Superficial Adoption to Smart Implementation

 

Artificial intelligence (AI) is already part of the daily life of marketing teams. Tools like ChatGPT or Gemini have become almost indispensable. However, many brands have yet to make the leap from occasional use to strategic integration of these technologies.

In this article from Hike & Foxter, we explore how to implement AI intelligently to improve processes, elevate personalization, and directly connect with business KPIs.

The Current Landscape: Are We Really Integrating AI? 

According to the report "The State of AI in Marketing" by Search Engine Journal, although 91% of marketers already use some AI tool, only a fraction have deeply integrated these solutions into their strategies. Most limit themselves to using tools like ChatGPT to generate ideas or draft content, without linking these efforts to business goals.

Integrating AI is not about using it as a magic solution for isolated tasks. It involves redesigning entire processes, transforming decision-making, and rethinking the customer experience from the first contact to conversion and retention.

Is ChatGPT Enough? What Widespread Adoption Reveals 

83% of surveyed marketers use ChatGPT as a central tool. However, the real impact is limited when not paired with other complementary solutions.

The key is tool literacy:

  • Understanding what each solution can (and can't) do

  • Knowing how they integrate with each other and platforms like CRM

  • Spotting opportunities to redesign processes, not just tasks

🔎 Useful fact: Teams with an integrated AI stack generate 3.2 times more personalized content than those who rely on a single tool.

kickstart-newsletter-sej-report

Recommended AI Stack: Tools by Objective

Objective Basic Tool Advanced Tool Success Metric
Content Generation ChatGPT Jasper + CRM CTR +25%
Personalization Static Templates Dynamic content + AI Conversion +40%
Predictive Analytics Google Analytics Machine Learning in CRM Lead scoring +60%

 

A solid AI stack should not only include a variety of tools but also be connected and centered around the CRM. Only then can real results be tracked.

Content Is Still King… But Needs Purpose
 

64.5% of respondents highlight content creation as the area most benefited by AI. But more content isn’t always better. The difference between noise and value lies in the strategy.

How to Create AI-Generated Content That Actually Works:

  1. Well-defined prompts: with clear intent and goal

  2. Business context: using CRM data, buying behaviors, and ideal customer profiles

  3. Clear editorial guidelines: with tone, voice, and consistent structure

Measurement: From Efficiency to Strategic Impact 

One of the most common pitfalls in AI integration is not measuring its real impact. While 87% measure operational metrics like speed or content volume, only 13% evaluate strategic indicators such as LTV or MQL to SQL conversion.

AI Metrics Pyramid

  1. Tactical: time saved, content volume

  2. Engagement: CTR, time on page

  3. Strategic: conversion rate, revenue attributed to AI

💡 Recommendation: connect all AI-generated content with real CRM data for comprehensive measurement.

Reputation and Quality Control: New Challenges 

As AI use intensifies in marketing, so do the risks: errors, misinformation, inconsistent tone. Poor implementation can damage brand reputation in minutes.

Basic Policies for Safe AI Use:

  • Mandatory human review before publishing AI-generated content

  • Clear labeling of AI-assisted content

  • Ongoing training in “prompt literacy” and emerging tools

Teams and Talent: Evolution, Not Replacement 

Only 4.5% of companies have reduced staff after adopting AI. Why? Because AI doesn’t eliminate roles—it redefines them. The most valued profiles today are:

  • Content strategists with technical skills

  • CRM managers who understand automation

  • Marketing ops with cross-functional vision

📘 AI requires new skills, not layoffs. Investing in trained talent is the best long-term strategy.

Immediate Future: SEO, Personalization, and Content Overload 

With more content circulating, the challenge is to stand out. Posting is no longer enough. The focus must be on:

  • Optimization for generative systems like Gemini or Perplexity

  • Structured, verifiable, and semantically clear content

  • An editorial strategy that’s also a data strategy

Conclusion: Smart AI Integration Is the New Competitive Advantage 

AI is no longer optional. But effective implementation requires more than testing tools. It demands strategic vision, connection to business data, and a human team capable of guiding the process.

Your next step: Evaluate your AI stack, identify gaps in CRM integration, and define new strategic KPIs.

Are you ready to make AI elevate your marketing strategy instead of just automating it?

Is your CRM data ready for AI? Only 24% say yes

On July 10, 2025, Validity released the State of CRM Data Management in 2025 report, based on a survey of over 600 professionals from the US, UK, and Australia. The conclusion is clear: most companies want to implement artificial intelligence, but their CRM systems aren't ready.

data
Mallorca 184, 08036
Barcelona, Spain