Loading
Loading
  • Home

  • Productivity

  • App tutorials

App tutorials

2 min read

How to Add Google Analytics to WordPress

By Justin Pot · March 29, 2019
add-google-analytics-wordpress primary img

Google offers some of the best analytics software on the web. You can use it to monitor pageviews (traffic to your site), complete with demographic and location information. You can also view your current traffic in realtime, or really dig into reports about user behavior. But how do you add Google Analytics to a WordPress page? Here are a few options.

First, you'll need to register for a free Google Analytics account, so make sure to do that if you haven't already. Now we'll get you set up!

Is your WordPress site run on WordPress.com? You don't need to bother with plugins or modifying themes: support for Google Analytics is built in. Head to Settings > Traffic and you'll find a place to paste your embed code, no plugins or hacks needed. Read more at Wordpress.com.

How to Add Google Analytics to a WordPress Site With a Plugin

The simplest way to add the Google Analytics tracking code to your WordPress site so you can start learning about the people who browse your website. There are various options for the job but GA Google Analytics is clean and open source. To install it head to the Plugins section of your WordPress backend, then click Add New.

Add New

Search for GA Google Analytics and activate it. Next, you’re going to need to find your Google Analytics UA code. Head to Google Analytics, open the panel for the site you’re trying to add, then click Admin.

Admin button

Next click Property Settings.

Property Settings

You will find your Tracking Id right at the top of this panel. Make sure to include the entire ID, including the UA- at the beginning and -1 at the end.

UA ID

Now head back to your WordPress site and head to Plugins, then the settings for your plugin. Here’s how that looks for GA Analytics:

Edit Plugin in Wordpress

In GA Google Analytics you’ll need to open the Plugin Settings section.

Plugin Settings

Next, paste your GA Tracking ID in the appropriate box.

Tracking ID box

Click Save and you’re done!

Adding Google Analytics to a WordPress Site By Editing Your Theme

Don’t want to install a plugin just for Google Analytics? You can add the code manually to your theme. This is only recommended for advanced WordPress users. There’s a clear downside here: any updates to your theme will break the Analytics embed, so if you do this you’ll need to either avoid updating the theme or be willing to re-edit it. Still, if you want to avoid a plugin, this is the go-to method.

To get started you’ll need to find your Google Analytics tracking code. Open Google Analytics for the site you want to add, then click Admin in the bottom-left corner.

Google Analytics Admin button

Click Tracking info...

Tracking info Google Analytics

...then click Tracking Code.

Tracking Code Google Analytics

Copy the code in the Global Site Tag box.

Global Site Tag box Google Analytics

Now head to your WordPress site and click Appearance > Theme Editor.

Theme Editor WordPress

You will be warned about editing your theme. Click I understand to continue.

Theme editing WordPress dialogue box

Now you can paste in the Analytics code you copied above. Make sure you put it above the </header>.

Analytics code WordPress

Click Update File and you're done.

You've now added Google Analytics to your website, so you can start learning about the people who browse it.

Want to get more out of Google Analytics? Zapier offers Google Analytics integrations, which connects Analytics with 1,000+ apps.

Get productivity tips delivered straight to your inbox

We’ll email you 1-3 times per week—and never share your information.

tags

Related articles

Improve your productivity automatically. Use Zapier to get your apps working together.

Sign up
A Zap with the trigger 'When I get a new lead from Facebook,' and the action 'Notify my team in Slack'