Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPBカップ
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

初心者のためのWordPressにGoogleアナリティクスをインストールする方法

編集メモ: WPBeginner のパートナーリンクから手数料を得ています。手数料は編集者の意見や評価に影響を与えません。編集プロセスについて詳しく知る。

訪問者がコンテンツにどのようにアクセスしているかを理解することは、サイトオーナーとしての目標を達成するための鍵となります。あなたの目的が、忠実な読者を増やすことであれ、売上を増やすことであれ、ニッチな分野で権威を確立することであれ、サイトのトラフィックデータにアクセスすることは非常に重要です。

そこで、Googleアナリティクスの出番です。Googleが提供する無料で強力なツールで、オーディエンスの行動に関するインサイトを提供してくれます。これにより、サイトやコンテンツ戦略を改善するためのデータに基づいた意思決定を行うことができます。

16年以上にわたる経験から、Google アナリティクスはオーディエンスを知るための最良の方法であり続けていると信じています。私たちはまた、多くのユーザーがWordPressサイトにGoogleアナリティクスをインストールし、使い始めるのをお手伝いしてきました。

この投稿では、なぜGoogleアナリティクスが重要なのか、そしてWordPressにGoogleアナリティクスを簡単にインストールする方法(ステップバイステップ)をご紹介します。

How to Install Google Analytics in WordPress

まず、なぜGoogleアナリティクスが重要なのか、そしてどのようにサイトを成長させることができるのかを説明します。

その後、Googleアナリティクスのアカウント登録方法と、WordPressサイトへのインストール方法をご紹介します。

最後に、Google アナリティクスでトラフィックレポートを表示する方法を説明します。

この投稿で学ぶことの概要を簡単に説明しよう:

準備はいいかい?始めよう

なぜGoogleアナリティクスはブロガーにとって重要なのか?

ブログを始めたら、一番の目標はトラフィックと購読者を増やすことです。Google アナリティクスは、重要な統計情報を表示することで、データに基づいた意思決定を支援します。見ることができます:

誰があなたのサイトを訪問しますか?

アナリティクスのこの部分には、ユーザーの地理的な位置、ユーザーがサイトを訪問する際に使用したブラウザー、画面の解像度、JavaScriptのサポート、Flashのサポート、言語などのその他の重要な情報が表示されます。

このデータは非常に便利で、さまざまな面で役立ちます。カスタムサイトのデザインを作成する際、ユーザーデータを使用して、サイトがオーディエンスに適合していることを確認することができます。

ほとんどのユーザーがFlashをサポートしていないのであれば、サイトにFlash要素を追加するのは避けるべきです。ユーザーのほとんどが1280の画面解像度を使用している場合は、その解像度以下に対応したデザインにしてください。

あなたのサイトを訪れた人は何をするのか?

ユーザーがサイトのどこに移動しているのか、どれくらいの時間滞在しているのか、直帰率(初回訪問時にサイトを離脱したユーザーの割合)などをトラッキングすることができます。

この情報を使うことで、直帰率を減らし、ページビューを増やすことができる。

また、最も人気のある投稿、あまりうまくいっていない投稿、ユーザーが求めているコンテンツも見つけることができます。

人々はいつサイトを訪れるのか?

あなたのサイトで1日のうち最もホットな時間帯を調べることで、投稿を公開するのに最適な時間を選ぶことができます。その時間帯があなたの時間帯と合わない場合は、その時間帯に投稿をスケジュールすることができる。

人々はどのようにしてあなたのサイトを見つけるのでしょうか?

アナリティクスのこのセクションは、ユーザーがどこから来たかを示します。例えば、検索エンジンを利用したのか、直接リンクを入力したのか、他のサイトからのリファラーリンクをクリックしたのか。

また、それぞれのソースからの訪問者の割合も表示されます。Google アナリティクスでは、これらのカテゴリーごとの内訳を見ることができます。検索エンジンのカテゴリーであれば、Google、Yahoo、Bingなど、どの検索エンジンからのトラフィックが最も多いかがわかります。

参照元の内訳を見れば、どのサイトと最も連携する必要があるかがわかる。リファラーの参照元がFacebookであれば、Facebook限定のコンテンツが必要です。

リファラーの参照元が外部のサイトである場合、そのサイトとの提携(ゲスト投稿の交換など)を検討するとよいだろう。

人々はあなたのコンテンツにどのように接しているのか?

Google アナリティクスは、ユーザーがサイトのコンテンツにどのようにアクセスしているかを表示します。ユーザーの何パーセントがあなたのサイトのどのリンクをクリックしたかなどがわかります。

Google アナリティクスでコンテンツ実験を行うことで、A/Bスプリットテストを実施し、目標を達成するために何が最も効果的かを理解することができます。

ユーザーのインタラクティブ性を見ることで、ユーザーに合わせてコンテンツを作成することができます。上記の質問に対する答えを見ることで、サイトに効果的な戦略に集中し、効果的でない方法を避けることができます。

簡単に言えば、推測を排除し、重要な統計に集中することで、データに基づいた意思決定ができるようになる。

動画チュートリアル

Subscribe to WPBeginner

書面による指示を希望される方は、このまま読み進めてください。

Google アナリティクスへの登録方法

Googleアナリティクスは無料で利用でき、登録に必要なのはGoogleまたはGmailのアカウントだけだ。登録方法はとても簡単です。以下のステップバイステップの手順に従って、Googleアナリティクスアカウントを作成するだけです。

ステップ1:まず、Googleアナリティクスのサイトにアクセスして登録します。サイトにアクセスしたら、「今すぐ始める」ボタンをクリックします。

Click get started today

次に、Googleアカウントでログインするよう求められます。

すでにGoogleやGmailのアカウントを持っている場合は、それを使ってログインできます。そうでない場合は、Googleアカウントを作成してください。

Sign in using your Google account

ステップ2:Gmailアカウントでサインインすると、以下のようなウェルカム画面が表示されます。

ここでGmailアカウントを使ってGoogleアナリティクスに登録します。測定開始」ボタンをクリックしてください。

Click start measuring button

その後、アカウント名の入力を求められます。

この名前は社内で使用されるため、ビジネスネームのように何でも使用できます。

Enter your Google account name

Google アナリティクスでは、複数のアカウントのデータ共有設定も表示されます。

これらの設定により、Googleアナリティクスデータの共有をコントロールすることができます。初期設定のまま次のステップに進んでください。

Account data sharing settings

ステップ3:次の画面では、Googleアナリティクスのプロパティを作成する必要があります。

Googleは、Googleアナリティクス4またはGA4と呼ばれるアナリティクスの新バージョンを導入しました。これは、サイトとモバイルアプリを同じアカウントでトラッキングする最新バージョンです。さらに、新しい機能、測定基準、レポートのインターフェースが追加されました。

プロパティ名を入力し、レポートのタイムゾーンと通貨を選択します。そして「次へ」ボタンをクリックします。

Enter property name

次の画面では、ドロップダウンメニューからあなたのサイトの「カテゴリー」を選択し、所定のオプションから「ビジネスサイズ」を選択する必要があります。

完了したら、「次へ」ボタンをクリックします。

Enter business details

次に、ビジネスの目的を選択し、Google アナリティクスをどのように使用するかを選択する必要があります。これにより、あなたのビジネスにパーソナライズされたレポートを得ることができます。

例えば、リードの生成、オンライン販売の促進、ブランド認知度の向上、ユーザー行動の調査などのオプションがある。

複数のオプションを設定することも、ニーズに合わせて指定されたオプションのすべてを選択することもできます。ベースラインレポートを取得する」オプションを選択すると、Google アナリティクスレポートがすべてアカウントに反映されます。

Choose your business objectives

完了したら、「作成」ボタンをクリックするだけです。

ステップ4:Google アナリティクス ウェブストリーム オプションが表示されます。

WordPressサイトにGoogleアナリティクスを設定するので、プラットフォームとして「Web」を選択します。

Select data collection option

その後、サイトのURLとストリーム名を入力します。

初期設定では、Googleアナリティクスは「拡張測定」オプションを有効化しています。これにより、Google アナリティクスでページビュー、スクロール、送信クリック、ファイルダウンロードなどをトラッキングできるようになります。

注: MonsterInsightsプラグインを使用する予定がある場合は、「Enhanced measurement」オプションをオフにしてください。そうしないと、プラグインは2倍の量のデータを収集し、表示します。

次に、「ストリームを作成」ボタンをクリックします。

Enter website URL and stream name

ストリーム名、URL、ID、測定IDが表示されます。

また、記録されるさまざまな強化測定値も表示される。

View stream ID and measurement ID

上部には、GoogleアナリティクスをWordPressサイトに追加する方法を示すアラートバーも表示されます。

タグの表示」ボタンをクリックしてください。これで、WordPressサイトにGoogle アナリティクスのトラッキングコードを追加するさまざまな方法が表示されるはずです。

View Analytics installation instructions

次に、「手動でインストール」タブに切り替えます。

Google アナリティクスのトラッキングコードが表示されます。

Install GA code manually

このトラッキングコードをコピーして、WordPressサイトに入力してください。また、このブラウザータブを開いたままにしておき、必要なときに切り替えてコードをコピーすることもできます。

WordPressサイトにコードをインストールしたら、Analyticsのブラウザータブを開いたままにしておくことをお勧めします。

Google アナリティクスのアカウントを設定したところで、WordPressにGoogle アナリティクスをインストールする方法を見ていきましょう。

WordPressにGoogleアナリティクスをインストールする方法

WordPressでGoogleアナリティクスを設定するには、いくつかの方法があります。ここでは、最初の設定が最も簡単で、最後の設定が最も難しい3つの方法を紹介する。

自分のニーズに合ったものを選ぶことができる。

注:Googleアナリティクスアカウントでページビューの二重トラッキングを避けるために、サイト上でこれらの方法のうち1つだけを使用する必要があります。

方法1:MonsterInsightsによるWordPress用Googleアナリティクス

MonsterInsightsはWordPress用の最も人気のあるGoogleアナリティクスプラグインです。Bloomberg、PlayStation、Zillow、WPBeginnerなど、300万以上のサイトが利用しています。

MonsterInsightsは、WordPressにGoogleアナリティクスを追加する最も簡単で最も優れた方法です。MonsterInsightsには有料のプレミアムプラグインと無料版の両方があります。このチュートリアルでは、MonsterInsights無料版を使用します。

eコマーストラッキング、広告トラッキング、投稿者トラッキングなど、より高度な機能をご希望の場合は、MonsterInsights Pro版をご利用ください。設定方法は同じです。

詳しくはMonsterInsightsのレビューをご覧ください。

始めよう。

まず最初に、MonsterInsightsプラグインをインストールして有効化します。詳しくは、WordPressプラグインのインストール方法のステップバイステップガイドをご覧ください。

プラグインを有効化すると、WordPressの管理メニューに「Insights」という新しいメニュー項目が追加され、ようこそ画面が表示されます。Launch the Wizard」ボタンをクリックしてください。

Launch setup wizard

クリックするとMonsterInsightsのセットアップウィザードが開きます。

まず、ウェブサイト(ビジネスサイト、ブログ、オンラインストア)のカテゴリーを選択するよう求められます。いずれかを選択し、「保存して続行」ボタンをクリックします。

Choose what describe your website

次に、MonsterInsightsとWordPressサイトを接続する必要があります。

MonsterInsightsを接続する」ボタンをクリックするだけです。

Connect MonsterInsights with your site

ログインするか、すでにログインしている場合はGoogleアカウントを選択します。

Googleアカウントを選択するか、メールを入力してログインしてください。

Choose Google account to sign in

次に、MonsterInsightsがGoogleアナリティクスアカウントにアクセスすることを許可するよう求められます。

許可」ボタンをクリックして続行する。

Allow access to your Google account

接続を完了するための次のステップは、追跡したいプロフィールを選択することです。

ここでサイトを選択し、「Complete Connection(接続を完了する)」ボタンをクリックして続行します。

Connect analytics with your site

その後、「Complete Connection」ボタンをクリックしてください。これでMonsterInsightsがあなたのサイトにGoogleアナリティクスをインストールします。

次に、サイトの推奨設定を選択するよう求められます。

Recommended settings

初期設定はほとんどのサイトで機能します。アフィリエイトリンクのプラグインを使用している場合は、アフィリエイトリンクのクロークに使用するパスを追加する必要があります。これにより、Googleアナリティクスでアフィリエイトリンクをトラッキングできるようになります。

MonsterInsightsはまた、誰がレポートを見ることができるかを尋ねます。WordPressのユーザー権限グループを選択することができます。

設定が完了したら、「Save and Continue(保存して続行)」ボタンをクリックして設定を保存します。

Who can see the reports

次に、MonsterInsightsが有効化したいトラッキングサイトのリストを表示します。

下にスクロールして「Continue」ボタンまたは「Skip for Now」オプションをクリックします。

Choose which tracking features to enable

次の画面では、MonsterInsightsがGoogleアナリティクスのトラッキング設定に成功したことを表示します。

Google アナリティクスが接続され、トラッキングコードがインストールされ、データが収集されていることがわかります。

Tracking should be all setup

次に下にスクロールすると、ライセンスキーを入力する欄があります。

アップグレードせずにセットアップを完了する」オプションをクリックします。

Continue setup without upgrading

WordPress サイトに Google アナリティクスを追加できました。

Google アナリティクスで拡張測定の無効化

GA4でMonsterInsightsにデータストリームを作成させる代わりに、自分でデータストリームを作成した場合は、Enhanced Measurementをオフにする必要があります。

それは、MonsterInsightsが複数のカスタム拡張トラッキング機能を追加しているからです。拡張測定オプションを有効化したままにしておくと、データに歪みが生じ、正しくない結果が表示されます。

まず、ブラウザーでGoogleアナリティクスのタブまたはウィンドウにアクセスします。ここから、左下にある「管理者」設定オプションをクリックします。

Switch to admin view in Google Analytics

管理者」ページに入ると、さまざまな設定が表示されます。

データストリーム’オプションをクリックするだけです。

Go to admin and data stream settings

次に、データストリームが表示されます。

MonsterInsightsで接続したデータストリームを選択するだけです。

Select your data stream

次の画面で、’Enhanced measurement’ オプションを無効化する必要があります。

トグルをクリックするだけです。

Disable enhanced measurement

次にポップアップウィンドウが開き、強化測定をオフにすることを確認します。

オフにする」ボタンをクリックしてください。

Click turn off button for enhanced measurement

Google アナリティクスでデータ保持設定を変更する

初期設定では、Googleアナリティクスはデータ保持設定を2ヶ月に設定します。しかし、これを変更することで、2ヶ月を超えてもカスタムレポートでデータを使用できるようになります。

まず、管理 ” データ設定 “Googleアナリティクスのデータ保持にアクセスします。

Open data retention settings

次に、「イベントデータ保持」のドロップダウンメニューをクリックします。

ここから、「14ヶ月」オプションを選択し、「保存」ボタンをクリックするだけです。

Change data retention settings

Google アナリティクスが統計情報を表示するまでに時間がかかることを忘れないでください。

WordPressダッシュボードでGoogleアナリティクスレポートを表示する

MonsterInsightsの最も優れた点は、WordPressダッシュボード内でGoogleアナリティクスレポートを表示できることです。

インサイト ” レポートページで、アナリティクスデータの概要を簡単にチェックできます。

Dashboard reports

また、MonsterInsightsのレポートに直接注釈を追加して、サイトに加えた主な変更を記録することもできます。

例えば、新しいブログ投稿を公開した時、新しいランディングページを追加した時などにメモを追加することができます。これにより、これらのイベントがトラフィックにどのような影響を与えたかをトラッキングしやすくなります。

View your site notes under the report

詳しくは、WordPressでGA4サイトアノテーションを取得する方法をご覧ください。

さらに、Popular Postsアドオンが付属しており、トラフィックとページビューを増加させるために、パフォーマンスの高いコンテンツを表示することができます。

MonsterInsights Popular Posts Widget

人気投稿のインラインリンクを自動的に追加して、エンゲージメントを高めることができます。

オンラインストアを運営している場合は、各ブログ投稿の末尾に売れ筋商品を自動的に追加して売上を伸ばすこともできる:

MonsterInsights popular products

注:MonsterInsightsは以前、Google アナリティクス for WordPress by Yoastとして知られていた。WPBeginnerの創設者であるSyed Balkhiは、2016年にこのプラグインを買収し、MonsterInsightsにリブランドしました。現在は、当社のプレミアムWordPressプラグインファミリーの一部となっています。

方法2:WPCodeを使ってWordPressにGoogle アナリティクスをインストールする

この方法は、高度なトラッキング設定ができず、WordPressダッシュボードでGoogleアナリティクスのデータを表示できないため、MonsterInsightsほど優れていません。

まず、先ほどのステップ4でGoogleアナリティクスのアカウント作成時にコピーしたトラッキングコード(グローバルサイトタグ)をコピーします。

Install GA code manually

次に、WPCodeプラグインをインストールし、有効化する必要があります。詳しくは、WordPressプラグインのインストール方法のステップバイステップガイドをご覧ください。

有効化したら、Code Snippets ” Header & Footerページにアクセスする必要があります。ここで、先ほどコピーしたGoogleアナリティクスのトラッキングコードを「ヘッダー」セクションにペーストしてください。

Enter tracking code in header using WPCode

変更を保存」ボタンをクリックして、設定を保存することを忘れないでください。

以上で、Google アナリティクスのサイトへのインストールはすべて完了です。

方法3:WordPressテーマにGoogleアナリティクスをインストールする

この方法は、コードに詳しい上級ユーザー向けだ。テーマを変更したり更新したりするとコードが消えてしまうので、やや信頼性に欠ける。

この方法を使うことはほとんどお勧めしない。

WordPressファイルにコードを追加するのが初めての場合は、WordPressでコードスニペットをコピー&ペーストする方法をご覧ください。

まず、ステップ4でコピーしたGoogleアナリティクスのトラッキングコードをコピーします。ウェブストリームインストールセクションの「手動インストール」タブで表示できます。

Install GA code manually

WordPressのテーマファイルにこのコードを追加する一般的な方法は2つあります。どちらか一方を選べばよい(両方は不可)。

1.header.phpファイルにコードを追加する

WordPressテーマのheader.phpファイルを編集し、<body>タグの直後に先ほどコピー&ペーストしたGoogleアナリティクスのトラッキングコードを貼り付けるだけです。

変更を保存し、サーバーにファイルをアップロードすることを忘れないでください。

2.関数ファイルによる追加

GoogleアナリティクスのトラッキングコードをWordPressの関数ファイルに追加することもできます。そうすれば、WordPressサイトのすべてのページにトラッキングコードが自動的に追加されます。

テーマのfunctions.phpファイルにこのコードを追加する必要があります。

<?php
add_action('wp_head', 'wpb_add_googleanalytics');
function wpb_add_googleanalytics() { ?>
 
// Paste your Google Analytics tracking code from Step 4 here
 
<?php } ?>

上記のスニペット内の「Paste your Google アナリティクス tracking code from Step 4 here(ステップ4で使用したGoogleアナリティクスのトラッキングコードをここに貼り付ける)」の部分を、Googleアナリティクスのコードに置き換えることをお忘れなく。

Google アナリティクスでレポートを表示する

Google アナリティクスは、あなたの統計から収集されたデータの宝庫を表示することができます。Google アナリティクスのダッシュボードにアクセスすると、このデータを表示できます。

左のカラムにビルトインのGoogleアナリティクスレポートが表示されます。各セクションは異なるタブに区切られており、タブをクリックすると展開され、より多くのオプションが表示されます。

GA4 reports

Google アナリティクス 4のレポートは、これまでのユニバーサル アナリティクスのレポートとは少し異なります。左の列には、専用のレポートオプションがあります。レポートは、ライフサイクルとユーザーを含む2つのカテゴリーにまとめられています。

GA4のレポートで最も顕著な違いの1つは、直帰率の指標がないことです。それ以外には、新しいレポートインターフェース、エンゲージメント時間のような新しい指標、GA4にゴールがないことなどがあります。

Google アナリティクス4の各種レポートの内訳は以下の通りです:

  • リアルタイムレポートはユニバーサルアナリティクスに似ており、サイト上の有効化したユーザーをリアルタイムで表示します。
  • 獲得レポートは、オーガニック、リファラー、メール、アフィリエイトなど、ユーザーがどの媒体を使ってあなたのサイトを見つけたかを示します。
  • エンゲージメントレポートは、サイト上で発生したコンバージョンやイベントを表示します。
  • マネタイズレポートは、アプリ内課金やパブリッシャー広告などの新しいレポートとともに、eコマースデータをすべて一箇所に表示します。
  • リテンションレポートは、基本的に新規訪問者と再訪問者を表示し、ユーザーリテンションに関する洞察を得るのに役立ちます。
  • デモグラフィックスレポートでは、上位の国や都市などからのサイトトラフィックを確認することができます。また、性別の内訳や関心度のレポートも表示されます。
  • テックレポートでは、人々がどの端末、ブラウザー、オペレーティングシステム、アプリのバージョン、画面サイズを最も使用してサイトを表示しているかを表示します。

Google アナリティクスを最大限に活用しよう

Google アナリティクスは、驚くほどパワフルなツールで、素晴らしい機能がたくさんあります。その中には、ごく当たり前で簡単に使えるものもあれば、追加設定が必要なものもある。

Google アナリティクスのレポートを最大限に活用するためのリソースをご紹介します。

Google アナリティクスは、Google Search Console(旧Googleウェブマスターツール)との連携が最適です。検索結果であなたのサイトがどのように表示されているかを確認することができます。Google Search Consoleの使い方については、Google Search Console完全ガイドをご覧ください。

WordPressのSEOランキングを向上させ、より多くのトラフィックを獲得したいのであれば、オールインワンのSEOツールキットであるWordPress用AIOSEOプラグインの使用をお勧めします。

AIOSEOの無料版もあります。

このプラグインは、適切なスキーママークアップ、サイトマップ、SEOランキングを向上させるために必要なあらゆるものを使ってWordPressサイトを完全に最適化するのに役立ちます。

この投稿が、WordPressにGoogleアナリティクスをインストールする方法を学ぶのにお役に立てば幸いです。Google アナリティクスと Jetpack Statsの比較や、専門家によるWordPress 向けの最適なアナリティクス ソリューションの比較もご覧ください。

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

情報開示 私たちのコンテンツは読者支援型です。これは、あなたが私たちのリンクの一部をクリックした場合、私たちはコミッションを得ることができることを意味します。 WPBeginnerの資金源 をご覧ください。3$編集プロセスをご覧ください。

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

究極のWordPressツールキット

ツールキットへの無料アクセス - すべてのプロフェッショナルが持つべきWordPress関連製品とリソースのコレクション!

Reader Interactions

845件のコメント返信を残す

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Mrteesurez says

    Concerning adding Google analytics to a site using Monsterinsights, if one has WordPress installed on sub directory like example.com/market, Is it sufficient to just have GA4 installed with Monsterinsights on the main site only ??
    Or I will do that for each sub directory where WP is installed.
    I am asking this, because I have heard main site and sub directory are considered same website.
    thanks.

    • WPBeginner Comments says

      Depending on how the sites and domains are set up in this case, you would need to have MonsterInsights installed for each website.

  3. mohadese esmaeeli says

    Hello, friends.
    I have connected Google Analytics to my site, but I don’t have options like Behavior or site speed. How can I add these settings? I would appreciate your guidance.

  4. Uzair says

    When implementing the analytics snippet through the functions.php file of a theme, there’s a risk that these modifications might be lost during theme updates. Using a child theme for such customizations is a smart strategy because changes made in a child theme won’t be affected by updates to the parent theme. This way, your analytics snippet or any other custom code remains intact and functional even when the main theme is updated.

    • WPBeginner Support says

      That is an option as well but if you are only using a child theme to add Analytics codes we would recommend using a plugin instead.

      管理者

      • Moinuddin Waheed says

        Using wpcode for writing any type of additional code in wordpress is best practice.
        The option of enable and disable according to our requirements has made the addition of code much easier.
        It helps in managing the code snippets and check for any vulnerability that may arise due to the code.
        As long as we need, enable to code snippet and disable when not needed anymore.
        I think for this speicific purpose only, better to use wpcode plugin instead of going with child themes.

  5. Fajri says

    Tracking a website is a must. At least you will understand how your content is doing. So you can decide what to be optimized based on the user’s behaviour.

    Easiest way to do it is by using Google Site Kit plugin. But remember when you want to switch to Monsterinsight, make sure there is no double tracking code, otherwise analytic will not show the correct data.

  6. THANKGOD JONATHAN says

    Thank you for the article.
    I was using Blogger for my blogging and it has some inbuild analytics, so I didn’t care about using any analytics tools.
    But now that I am using WordPress I think this is very important.
    Thank you once more for the helpful post.

  7. Ahmed Omar says

    A beginner-friendly guide on installing Google Analytics in WordPress
    Your step-by-step instructions, especially the emphasis on creating a Google Analytics account, make tracking website performance accessible.
    considering Google Analytics Plugin for WordPress simplifies the setup and provides additional features.
    Thanks for demystifying analytics for beginners

  8. Moinuddin Waheed says

    I was struggling to get my website Linked to the Google console and and Google analytics so that I can analyse my traffic on the website and work on the required path to get my website on the right track.
    I am glad I found this article and connecting a WordPress site to Google analytics is infact a cakewalk. now with the help of this plugin I can easily setup my analytics dashboard and analyse my traffic sources. I can work on articles and posts best performing and get a know how of the reasons and keywords.
    wpbeginner has really made the life of every WordPress newbie a go to source for any problem or question.

  9. Lewis says

    Google Search Console added a slash at the end of my url with the prefix method. Do I add a slash to the Stream URL in Google Analytics, too?

    Thanks for the great content!

    • WPBeginner Support says

      It is not required to include the trailing slash to the end of your URL, it is personal preference :)

      管理者

  10. Steven says

    Why not create a child theme and add the code to the functions file? Then you’re not depending o a plug-in and you can update your theme. (Altering themes is never a good idea, because of updates and loss of changes made)

    • WPBeginner Support says

      MonsterInsights adds markup that is normally more complex than beginner admin users are used to adding which makes tracking on the site easier. If you mean the WPCode plugin, then that plugin allows you to have the code in one place instead of searching your files for the analytics code.

      Both of the methods are easier for beginners than creating a child theme. If you’re worried about the number of plugins on your site then we would recommend taking a look at our article below!

      https://wpbeginner.com/opinion/how-many-wordpress-plugins-should-you-install-on-your-site/

      管理者

  11. lusp says

    Hi,

    I’m on step 3 and it gives an internal error at the bottom left corner, anyone knows how to solve it?

    • WPBeginner Support says

      If you mean in Google itself then you may want to try disabling any ad blockers you may be running for the most common reason.

      管理者

      • lusp says

        Tried turning off ad blockers and tried it a few times in incognito mode but to no avail, the solution was to change the time zone and location to the US and it fixed the problem.

  12. Muhammad Atif says

    Why you haven’t mentioned Install Header and Footer snippet Plugin to integrate Google Analytics 4??

    • WPBeginner Support says

      Insert Headers and Footers has been renamed to WPCode but it still has the same features and more :)

      管理者

    • WPBeginner Support says

      That is a name you would set in Google Analytics so you can find it later. There is not a specific required name for it :)

      管理者

  13. Arnolfo Santoro says

    If my WordPress project starts out on a staging site, should I wait to add Google analytics until it is live?

    • WPBeginner Support says

      If you mean Google Analytics v4, this article is not updated for that at the moment but we will update it as soon as the integration for it is ready :)

      管理者

  14. Karen says

    When I tried to follow these directions, I got so far, and then I got an “Authentication Issue” message. It told me I didn’t have a Google Analytics account and needed to set one up. It then directed me to this article, but this article doesn’t tell me what to do if I get the “Authentication Issue” message. It says I need to be sure I have a Google Analytics account. That’s what I was trying to set up when I got their error. Does anyone have any ideas on how I can resolve this?

    • WPBeginner Support says

      You would want to ensure you followed our step for visiting the Google Analytics site and setting up an account on their site. If you have, you may want to check that you are on the correct Google account when trying to connect Google Analytics to your site.

      管理者

  15. Sharon says

    Does the third option you listed work on the basic or standard version of WordPress? The Business version of WordPress is required to install any plugins.

    • WPBeginner Support says

      Our tutorials are for WordPress.org sites, you would need to reach out to WordPress.com for their current restrictions.

      管理者

  16. Ricardo says

    Hii!! I have a question… if you do this by changing the header.php on the theme.. wouldn’t it be erased when the theme updates?…

  17. Urc Ite says

    Hey, nice tutorial.

    However, after installing the monsterInsights plugin, my website loads a bit slower.

    When I run the speed test, it says “reduce render blocking”.
    Is that normal??

    • WPBeginner Support says

      More than likely, the tool you are using does not like the Google Analytics tag where it is and due to Goole wanting the tag in the header it can very mildly slow a site but not enough to normally be noticeable.

      管理者

  18. Holley says

    I am a total non-techy newbie just starting out on a blog. I’m so glad I found you! Thank you for providing easy to understand step by step directions.

    Before I found out about you, I installed a header/footer plug-in on my site based on someone’s recommendation. After watching this tutorial, is there a way to undo what I’ve done and switch to MonsterInsights plug-in? I like having it on my Dashboard and it seems easier to read (once I know what all that stuff means :)

    • WPBeginner Support says

      You would remove the code from the Insert Headers and Footers plugin and the code would be removed from your site and you would be able to add using the plugin method at that point :)

      管理者

    • WPBeginner Support says

      Thank you for letting us know about that update, we’ll look to update our article when we are able :)

      管理者

  19. gwendolyn says

    OMG… THANK YOU SOOOO MUCH. I’m starting a blog with Word Press and I have really struggled to get set up for google analytics until I found you!

    You were a Blessing!!!

    Thanks for your help

  20. William Hails says

    I don’t know what I did wrong but my setup is not complete… it is not connected to my gmail account but only to my website ?

    • WPBeginner Support says

      If you have created your account then you should be able to log in with the google account you signed up with. If you have multiple Gmail accounts you may want to change accounts to see if you set up analytics on a different account.

      管理者

  21. faisal says

    may time i tried to install google analystics i functions.php in wordpress.

    its given errors

    .Your PHP code changes were rolled back due to an error on line 67 of file wp-content/themes/Extra/functions.php. Please fix and try saving again.

    syntax error, unexpected ‘<', expecting end of file.

    guide me what i do now.whats its solutions.

    • WPBeginner Support says

      You would want to try removing line 1 from the code in our guide for that specific error.

      管理者

  22. Marsha says

    I installed Google Analytics to my blog using Monster Insights via the tutorial above but I can only see analytics using the Monster Insights dashboard on WP, the analytics is not showing up on the Google Analytics website at all.

    • WPBeginner Support says

      You would want to make sure if you have multiple properties that you’re checking the correct one and you have given 48 hours for Google Analytics to populate the data.

      管理者

  23. Elena says

    I keep getting this message:
    “The selected account doesn’t have any Google Analytics Web properties.
    Please select another Google Account and make sure your Google Analytics property is set as “Web” not “Apps and web” or “Apps”.

    You can find more details about setting up your Google Analytics property in this article.

    Try picking a different app/profile to auth into”

    I’ve linked my account to Web only, but I don’t know if it’s an issue with how I worded the property? Please help! Thank you!

    • WPBeginner Support says

      If you have multiple properties, ensure you are connecting to the correct one, you can also reach out to MonsterInsight’s support for assistance with that error if everything is set correctly.

      管理者

    • WPBeginner Support says

      In your Google Analytics Admin section, there is the option to add a new account that would be your new site.

      管理者

  24. Charlotte van Noord says

    after following the instructions I got this error showing up:
    syntax error, unexpected ‘<', expecting end of file

    • WPBeginner Support says

      It would depend on how you are attempting to add the code, you may want to try some of the other recommended methods in the article for the moment.

      管理者

  25. shine htet linn says

    Dear Team,
    I tried to connect Google analytics code to the wordpress using insert Header and Footer plugin. But when i verify it said “verification unsuccessful”. Please help me to solve it.

    • WPBeginner Support says

      You would want to start by clearing the caching on your site for the most common solution to this issue.

      管理者

  26. Stephanie says

    Amazing! I love how you walked through each step, was so much easier to understand, all three methods when watching you calming and in real time go through it as a newbie.

    Bookmarking and Subscribing

  27. David ayeni says

    thanks alot, this was really helpful, fixed it in minutes, How to i add adsense to my website after that, is there any article on that

  28. Chisom says

    Hello, Thanks for this helpful article, but i have a question,
    If i use the Monster insight or the “Insert header and footer plugin”, if i create a new page after setting the analytics up, will it be automatically added to the new page or i will have to set it up again.

    • WPBeginner Support says

      Using either of those methods would automatically add the code to your new posts and pages :)

      管理者

  29. Ian Warner says

    Thanks for this helpful information. I want to install Google Analytics without Google Tag Manager. Where do I find the code for this please?

    • WPBeginner Support says

      You would not add Google Tag Manager if you do not want to use it on your site.

      管理者

  30. Helen C says

    Thanks, I dont know alot about any of this but I installed google analytics with no problem by following your tutorial.

    Now on to something else! :)

返信を残す

コメントありがとうございます。すべてのコメントは私たちのコメントポリシーに従ってモデレートされ、あなたのメールアドレスが公開されることはありませんのでご留意ください。名前欄にキーワードを使用しないでください。個人的で有意義な会話をしましょう。