WP Engine

Solutions
AgencyEnterpriseSmall & Medium BusinessMarketer
How WP Engine supports marketers.Benefits for marketers.Features that help you innovate.
Developer
How WP Engine supports developers.Benefits for developers.Features that help you move faster.
Explore Our Platform
Insights
Thought LeadershipTopics

Read articles, trends, and insights on these topics from leaders in marketing and technology.

Creative AgilityEnterprise PerformanceActionable IntelligenceEcosystem Integration
Resources

Access ebooks, whitepapers, webinars, and other knowledge from our ecosystem of digital experts.
Visit Resource Center.

Delivering a Slam Dunk Experience on WordPressEbook: The Ultimate Guide to WordPress Plugins15 Common WordPress Mistakes Agencies and their Clients Make
Case Studies
About
Our CompanyOur PlatformLatest News

Access the latest news from inside WP Engine.
Visit the Newsroom.

WP Engine Secures Strategic Growth Investment From Silver LakeWP Engine Unveils First WordPress Digital ExperienceWP Engine Expands Global Presence with New Office in Brisbane
Media Center

Get announcements and resources about WP Engine.

Press Releases
Careers at WP Engine
Pricing
Sales Questions?

Contact Sales

Discover why organizations of all types and sizes choose WP Engine — and how it can benefit you.

Chat

1

I'm available right now to answer any of your questions!

Reply

Call

+1-512-201-4819

Contact

Send a message

Compare Plans
Need Support?
Support DocumentationBilling HelpSupport

We offer support 24 hours a day, 7 days a week, 365 days a year. Log in to get expert one-on-one help.

Log in for support

Sales Questions

Contact Sales

Discover why organizations of all types and sizes choose WP Engine — and how it can benefit you.

Chat

1

I'm available right now to answer any of your questions!

Reply

Call

+1-512-201-4819

Contact

Send a message

Sign in
Sign in
Search

Search

Compare Plans
Call Sales +1-512-201-4819
Menu
AgencyEnterpriseSmall & Medium BusinessMarketers
How WP Engine supports marketers.Benefits for marketersFeatures that help you innovate.
Developers
How WP Engine supports developers.Benefits for developers.Features that help you move faster.
Our PlatformPricingResource CenterOur CompanySolution CenterThought LeadershipDocumentationCareers

Resource
Center

‹ Back to Resource Center

Google Analytics & Tag Manager for WordPress

Google analytics and Tag Manager

To drive targeted traffic to your website, and to keep the traffic you currently have, it’s important that your site caters to your audience’s needs. However, understanding exactly what your audience needs can be difficult without the right information.

Fortunately, Google Analytics is a tool that enables you to collect user data and use it to your (and your audience’s advantage). By implementing what you learn on your website, you can then improve user engagement and boost traffic.

In this post, we’ll introduce you to Google Analytics for WordPress. This will include a look at how to install it on your website with and without plugins. You’ll also learn how Google Analytics and Tag Manager work effortlessly together, and how to install both on your site.

Google Analytics for WordPress

Google Analytics is a web analytics service that launched in 2005. When connected to your website, it can collect user data including demographics and behavior, so you can better understand (and cater to) your audience.

Fortunately, Google Analytics and WordPress work seamlessly together. This means you can collect all the data you need, then optimize your WordPress site based on the results.

How to Add Google Analytics to WordPress

Within WordPress, there are two main ways to add Google Analytics to your WordPress website. One is with the use of plugins, and the other is without. Let’s take a closer look at both options.

How to Add Google Analytics with WordPress Plugins

One of the easiest ways to add Google Analytics to WordPress is with plugins. This is a great option for those who only need a ‘basic’ installation, or who aren’t technologically savvy.

Google Analytics WordPress Plugins

The first plugin – and one of the most popular – is Google Analytics for WordPress by MonsterInsights. While this plugin has a potentially lengthy setup process, there’s no need to edit your website’s code. As such, it’s a great option for beginners:

Google analytics for WordPress plugin

Another popular plugin choice is Google Analytics Dashboard for WP (GADWP). This plugin makes it simple to install Google Analytics on each page of your website (with the plugin’s tracking component), and will also help you to read the collected data:

Google Analytics Dashboard for WordPress plugin

While there may be the easier options, they aren’t always the best. Let’s look at another way to add Google Analytics to your website.

How to Add Google Analytics without WordPress Plugins

The other way to add Google Analytics to your website is through adding Google Analytics’ tracking code manually. The simplest way is to add it via the dashboard’s Appearance > Editor screen. This requires some HTML knowledge, but it’s not difficult.

Where to Put Google Analytics Tracking Code in WordPress

Simply put, the tracking code can be placed just about anywhere on your website, including the head, body, and footer. However, there are some pros and cons to each option.

If you place your tracking code at the very top of the HTML <head> section, the code will be executed almost immediately as the user lands on the page. This is where Google recommends placing the code:

add google analytics to wordpress without plugins

Alternatively, placing the code at the end of your HTML will mean it’s executed after all other code on the page. If a user leaves your website (or page) before the code has been executed, no data will be collected:

steps to add google analytics to wordpress

As you might imagine, placing the tracking code in the <body> section will mean the code could be executed at any point during the page load. You won’t collect the data of users who bounce quickly from the page, but you’ll collect more than if it was at the end of the HTML:

how to add google analytics to wordpress

There is no right or wrong place for the code, so the decision is yours. Consider exactly what you’d like to track, then place the tracking code accordingly.

Google Tag Manager for WordPress

In simplest terms, Google Tag Manager is a system that manages JavaScript and HTML codes used for tracking and analytics. When used with WordPress, you can very easily add Google Analytics (and other Google products) to your website.

Perhaps best of all, Google Tag Manager is a scalable solution for all websites, especially enterprise-level sites. This means it’ll continue to work for you, even as your site grows.

How to Install Google Tag Manager for WordPress

Installing Google Tag Manager in WordPress is a simple three-step process. To begin, head over to the Tag Manager home page and sign up (or sign in with your current Google Analytics account):

install google tag manager for wordpress

Here, you’ll be asked to name your account (we recommend using your company name) and your Container. In this case, your website’s URL:

how to add google tag manager to wordpress

Once you’ve setup your account, you’ll be given two separate codes:

install google tag manager onto wordpress

Copy the first code, and head to your WordPress dashboard. Go to Appearance > Editor, and you’ll see a list of different files on the right side – select header.php. Find the <head> element within the file, and paste the first part of the Tag Manager code directly below it:

google tag manager for wordpress

Go back to Tag Manager, and copy the second (i.e. bottom) code. Once again return to your website, and paste this code right after the opening <body> element:

steps to install google tag manager for wordpress

Click Update File and you should see a confirmation appear. That’s it – you’ve successfully added Tag Manager to your WordPress site!

How to Install Google Analytics Through Google Tag Manager

Once Google Tag Manager is successfully installed, it’s time to install Google Analytics. When completed, Google Analytics will ‘funnel’ through Google Tag Manager on your website.

In fact, once it’s set up, you don’t even have to add analytics code to your site. To begin, go back to your Tag Manager account and click New Tag:

Install google analytics through tag manager

You’ll now have two separate boxes: Tag Configuration and Triggering. Click Tag type in the Tag Configuration box and select Universal Analytics:

how to install google analytics on wordpress with tag manager

You’ll also need to configure the Google Analytics Settings. You can do this independently, or set an override option. Both of these require your Analytics Tracking ID. Once that’s configured, move onto Triggering. For Page View, you’ll want to select All Pages:

Use tag manager to install google analytics on wordpress

This very last step is crucial, because otherwise the tag will not be published. On the Tag Manager account page, click SUBMIT in the top right corner. Add a Version Name and Description, and then be sure your new GA tag is showing under Workspace Changes. Once you’ve verified, click PUBLISH:

add google analytics to wordpress with tag manager

With your Google Analytics tag now configured and published, Google Tag Manager will implement the tag on your website. In no time at all, your Google Analytics account will begin to collect user data, which you can then use to optimize your website for your audience.

To optimize your website even further, consider WP Engine’s managed hosting plans. With quality hosting, you can be sure your website is always running as smoothly as possible. Get started today!

‹ Back to Resource Center

Did you know WP Engine offers best-in-class
Managed WordPress hosting?

See our plans

Share

Share:

Related Content

Analytics

  • On-Demand Webinar: 2017 Webby Talk - This Automated Life
  • On-Demand Webinar: Optimizing Websites for Great User Experiences and Increased Conversions
  • Google Analytics & Tag Manager for WordPress
Sign In

Solutions

  • Agency
  • Enterprise
  • SMB
  • Marketer
  • Developer

Insights

  • Blog
  • Torque
  • Velocitize

About

  • Our Company
  • Leadership Team
  • Our Platform
  • Careers
  • Affiliates
  • Contact
  • Legal
  • Newsroom
  • Privacy Policy

Resources

  • Resource Center
  • Documentation
  • Solution Center
  • Find an Agency

WP Engine

504 Lavaca Street, Suite 1000
Austin, TX 78701

Sales

+1-512-201-4819
[email protected]
7am–7pm CST

Billing

[email protected]

  • Facebook
  • Twitter
  • LinkedIn
  • YouTube
  • Instagram
  • RSS
© 2013—2025 WPEngine, Inc. All rights reserved.
WP ENGINE®, VELOCITIZE®, TORQUE®, EVERCACHE®, and the cog logo service marks are owned by WPEngine, Inc.