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アナリティクスをインストールする方法

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

そこで、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$編集プロセスをご覧ください。

アバター

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

    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. jinson

    Hai.. I edited header.php file for Verifing Google Analitycs for my WordPress blog http://lastly.org. But after that it shows “The Google Analytics tracking code has not been detected on your website’s home page.” I tried after half an hour still the same result.
    Finally I used “Insert Header footer plugin and get the result.
    Thanks Syed.

  3. Akhil

    Actually I am using one WordPress plugin Google Analytics as I don’t want display the results on my website but I want them on WordPress itself. I have installed and configured the plugin successfully, one day it showed some visits on my websites but today it is showing same status as if no one has visited the website. But my friends have visited the website, that I have confirmed. What could be the issue?
    As someone said that google may take 3 to 4 hours to update the status, I waited. But the whole day has passed, still it is not showing any update.

    Thanks

  4. Aarish Maluja

    I have done everything right.It is showing everything ok but the data is not increasing from last month.my website is http://www.tecq.in.please help.

    • WPBeginner Support

      Aarish, Google Analytics code can not be found on your site. Please refer to second section of the article and choose another method to insert code into your WordPress site.

      管理者

  5. aarish

    i installed the tracking info correctly but the data is not increasing .It is not showing any visits.still on zero

    • WPBeginner Support

      Check your Analytics dashboard, does it detect code on your site? Generally, when Google Analytics is added to a site for the first time it may take a while before you can see any data.

      管理者

  6. Misty Young

    Thank you so much for your simple instructions! I was able to generate the Google Analytics code quickly and found the right spot in my theme to insert it within a couple minutes. Very helpful, thank you again!

  7. Vince

    Hi…I installed the ‘insert headers and footers’ plug-in to my wp and copied my Google Analytics code to the footers box under settings, clicked save but GA is telling me the tracking is not installed. I did this 24 hrs ago. Did I do something wrong? Can you help?

    • WPBeginner Support

      can you see the analytics code in your site’s source code? You can view source by visiting your site, right clicking on any empty space and selecting view source from the menu. On the view source scroll down the document and see if you can find Google Analytics code there. Alternatively, you can try the second method described in the article.

      管理者

  8. Mary

    I liked this post because anything to do with google seems to be quite complicated

    But I tried the plugin you recommended but GA wasn’t tracking.

    SO I just put the code on the page and it still isn’t tracking.

    Any advice? Thanks Mary

  9. Mary

    Thank you for this post, but google analytics isn’t showing up on my site

    I pasted the code into the footer of the “header and footer plugin”.
    It was blank.
    I saved the changes.

    But where will I find the analytics page? There is nothing labled google analytics.
    Thanks Mary

    • Mehul

      Let me know if you need help. I will be happy to help you in installing the Google Aanalytics Code on your website.

    • Alo Knows

      You’ll find all the Analytics data on your GA Account. Not on wordpress.

  10. Latreasa

    Can I add it to WordPress.com blog if my domain is hosted by godaddy.com? I would like to do this without having to change my blog to WordPress.org

    Regards

  11. Alin

    If you install Google Analytics Dashboard for WP you will be able to display Google Analytics data and statistics, in a chart, inside your WordPress Blog.

  12. Eddy

    Very useful post. I have a problem I install the GA wordpress plugin and when I go to the Settings > Google Analytics don’t show me anything only the title “Google Analytics for WordPress Configuration” what’s wrong with this? please I need help

  13. Zoe

    Thank you for this tutorial.

  14. Lula

    Someone should really mention at some point that if you’re using wordpress.com (not wordpress.org) and you don’t have a separate software purchased for your sites hosting you CANNOT add google analytics there is no ability to add your own plugins. I think they think it’s better for wordpress to handle everything but I would have liked to have known this before starting.
    :X

    • Editorial Staff

      Sorry Lula, we have written numerous posts about the differences, but we simply cannot add on every article that this tip is only for WordPress.org users. All articles written on this site is intended for self-hosted WordPress users.

      管理者

  15. Ann

    Thanks for the helpful tutorial. I installed GA using your plugin about a week ago and the page views that GA is showing are significantly less than what Jetpack is telling me. Page views according to GA are roughly half of page views per Jetpack. Is this typical?

  16. Anna

    Hi
    Thanks for the great simple instructions for beginners like me.
    I have installed this plugin successfully and activated it but I am unable to add the Google Analytics code as there is no Settings option!
    Under the Plugin name I only get two options: Deactivate or Edit
    I am probably being stupid but where can I find the plugin Settings option?
    Many thanks for your help

    • Noumaan Yaqoob

      @Anna the plugin settings are located under Settings > Insert Headers and Footers.

  17. Fran

    Status: Tracking Not Installed
    Last checked: Jun 16, 2013 7:44:16 PM PDT
    The Google Analytics tracking code has not been detected on your website’s home page. For Analytics to function, you or your web administrator must add the code to each page of your website.

    I used the header/footer plug in, followed instructions, and received this code.
    What should I do now? I’m hosted WP btw.

    • Editorial Staff

      Depending on the theme you are using, it may not have the default wp_head(); or wp_footer(); functions in place. Also if you have a caching plugin installed such as WP Super Cache or W3 Total Cache, then you need to empty the cache.

      管理者

      • Jesse

        If the theme is not compatible with header / footer plug-in for analytics, is best to then copy the script manually into every page or is there a way to add the format required to the theme? Thanks!

        • WPBeginner Support

          No, you can still add the code in your theme’s footer.php file just before the /body tag.

  18. Kristina Larse

    Hi
    I added the tracking code to the header useing the plugin – i went in to my webshell and found the function.php file (in the them folder)- pastede

    // Placede my code here and removede the //

    But no matter where i try to paste it in the begingne, the end, efter the first break – the site just breaks down.

    Any idea whaat im doeing wrong?

    • Kristina Larsen

      //The code i pastede was like this

      // Placede my code here and removede the //

      //

  19. Waheed

    Thanks For This Great Tutorial :)
    I have One Question… i installed The Header and Footers Plugin, So Now I have To paste the Google analytic script In Header of the Plugin setting or Both Header and Footer?

    Thanks in advance?

  20. Chaotic Kristy

    Thanks this helped me out a lot

  21. Adam Moustafa

    I tried the plugin and the direct method but it still says tracking not installed.

    From the google analytics plugin on WP i do get information, though. Any help would be greatly appreciated.

  22. Mahmudul

    Thanks for this helpful post :D

  23. Matthew P. Schneider, LC

    What are the advantages of this over Site stats using JetPack. I have a self-hosted blog but use WordPress.com statistics that are available in the JetPack plugin.

    • Editorial Staff

      Google Analytics is far more advanced and give you much more data. However for some beginners it can get a little complicated. Jetpack Stats give simple data, but its easy to use.

      管理者

  24. Tiffany

    I can’t find my footer or available plugins. Is there a real step-by-step once you are in your wordpress blog ‘for dummies’? Help!

    • Editorial Staff

      If you can’t add plugins, then you are probably using WordPress.com. This will only work for self-hosted sites.

      管理者

  25. TJ Ellis

    Amazing blog post it worked nicely! Thanks again

  26. Lanaya Green

    That is what it is about getting useful information thanks for the details it makes it so simple to have something you can follow step by step… Thank you rock on brother

  27. leo wolf

    Thank you for the clear stepwise description. I had already an account with Google Analytics showing the results on the website. Now I copied the script code in the functions.php, so far so good. Where and when can I expect the GA output now? Is it displayed in the footer?

    BTW: I don’t use a standard theme, but one built from scratch so maybe I miss something?

    Thnx in advance, Leo

    • Editorial Staff

      The output is not visible unless you view the source code of the page. You should see it towards the bottom in the source code.

      管理者

      • leo wolf

        The title of this post suggests that you can have GA data at your site. But if is not visible, what’s the use then?

        • Editorial Staff

          Most tracking software will NOT make your data visible to the general public. Google analytics is a tracking software. You install it on your WordPress site, so you can get better insights about your audience. Google analytics works silently behind the scenes to capture data about your audience such as (what time they visited your site, who referred them, which pages they viewed etc).

  28. Louise Bibby

    Thanks so much for this info. It helped me overcome my paralysis with anything related to code. It was really useful!! Cheers Louise

  29. Alan

    Where do you get the code from step 6 if you do not get it the first time? I do not see it again when I log in.

    • Editorial Staff

      Login to Google Analytics. Look in the orange bar where it says Admin. Click on that. Under the accounts, click on the account that you want the code of. Under that account, you will see the property. Click on that property. There you will see a tab for Tracking info.

      管理者

  30. Webbis

    This helped me a lot! But how do I do to measure my subdomains in the same account?

  31. Carly

    I wanted to do the paste. I made it to the footer.php page but there is no tag on that page so I can’t paste before it. What am I missing? Plus, I closed the Google page before reading your instructions not to do so. (I did copy the code.) Do I need to start over with Google? Thanks.

    • Editorial Staff

      No you do not. Just use the plugin we are recommending in the article above, and it will take care of it.

      管理者

  32. Luis

    Thanks! The header and footer plugin helped me a lot!

  33. Naeem

    Thank you for this post.

    I am totally new in blogging and has recently set up a blog using wordpress platform.

    I have set up analytics account and paste the code using my theme’s option.

    Now my account is showing that tracking code installed.

    But the problem is in the audience section it is showing 0 visits while in the real time section it is showing 2 visitors.

    I am totally confused.

    ( My blog is under construction. Me and one of my friend is the only visitor. And I was unable to find single domain option. there are subdomain, mutiple top level domain options but no single domain option.)

    Can you please help me.

      • Michael Hickey

        I’m not at all sure what I am doing so perhaps you can help. Someone else that is not available now laid out my site. I was told to cut and paste the Google Analytics code one line below this last line of each page of my simple WP site. However, I cannot see where to do that for the Home Page. There is not a tab for the Home Page from the Dashboard. Any help is appreciated.

        • Editorial Staff

          Use our plugin that we mentioned, and it will add it on all pages of your site.

  34. Bob

    Does this plugin work retrospectively: that is to say, does it enter the the code into existing headers for pages that I’ve already developed on my WordPress site? I’ve put the script code in the header section and pressed save settings, but I’m not sure that that’s all I need to do.

    Any assistance would be gratefully received.

  35. Ameh

    Hi, great tutorial. Just one question. I have a desktop site and a mobile site. They both use different themes but have the same domain (www.dapopeyoh.com), so do i enter the google code in the footer.php file of one theme or both themes? Thanks.

  36. Saad

    Thank you so much for guiding me. I’ve completed and now waiting for 12-24 hours :)

  37. Omar

    I used the “Insert Header and Footer” plugin and pasted the google analytics code into the header in the settings of the plugin. I saved the settings and when I log into google analytics, the status is still “tracking is not installed.” Did I do something wrong and do I simply have to wait a while?

    • Editorial Staff

      If it is not working, then it means that your theme does not have wp_head(); in the header.php which is a standard for all WP themes.

      管理者

      • Ryan

        So how would we be able to include the wp_head(); to the site?
        I have the same issue (I think) – tried different ways but tracking still stating not installed.

        • Editorial Staff

          It is supposed to be included in your theme’s header.php file in the head markup.

  38. David

    We have just started a WP blog as a sub-directory to our main site. We used the main site analytics code in the WP blog but I am not seeing any information about the pages visited in the blog. Should we create a separate analytics account for the blog sub-directory? If so, will that show us information about where visitors move from the blog to the main site?

    • Editorial Staff

      Yes, there is an option in Google Analytics to get subdomain analytics code.

      管理者

  39. Monetsky

    Hi. Thanks for this tutorial. It simplified my life using the plugin to insert the code. I was wondering thoughif theres a way to get previous months data into google analytics? I only installed the code now and opened an account. Just wondering.. Thanks in advance. Great work!

    • Editorial Staff

      It cannot show you the data of things it didn’t track. The only way google can give you the data is if their script is on your page. Otherwise, they can’t.

      管理者

  40. Bob Furber

    I followed the instructions to pate in footer.php, and the Tracking status shows “Receiving Data”.

    However, when I go to the bottom of the Word Press Dashboard, to the Google Analytics Dashboard Widget, there is a note:

    “You need to log in and select an account in the options panel.”

    On clicking the options panel or Settings -> Google Analytics Dashboard, I get the following error:

    “Error gathering analytics data from Google: GDatainsufficientPermissionsUser does not have any Google Analytics account. Please try again later.”

    The problem is later does not arrive and I can find no way out.

    • Editorial Staff

      The issue you are describing is with a specific plugin that you are using “Google Analytics Dashboard Widget”. You should ask that question in their support forum.

      管理者

  41. Lisa - Une Belle Vie

    Hey, amazing that this is possible, but is google analytics replacing the normal wpstats ? Do you lose your views and information from that ?
    Thankyou!

    • Editorial Staff

      WP Stats is not a built-in WordPress plugin in self-hosted WordPress. Google Analytics is definitely a more robust platform.

      管理者

  42. Lynette Chiang

    When you open Settings>Insert Header and Footer, there are two fields. You don’t specify above whether the code is to go in one field or both.

      • Kate Dewfall

        Hi there,

        I added the code into the footer – is this incorrect or will it still work?

  43. marie

    My Google Analytical has stopped tracking and is showing all 0’s for the past week. Can you advise why?

    • Editorial Staff

      Is the code still added in your site? Did you change your theme? The only reason for it to be zero is if the code from your site got removed.

      管理者

      • Savita

        My Google Analytical has stopped tracking and is showing all 0′s for the past week. Can you advise why?
        I looked in the footer if the code is still there, but I don’t remember what the code was or looks like (did not make a note of it so it seems…). It does not look good. So what can I do now?

        Above the in the footer.php it says:

        Thank you.

  44. vida

    hello
    my wordpress site is a free one and i don’t see any option for plugins. The site is http://www.lavidavidzi.wordpress.com i’m wondering if this url has the ability to add plugins. I can’t even find the footer option you’re referring to …am i even able to get google analytics ?

  45. Lauren

    How do I add a plugin? WordPress doesn’t let me edit my coding. I downloaded one of the plugins but how do I get it on my site?

    • Editorial Staff

      Please refer to our Videos that will show you how to add plugins in WordPress.

      管理者

  46. figz91

    I tried to do this and lost everything, I think its because I put in the function.php coding in wrong but did it in the section where it said I was able to add in extra coding anyway.
     
    My site isn’t opening, neither my admin page to correct the problem it just says theres an http 500 error, I’m clueless and scared, is there anyway I can fix this problem? Please help.

    • wpbeginner

       @figz91 Yes, you would need to go through the FTP. Send us an email, and we can help you fix it.

      • Heidi

        The same thing just happened to me, please help me fix this asap!

        • Editorial Staff

          Heidi, you would have to use FTP to fix it. You are probably getting a syntax error because you pasted the code improperly.

  47. AdamCollins

    Aloha, so I signed up for analytics and placed the code in my theme options where there was a spot for my analytics built into the wp theme.  I also have a squeeze page on the blog. part of the domain and wondering do I upload the same code, or do I get another code?  Thanks so much.
     

    • wpbeginner

       @AdamCollins You can use the same code. Because that is on a separate page. You can see traffic by pages in Google Analytics.

  48. buckingham87

    Yeh hi… i tried to follow all this and now i have lost everything! i cant even login to my admin page!!
     
    HELP

    • wpbeginner

       @buckingham87 That probably happened because you pasted the code improperly in your functions.php file. https://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/

      • figz91

         @wpbeginner I’m having the same problem Buckingham is and I’m about to breakdown. Regardless of why it’s happening I need to get back my 4 years worth of content and I can’t even get to my admin page let alone the actual site.
         
        Is there anyway to fix this. I’m clueless and have no idea what to do. Please help.

  49. Tommy Stuart

    What exactly does the following mean? I have a website that I put together compliments of Wealthy Affiliate University. Does that mean it’s a self-hosted or is it a free word press site?

    “Note: This is only for Self-Hosted WordPress.org blogs. Free WordPress.com sites cannot use Google Analytics. Maybe it’s time to upgrade from free WordPress.com to Self-Hosted WordPress? Consider using our Free WordPress Blog Setup program.”

    WHICH?

    • wpbeginner

      Go in your WordPress admin panel and click on Appearence > Editor … If you can edit all of your theme files, then you are on self-hosted.

  50. pradeepnairjc

    Very useful post. How should I add tracking in case I am using WordPress as a Subdirectory? For example- http://www.domain.com/blog.

    Do I copy -paste the same tracking code in the footer file or do I need to generate a new tracker code for this? I installed the analytics plug-in and configured it but somehow it never recorded visits although the data was being received successfully.

返信を残す

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