Add Google Analytics to WordPress

1. Install and activate a plugin for inserting codes into the header and footer of WordPress pages.

In the WordPress dashboard, go to Appearance > Themes and click on the active theme. Navigate to the support website to find out if the theme settings include a module for inserting header scripts – also commonly called tracking codes. If the theme has an appropriate module, skip to the next step. If your theme doesn’t include GA tracking, install a plugin like Insert Headers and Footers, Header and Footer Scripts, Head, Footer and post injections, or Head and Footer Scripts Inserter. If you are using a plugin other than Insert Headers and Footers, make sure that the code appears on all pages.

2. Create or sign in to your Google Analytics (GA) account.

If you have several Google accounts tied to different email addresses, ensure that you’re signed in to the correct account.

3. Copy the Global Site Tag tracking code from Admin > Property column > Tracking info > Tracking code.

If you use Google Tag Manager, you can add the tracking ID to your tag manager account without modifying WordPress further.

4. Navigate to the settings for your WordPress theme or plugin and paste the tracking code into the code section.

If you see existing code in this section, be careful not to modify it. Paste your code immediately after the tag and before any existing content.

5. Save your plugin or theme settings.

6. Navigate back to Admin > Property column > Tracking info > Tracking code in Google Analytics and click on Send test traffic.

Google Analytics will display a pop up window to confirm that you have successfully added the GA tracking code to your website, or to tell you that something went wrong.