SEO

How to Set Up Both GA4 and UA in Google Analytics

Currently, when you log in to Google Analytics (UA), you will see the message:
“Starting July 1, 2023, Universal Analytics will no longer process new data in standard properties. Please switch to Google Analytics 4 properties and complete the setup before then.”
Therefore, for those who are currently running new websites or web services, here is a guide on how to set up both Google Analytics GA4 and UA together.

※This method assumes you already have a Google account and have previously used Universal Analytics (UA) in Google Analytics.

Log in to Google Analytics

Google Analytics
Log in.

※From here on, click on images to view enlarged versions.

Create an Account from the Admin Panel

Click the “Admin” button at the bottom left, then click “Create Account”.

アカウントを作成

Account Settings

Enter a desired “Account Name”, and you can leave the other checkboxes as default.

アカウントの設定

Property Settings

Enter a desired “Property Name”, and select “Japan” for other settings.
Click “Show advanced options”. ※Do not click the “Next” button yet.

プロパティの設定

Enter the “Website URL” for analysis and select checkboxes as shown in the sample image.
チェック項目のイメージ

Business Overview

Select the “Business Information” that applies to the site you want to analyze.

ビジネスの概要

Agree to Google Analytics Terms of Service

On the “Google Analytics Terms of Service” screen, select “Japan” and check the agreement box.
Click the “I Agree” button.

Googleアナリティクス利用規約の同意

Get GA4 Google Tag

Click “Show instructions for tag implementation”.

タグの実装手順を表示する

Click “Install manually” and copy the GA4 tag, then save it in Notepad or elsewhere.

手動でインストールする

GA4 Tag


<!-- 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>

Close the “Web Stream Details” screen in GA4.

GA4の「ウェブストリームの詳細」を閉じる

Get UA Tag

From the GA4 “Property” dropdown, select the one containing “UA-“.

UAタグを取得

Click “Tracking Info” → “Tracking Code”.

「トラッキング情報」の「トラッキングコード」をクリック

Copy the highlighted line (one line) from the “Global Site Tag (gtag.js)”.

グローバルサイトタグ(gtag.js)

Add the UA Tag Line to the GA4 Tag

Add the one line copied from the UA tag (※line 9 below) into the GA4 tag you saved in Notepad.


<!-- 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');
  gtag('config', 'UA-XXXXXXXXXX-1');
</script>

※By copying this tag into the <head> of your site, you can track with both GA4 and UA simultaneously.

Confirm UA Analytics Tracking

While accessing the site where the tag is installed, go to the UA Analytics dashboard → “Real-time” → “Overview” to check if site visits are being tracked in real time.

UAの計測確認

Confirm GA4 Analytics Tracking

While accessing the site where the tag is installed, go to the GA4 Analytics dashboard → “Real-time” to check if site visits are being tracked in real time.

GA4の計測確認

※Please use at your own risk if you reuse this code.