Add Google Analytics to WordPress

Categories SEO, WordPress
Add Google Analytics to WordPress

Add Google Analytics to WordPress

Find out how to add Google Analytics to WordPress. Google Analytics is a rich website analytics tool by Google. The tool provides you with detailed information about the traffic on your website. Plus, Google Analytics is free.

In the article I show you this:

How Do I Get the Analytics Tracking Code?

Get the Google Analytics tracking code this way:

  1. Open your web browser.
  2. Go to the Google Analytics website.
  3. Click Create account.

The Google Sign up page is opened.

  1. Enter your Email address in the field Email of phone.
  2. Click NEXT.
  3. Enter your password the field Enter your password.
  4. Click NEXT.

The Google Security verification page is opened.

  1. Click Done.

The Google Analytics start page is opened.

  1. Click Sign up.

The Google Analytics registration page is opened.

  1. Enter the name for your account in the field Account Name.
  2. Enter the URL of your website in the field Website URL.
  3. Select your time zone in the field Reporting Time Zone.
  4. Note:

    I recommend you unchecking every option.

    Select the options in the section Data Sharing Settings.

  1. Click Get Tracking ID.

The Google Analytics Terms of Service Agreement is opened.

  1. Note:

    Read the agreement carefully. When you click I Accept, then you accept the Google Analytics Terms of Service Agreement.

    Click I Accept.

The Google Analytics Dashboard is opened.

Note:

Find your Google Analytics tracking code in the section Global Site Tag (gtag.js).

<!– Global site tag (gtag.js) – Google Analytics –>

Your Google Analytics tracking code is generated.

How Do I Upload the Analytics Tracking Code to My Site?

Prerequisites:

  • Generate your Google Analytics tracking code.
  • Download a FTPclient.
  • Get the login data to your FTP account:
    • name of the FTP server
    • username
    • password

Once you have created your Google Analytics tracking code, upload the code to your web server. Upload the Analytics tracking code to your web server this way:

Note:

If you do not use a child theme, then the Analytics tracking code will get deleted with the next update of your theme. You will have to upload the tracking code again. Use a child theme to prevent this issue. Read my article How to create a Child Theme in WordPress to learn how to create a child theme.

  1. Open your FTP-client.
  2. Connect to your account.
  3. Open the root-directory of your website.
  4. Open the directory wp-content.
  5. Open the directory themes.
  6. Open theme directory of your current theme.
  7. Open the file header.php.
  8. Paste the Google Analytics tracking code between the tags <head>.
  9. Save the header.php.
  10. Close your FTP-client.

Your Google Analytics code is uploaded to your website.

Definition:

Connect to your webserver with FileZilla

FileZilla is a FTP client. Connect to your webserver with FileZilla this way:

Prerequisites:

  • Download FileZilla.
  • Install FileZilla.
  • Get the login data for your FTP account:
    • name of the FTP server
    • user name
    • password

 

filezilla
Filezilla
  1. Run the FileZilla Desktop App.
  2. Enter the name of your web server in the field Host.
  3. Enter your username in the field Username.
  4. Enter your password in the filed Password.
  5. Click Quickconnect.

You are connected to your web server.

Add Google Analytics to WordPress
5 (100%) 1 vote

Leave a Reply

Your email address will not be published. Required fields are marked *