Installing Google Analytics 4 with gtag

Google Analytics BCS 6 years ago (2019-12-18) 2215 Views 0 Comments

Update time: June 11, 2025

This article will introduce how to install Google Analytics 4 using gtag

Create GA4 Property

In GA4, click 「Admin」——「+Create」——「Property」:

Create Property

  • Property name: Generally fill in the domain name of the website.
  • Reporting time zone: Fill in your time zone.
  • Currency: Select the currency type.

After configuration, click 「Next」.

 

Business Details

  • Industry category(Required): Select the industry type of the website.  
  • Business size (Required): Select number of employees

After configuration, click 「Next」.

Business objectives

This setting will mainly generate some built-in reports for different industries. Choose according to your needs:

After configuration, click 「Create」.

 

Data collection

This step is to create a Data Stream:
There are IOS, Android and Web, these three types of data can be directed to the same Property.
Here we choose Web to start setting up data steam.
  • Website URL: Set the homepage address of the website.
  • Stream name: Set the name of the website.
  • Enhanced measurement: Some of the built-in tracking can be achieved only by checking, which is very convenient.default is to select all, you can remove it according to your needs.

After setting, click「 Create & Continue」to create Data Stream.

Data Stream is set up, this is the detailed information of the data stream.

  • STREAM URL: The default address of the website.
  • STREAM NAME: Site name.
  • MEASUREMENT ID: similar to Tracking ID.
  • STREAM ID: similar to Tracking ID.

MEASUREMENT ID and STREAM ID are similar to Tracking ID, but MEASUREMENT ID can only be used in the Web, and STREAM ID can only be used in APP.

 

Install gtag to Website

This method is to deploy the gtag tracking code directly to the template page of the website without using GTM.

APP+Web

Copy this code, log in to the server, find the head position of the template page, and paste it.

APP+Web

If you don’t have server permissions, please send this code to the developer’s notice and let them help deploy.

 

Test and Verify

In the browser developer tools, under Network, filter by “v=2“, you can see the data is sent to GA4 server.

 

 

Read More :


If you don't understand, You can leave a comment below.
Like (0)
Post my comment
Cancel comment
Expression Bold Strikethrough Center Italic

Hi, you need to fill in your nickname and email!

  • Nickname (required)
  • Email (required)
  • Website