THE SHORT VERSION

What you’ll take away.

  • Reuse the website's GA4 property and web stream if they already exist.
  • Use one tag installation to send data to the web stream's G- measurement ID.
  • Test more than one page and check the URL recorded on each page_view event.
  • Measure a confirmed form submission as a key event so you can tell which visits lead to inquiries.
  • Keep test traffic separate and validate any data filter before activating it.

To set up Google Analytics 4 (GA4) on a website, create a property, add a web data stream, and connect the site to that stream with the Google tag. Verify that a visit to each type of page sends a page_view event to the intended property. Then test an action that matters to the site, such as a successful contact form submission.

The steps below follow an example site at example.com. A visitor reads an article at /guides/, goes to /contact/, and sends an inquiry. The page views show the visitor’s path. A separate event records the inquiry once the site has accepted it. By testing the two together, you can check both traffic and outcomes.

Google Analytics account setup illustration with the Analytics logo

1. Choose the right account and property

An Analytics account holds properties and gives the site owner a place to manage access. A property stores measurement settings and reports. A web data stream is the source of website events within the property. For a site that has a blog and a contact page on the same domain, one property and one web stream are usually enough. The event’s page URL already tells you which section a visitor used.

If you are taking over a site, ask who manages its Analytics account and check the property selector. Open the existing web stream, copy its measurement ID, and compare it with the destination you see in Tag Assistant on a published page. Reuse the property if it holds the reporting history for the site. If the site still has a retired Universal Analytics ID beginning with UA-, set up its GA4 replacement. A GA4 property contains the data it collected from the time its own measurement started.

You’ll need a Google Account, permission to make changes to the site or its tags, and the right Analytics access. Creating a property requires Editor access at the account level. Adding a stream requires Editor access to the property.

  1. Sign in at analytics.google.com. For a first account, choose Start measuring, give the account a name, and review its data-sharing settings. If you already manage Analytics, select the account that should own the property. Use Admin → Create → Account if a separate organization needs its own account.
  2. In Admin, choose Create → Property. If you have just created an account, continue to the property form in the setup flow.
  3. Enter a name that will be easy to recognize, such as Example Website. Choose a reporting time zone that fits how you compare days of activity. Choose a currency for the site’s monetary reporting.
  4. Complete the industry, business size, and objectives screens, then create the property. The objectives help determine which reports are shown in the default navigation.

The account, property, and stream screens are covered in Google’s Analytics setup instructions.

2. Create a web data stream and choose what it collects

In the intended property, go to Admin → Data collection and modification → Data streams. Select Add stream → Web, enter the published address, such as https://example.com, and give the stream a clear name. After creating it, open Stream details and copy the Measurement ID. Use the stream that belongs to the production website when you install the tag.

ID Where it is used
G-… Identifies the GA4 web stream in a website integration, a GA4 tag, or Tag Assistant.
GT-… Identifies a Google tag. Its settings show which destinations it serves.
GTM-… Identifies the Tag Manager container you install on the website.
Property ID Identifies the Analytics property in its settings and in integrations that ask for its numeric ID.

Stream details can also show a numeric Stream ID. For a website integration that asks for a measurement ID, use the value beginning with G-.

The Google tag records activity as events. An event has a name, such as page_view, and can carry details called parameters. The page_location parameter on a page view contains the page URL. Checking that value is how you tell whether GA4 recorded the article or the contact page in the example.

Review the Enhanced measurement settings for the stream. They can collect several interactions without extra event tags. Enable the ones that will answer a question you have about the site, and check that they fire under the conditions you expect.

  • Scrolls record the first time 90% of a page’s vertical depth becomes visible. Use the event as a rough measure of how far down a page visitors get.
  • Outbound clicks record eligible links to other domains. Domains included in cross-domain measurement are treated as part of the same journey.
  • Site search can record a search when the results URL contains a recognized query parameter, such as q or s. Check the address after making a search and make sure the term is suitable for collection.
  • File downloads record clicks on links to supported file types. They measure the click to the file.
  • Form interactions can record starts and submissions. Test them on the site’s actual forms. For an inquiry count, use an event tied to a confirmed submission, as described below.

A standard Google tag sends a page view when the page loads. Enhanced measurement also has an advanced setting for page views based on browser history changes. That setting matters on sites that change pages using JavaScript without loading a new document.

3. Install the tag using one method

Pick the method that fits how the site is managed. Before adding anything, check the theme, plugins, and any Tag Manager container for an existing installation. If a working tag already sends to the correct stream, use it. Two installations can count the same page load twice if they both report to the same property.

WordPress with Site Kit

  1. Install and activate Site Kit by Google in WordPress, then complete its initial setup.
  2. Open Site Kit → Settings → Connect More Services → Analytics → Set up Analytics. If Analytics is already connected, use Connected Services → Analytics → Edit to review the selection.
  3. Select the intended account, property, and web stream. Enable Place Google Analytics code if Site Kit will install the tag. If another plugin or Tag Manager already handles the installation, Site Kit can connect to the property with code placement turned off.
  4. Test the published site while logged out of WordPress. Site Kit excludes logged-in users by default. If you use a page cache, check that the public page is serving the updated version.

Blogger

Choose the blog in Blogger. Open Settings, find Google Analytics Measurement ID under Basic, and save the web stream’s G- ID. Visit the blog’s public address and test a post as well as the homepage. If the blog has a separate mobile layout, test that version too.

Blogger’s built-in integration requires a Layouts theme if the blog still uses a first-generation Classic template. Take a backup before editing or changing the Blogger theme.

A website builder or custom site

If the builder has an Analytics integration, enter the G- measurement ID in that integration and publish the change. If the platform expects HTML instead, use its site-wide head code field.

For a site where you control the HTML, open the web stream and find View tag instructions → Install manually under Google tag. Some setups put Installation instructions inside Configure tag settings. Copy the full snippet for the intended tag. Place it in the document head immediately after the opening <head> tag. Use the shared layout if multiple pages use it. Publish the change, then check pages built from different templates.

Google Tag Manager

Use this method if a web container already manages the site’s tags. If you are setting up Tag Manager as well, first install that container using its own installation instructions and confirm that it loads on the public site.

  1. In the site’s web container, open Tags → New. Choose Google Analytics → Google Analytics if the upgraded container offers the Analytics destination tag. Otherwise, choose Google Tag. Use the intended web stream’s G- ID as the Tag ID.
  2. Add the Initialization trigger for all pages that should be measured. If the container manages consent, use Consent Initialization for the tag that sets the default consent state so those settings are in place when Analytics starts.
  3. Save the tag. In Preview, connect to the site, open two pages, and check that the tag fires with the correct destination. Keep the base tag responsible for automatic page views on ordinary page loads.
  4. Use Submit → Publish to release the tested container. Open the live site in a fresh session outside Preview to verify what visitors receive.

If the site uses a consent banner, test a fresh session that accepts analytics and a separate session that declines it. With basic consent mode, Analytics tags are blocked until the relevant consent is granted. In advanced consent mode, tags can load and send limited signals without analytics cookies when consent is denied. When the tag loads, use the Consent view in Tag Assistant to check the default analytics_storage state and how it changes after the visitor makes a choice.

Keep names, email addresses, phone numbers, and form messages out of Analytics. Review page titles, URL paths, query strings, and event parameters. In the example, a confirmation URL such as /contact/thanks/ can work without putting the visitor’s email in the address.

4. Verify the data at three points

Test the published site in a fresh browser session. Use the site’s normal consent flow and grant analytics consent for this test if prompted. On the example site, open /guides/, then follow the link to /contact/. The two URLs give you a way to check whether the installation works beyond the homepage.

  1. Tag Assistant shows what the browser sends. Open Google Tag Assistant, select Add domain, and connect the test page. Select the detected Google tag or container and inspect the events it sends. Look for the intended G- destination and a page_view on each page. If a GT- tag appears, check its connected destination.
  2. Realtime shows recent activity in the property. In the correct property, go to Reports → Realtime. Look for page_view in Event count by Event name and the pages you opened in the views card. The report includes other visitors in the recent window, so a rising count can come from several visits.
  3. DebugView lets you follow your own test. Keep the Tag Assistant session connected. In GA4, go to Admin → Data display → DebugView and select your test device. Open each page_view in the timeline and inspect page_location. The first event should contain the article URL and the next should contain the contact page URL.

For a new installation, Google says data collection can take up to 30 minutes to start. Realtime usually shows recent events within a few minutes once data is flowing. Standard report data can take 24 to 48 hours to finish processing. Use Tag Assistant and DebugView to diagnose the setup while you wait for those reports.

5. Measure a successful form submission

A key event is a recorded action you have marked as important in GA4. The example site wants to know how many visits lead to inquiries. It can use Google’s recommended generate_lead event when the site confirms that it accepted a contact form submission.

Send the event from the form’s success step

If the site uses the Google tag directly, call gtag from the code that handles a confirmed success, after the tag has been initialized. Replace the sample ID with the measurement ID for the intended stream.

gtag('event', 'generate_lead', {
  send_to: 'G-ABC123DE45'
});

The send_to parameter directs this event to that stream. If you have a monetary value for the inquiry, use a numeric value and its three-letter currency together. The event can record a lead count without a monetary value.

If the site uses Tag Manager, the success handler can push a signal to the data layer, which is how the page tells the container that something happened.

window.dataLayer ??= [];
window.dataLayer.push({
  event: 'contact_form_success'
});

In the container, create a Custom Event trigger for contact_form_success. Attach it to a Google Analytics: GA4 Event tag. Set its Measurement ID to the same web stream and its Event Name to generate_lead. Preview the form and publish the tag once the tests pass.

With either installation, send the event once per accepted submission. If the form redirects immediately, verify that the event reaches GA4 during the actual journey. A test that runs only on the confirmation page can miss a timing problem before the redirect.

Use a confirmation page when a page view is the available signal

Some forms redirect to a dedicated thank-you page and offer limited access to the success code. In Admin → Data display → Events, choose Create event → Create without code. Name the event lead_confirmation_view, select the relevant web stream if prompted, choose page_view as the source event, and set the URL rule to match the actual confirmation page, such as https://example.com/contact/thanks/. The new event counts views of that page and preserves the original page view.

A direct visit or a reload of the confirmation page can also match that rule. If each accepted form submission needs to be counted once, use the success event from the form itself. Use one definition for the inquiry metric and allow time for a new rule in GA4 to take effect before testing it.

Test the event and mark it as a key event

Use Tag Assistant and DebugView to check how many generate_lead events each action sends in the form-success implementation.

Test action New leads
Open the contact page 0
Try to submit with a required field missing 0
Send a valid inquiry and see confirmation 1
Reload the confirmation page 0

In Admin → Data display → Events, find the verified event in Recent events and click its star to mark it as a key event. If it only appears in DebugView so far, allow time for GA4 to process it. You can also set the Mark as key event toggle when creating a new event. The designation applies to future data.

With Once per event, two valid submissions in the same session can count as two key events. Once per session answers whether the visitor completed the action at least once in that session. Use your DebugView tests to catch duplicates at their source.

6. Keep test traffic and connected domains straight

Separate staging and review internal traffic

If you run frequent tests on a staging site, leave the production tag off that site or send its events to a separate test property. In a production property, an internal traffic rule can identify visits from a known public IP address or range.

In the web stream, go to Configure tag settings → Show more → Define internal traffic. Create a rule with the intended address and a traffic_type value, such as internal. In Admin → Data collection and modification → Data filters, create or review the Internal Traffic exclusion for that same value. Start in Testing. In Explore, use Test data filter name with Event name and Event count to see which activity matched. The filter can take 24 to 36 hours to apply. Check both a known internal visit and ordinary external traffic before activating it. An active exclusion permanently discards matching incoming data.

If you plan to use Explorations over longer periods, also review Data retention in Admin. The standard options for detailed user and event data are two and 14 months. That setting determines how far back you can analyze detailed data in Explorations and funnel reports.

Follow a journey across domains you can tag

If a visitor moves from the website to a separate booking or checkout domain you can tag, put the same web stream’s G- ID on both domains. In the web stream, open Configure tag settings → Configure your domains and add the domains involved. This lets Analytics carry the visitor and session identifiers between domains when the necessary consent is granted.

Test the actual link or form that crosses domains. Look for the _gl parameter on the destination URL and check that both pages send events to the intended stream. If a redirect removes that parameter, adjust the redirect to preserve it and test the journey again.

7. Diagnose missing or duplicate events

  • Tag Assistant finds no tag. Check the actual published page and confirm that the plugin change, shared layout, or Tag Manager version was released. If the tag appears on the homepage, compare it with an article or product page that uses a different template.
  • The tag is present and no event goes to the right stream. Open the destination details in Tag Assistant and compare its G- ID with Stream details. Check whether the trigger fired and which consent state was in effect. Test in a clean browser session with analytics consent granted and without a content blocker.
  • Tag Assistant shows the event and the regular report is empty. Check the selected property and date range. Use DebugView or Realtime for the fresh event, then allow time for report processing. If office visits are missing after processing, check whether an active data filter excludes the test network.
  • One page load sends two page views. Check whether both events carry the same page URL and go to streams in the same property. Look for code installed through both a plugin and Tag Manager, or a manual page_view running alongside automatic page views.
  • The first page appears and later navigation is missing. If the site uses client-side rendering or navigation, check whether changing routes updates browser history. Use the history-based page view option where it matches the site’s routing. For other routing, have the site send a virtual page_view on each intended route change. Verify the updated page_location and keep one source for each route view.
  • Lead counts jump after a form change. Repeat the success, error, and reload tests. Check whether the site now sends a success event in two places, or whether a confirmation URL rule counts repeat views of the page.

8. Read the first reports

Once data has had time to process, use the report that matches the question you want to answer.

  • Traffic acquisition shows how sessions arrived. Use Session source / medium or the session channel grouping to compare sources such as organic search and email.
  • Pages and screens shows what visitors viewed during their visits. Find the article and contact page to see activity on each.
  • Landing page shows which page started a session. Look at sessions that began on the article and check the lead key event to see whether those sessions led to inquiries.
  • Events shows how often each event was received. Use it to check that generate_lead appears and to compare its count with the site’s own confirmed submissions, accounting for consent choices and excluded traffic.

If you want to see which Google Search queries led people to the article, use the Search results performance report in Search Console. It records search clicks and impressions. Use GA4 to follow what visitors did after they arrived.

For the example site, the setup is ready when the article and contact page each send the expected page view, the form sends one lead event after a successful submission, and those events reach the same property. Repeat that test after changing a theme, container, or form so you can catch a break before relying on the reports.

JOIN THE CONVERSATION

Comments

Have a question or something to add? Comments are moderated and appear here only after approval.

No approved comments yet. Be the first to join the conversation.

    JavaScript is required to submit a comment. Published comments above remain available to read.