In Universal Analytics, you can record a destination goal when a user lands on a specified page. A typical example of a destination goal is a "thank you" or "confirmation" page following a form submission.
As noted in Google Analytics 4 conversion basics, Google Analytics 4 (GA4) properties don't send pageview hits. Instead, when a user visits a page on your website, GA4 sends a
page_view event (or if the user was on your app, a
screen_view event). The event has parameters that indicate the URL, page title, and so on.
To generate a conversion for a specific pageview, you can take one of the following two approaches.
Option 1: Create a new conversion event via the user interface
As noted in Conversions in Google Analytics 4, you can’t define a GA4 conversion based on parameters other than event_name. The challenge for defining a conversion based on a specific pageview is that every pageview is recorded with the same event name:
page_view. If you mark the default
page_view event as a conversion, every pageview on your site will be counted as a conversion.
The solution is to create a new event via the user interface that's triggered when the page_view event occurs on the desired page:
- In the left pane, click Configure, then Events.
- Click Create event.
- Click Create, then in the Create event panel:
- Enter a name for the new event.
Use one of the recommended events if you can. For example, submitting a "contact us" form could use the
- For the first matching condition, specify event_name - equals - page_view
- For the second matching condition, specify a page_location (or potentially a page_title), such as page_location - equals - /contact-us-submitted.
- If you want to copy a goal value from Universal Analytics, click the Add modification button and enter the Parameter value and for the New Value enter the value you used in the Universal Analytics goal (e.g. "10").
- Enter a name for the new event.
- In the left navigation, click Conversions.
- Click New conversion event.
- As the event name, enter the event configured in steps 1-4, for example,
While you cannot directly create a parameterized conversion event, you can use the Event Modification to create a new (admin-level) conversion event based on event name and one or more additional event parameters.
Option 2: Send a conversion-specific event from your site code
If you can edit your site code or Tag Manager configuration, you can send an event whose only purpose is to indicate that a conversion has occurred:
- On the /contact-us-submitted page, update your gtag code or configure Google Tag Manager to directly send a
- Mark the
generate_leadevent as a conversion, as outlined in steps 4-6 in the preceding procedure.
Sometimes, you might want to record a
page_view event even if a physical page load has not occurred, as can be the case for sites built with SPA (single-page application) or PWA (progressive web app) architectures, or for specific AJAX-like flows in your web experience.
Let’s say that your web developers have built a four-screen checkout experience to render in the browser without interceding page loads. In that case, only the first screen of the checkout process requires a physical page load and generates a Google Analytics pageview by default.
If a pageview is not generated by default for steps 2-4, how can you build a funnel and record a conversion in Google Analytics?
In Universal Analytics, you can generate a "virtual pageview." Use your own gtag scripting or tags and triggers in Google Tag Manager to send the screen refresh as a pageview. You can also override the URL in the Page dimension to be whatever value you want (for example, /checkout-2, /checkout-3, and so on).
In GA4, you can take the same approach. The difference is you'll track a
page_view event, that is, an event with page_view (or a different name, such as virtual_page_view) as the event name, and specify your own
page_location parameter (/checkout-2, /checkout-3, and so on). It’s also a good idea to include a meaningful
page_title parameter, which appears by default in some Google Analytics reports and explorations (for example, the path exploration), instead of the
You can then create an event via the user interface as described above to generate a new event - for example,
checkout_completed -- for the final step of the checkout process.
You can also take the alternative approach outlined above: directly generate a
checkout_completed event through gtag or Google Tag Manager on the final checkout step.
Finally, mark your
checkout_completed event as a conversion.