Thursday, July 4, 2024
HomeWeb AnalysisExplain how to issue a tracking code with GA4 and install it...

Explain how to issue a tracking code with GA4 and install it on the page and the procedure

In this article, we will explain how to issue and install a tracking code with GA4. We will also introduce the specification changes with UA, how to check the tracking ID / tracking code, and points for installation, so please use it as a reference for installing the tracking code.

Table of contents

  1. What is GA4 Tracking ID and Tracking Code?
  2. How to issue GA4 tracking ID/tracking code
  3. How to check GA4 tracking ID/tracking code
  4. How to install GA4 tracking ID/tracking code
  5. How to check the operation after installing the GA4 tracking code
  6. Points for installing GA4 tracking code
  7. Issuing and installing a GA4 tracking code is surprisingly easy

Google Analytics 4 (GA4) basics and implementation steps

open form

Fill out the form to download the material for free

Surname

given name

Nice to meet you, null. Please enter your email address first.

email address

Please enter your phone number.

telephone number

Please enter your company name and website URL.

Company Name

website

Please select the number of employees in your company.

Please select the number of employees in your company.

1

Does your company offer any of the services listed below?

Web design

digital marketing

SEO/SEM

Advertising agency

yes

no

Download now for free

What is GA4 Tracking ID and Tracking Code?

Tracking ID and tracking code have different meanings. Before we dive into the various settings, let’s understand the differences.

Tracking ID is a string included in the tracking code, which is different for each site . It is written as “UA-xxxxxxxxx-x” for UA and “G-xxxxxxxxxx” for GA4.

  • GA version: UA (measurement ends on July 1, 2023)
    Tracking ID: UA-xxxxxxxxx-x
  • GA Version: GA4
    Tracking ID: G-xxxxxxxxxx

On the other hand, the tracking code is the source code for analyzing data , and must be installed on the page within the site. The tracking ID is written in the part of the code as follows.

UA’s tracking code is as follows.

<!– Google tag (gtag.js) ->
<script async src=https://www.googletagmanager.com/gtag/js?id= UA-xxxxxxxx-x ></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(‘js’, new Date());
gtag(‘config’, ‘ UA-xxxxxxxx-x ‘);
< /script>

The tracking code for GA4 is as follows.

<!– Google tag (gtag.js) 
<script async src=https://www.googletagmanager.com/gtag/js?id= G-xxxxxxxxxx ></script>
<script>
window.dataLayer = window. dataLayer || []; function gtag(){dataLayer.push(arguments);}
gtag(‘js’, new Date());
gtag(‘config’, ‘ G-xxxxxxxxxx ‘);
</script>

In UA, a tracking ID was issued at the time of initial setting, but it is not issued at the time of initial setting in GA4, so it must be obtained manually.

How to issue GA4 tracking ID/tracking code

From here, I will explain how to issue a tracking ID/tracking code for GA4.

1. Log in to Google Analytics

Log in to Google Analytics and open [Admin] from the right column menu. If you do not have a Google account, create one by referring to the ” Create a Google Account ” page.

2. Create property

A property for GA4 is created when you create your Google Analytics account.

If you are already using UA property and GA4 property is not displayed, select [+Create property] from [Properties] on the right side of the screen to create it.

To issue a tracking code for UA, you need to create a separate property for UA. From Property Settings, select Show advanced options and check the Create Universal Analytics Property button. After entering the necessary information such as the site URL and clicking [Create], a tracking code will be issued.

3. Create data stream

Select the GA4 property you created and click [Data Stream].

The screen will change and the message “Start data collection” will be displayed, so select any platform. Preparations are now complete.

How to check GA4 tracking ID/tracking code

1. Login

Log in to Google Analytics and select the account and property created for GA4 from the [Admin] tab.

Then open Administration at the bottom of the menu in the left column.

2. Select data stream

Click [Data Stream] from [Properties] on the right side of the management tab.

Select any one from the created data stream list.

The [Measurement ID (G-xxxxxxxxxx)] displayed on the right side of [Web Stream Details] on the screen after transition is the GA4 tracking ID .

To check the tracking code, click [View tag implementation instructions] displayed at the top right of the screen and select [Install manually].

How to install GA4 tracking ID/tracking code

After confirming the tracking ID and tracking code, set the tracking code on the page of any site.

There are two ways to set it on the page: “How to set it in the HTML source” and “How to use Google Tag Manager”. We will walk you through each step.

How to place in HTML source

1. Login

Log in to Google Analytics and select the account and property for GA4 you created.

Open Administration at the bottom of the menu in the left column.

2. Select data stream

Select any one from the created data stream list.

Click [View tag implementation instructions] displayed at the top right of the screen, and select [Install manually].

Copy the Google tag (tracking code) displayed on the [Implementation procedure] screen after the transition.

Paste the copied tracking code into <head> of HTML of the page to be measured .

Regarding the location of the tracking code, UA recommended just before (the end tag). Note that the specs have changed in GA4. For more information, see Analytics Help ” [GA4] Troubleshooting Tagging on Websites “.

How to install using Google Tag Manager

Google Tag Manager (hereafter referred to as “GTM”) is a tool that can centrally manage various tags such as analytics tags and advertising tags. You can install the GA4 tracking code from the GTM management screen .

1. Login

Log in to Google Analytics and select the GA4 account and property you created.

Open Administration at the bottom of the menu in the left column.

2. Select data stream

Select any one from the created data stream list and copy the measurement ID (tracking ID).

3. Create a new tag from Google Tag Manager

Log in to Google Tag Manager and select Add New Tag.

From [Select Tag Type], select [Google Analytics: GA4 Settings].

Paste the measurement ID you copied in GA4 into the [Measurement ID] field.

Set a trigger. Select [All Pages] to start page measurement.

4. Publish Tag Manager

Click [Publish] displayed on the upper right of the screen to complete the installation from the tag manager.

How to check the operation after installing the GA4 tracking code

After setting and publishing tags and triggers from the GTM management screen, we will check the operation. There are two types of confirmation methods: “Check with real-time report” and “Check with GTM”.

How to check with real-time report

Click Reports from the left column menu and select Real Time.

Please visit the target site and check whether the measurement is normal (whether the number of users is counted). If it is not working, check the location of the tracking code (

is installed in the tag) and the tracking code is correct.

How to check with GTM

When checking from the GTM management screen, check the firing of the tag in preview mode.

Select [Tags] from the left column menu and click [Preview] in the upper right.

A modal screen will appear. Enter any URL in [Your website’s URL] and click the [Connect] button.

When you see the “Connected!” message, click the Continue button.

If GA4 is displayed in [Tags Fired] on the Summary screen, it is working properly.

Points for installing GA4 tracking code

When installing the GA4 tracking code, there are several points to keep in mind.

Beware of double counting

If you install the same tracking code multiple times, the measurement will be duplicated, so be careful.

For example, the Google Analytics tracking code in the HTML source

If you install it from GTM as well, it will be double measurement. Let’s limit the location of the tracking code to one of them.

Link with CMS

WordPress, HubSpot, Wix, and other CMS that support GA4 can be set up simply by entering an ID in the “G-” format. However, if the CMS side does not support GA4, it must be installed manually.

For a list of CMSs that support GA4, how to set them up, and what to do if your CMS does not support GA4, see “[GA4] Set up a website hosted on a CMS with Analytics”. Please take advantage of it.

UA and GA4 tracking codes can be used together

Both UA tracking code and GA4 tracking code tags can be used together. Support for UA is scheduled to end in July 2023, but it will not be double measurement if you continue to measure with UA and use the GA4 tracking code. In order to make the transition to GA4 smooth, it is a good idea to install a GA4 tracking code in advance and get used to using it .

Issuing and installing a GA4 tracking code is surprisingly easy

The procedure from issuing a GA4 tracking code to installing it can be done easily as introduced in this article. If you use a CMS that supports GA4, you can link with just entering the tracking ID, so you can measure more conveniently. However, be sure to check thoroughly before proceeding to avoid double installation or incorrect installation locations. Also, UA and GA4 have different specifications. We recommend that you introduce GA4 and familiarize yourself with it before the end of UA support in July 2023.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Recent Posts

Most Popular

Recent Comments