How do I add Google Analytics to a WordPress website?
This article will show you how to set up Google Analytics on WordPress.
If you’re looking for a quicker and easier way of viewing your website’s metrics, you can add Google Analytics to WordPress, allowing you to manage your site and measure its performance from one handy place.
Simply choose one of the following methods below to find out how to include Google Analytics in WordPress:
Without a plugin
Please note: this process is recommended for advanced users as it involves accessing and changing your website’s coding.
From there, select Admin in the left-hand menu.
On the next page, select Tracking Info within the Property menu and then click Tracking Code.
Alternatively, if you’re using Google Analytics 4, select Data Streams within the Property menu and then choose your desired option from the provided list.
You will now be shown your unique ID, along with a series of tag code. Copy or make a note of both these items.
From there, hover your cursor over Appearance in the left-hand menu and then select Theme file editor from the provided options.
On the next page, select header.php within the Theme Files section.
You will now be shown a page full of code. Simply paste the tracking code that you copied earlier into this page.
If you’re not sure where to place your Google Analytics code, we recommend inserting it into Line 38.
Once you’ve done this, click Update File to save your changes.
With a plugin
You will now be taken to the main portal for MonsterInsights. From here, click Launch the Wizard to begin setting up the plugin.
Follow the on-screen instructions and you will eventually be prompted with a message asking you to connect WordPress to Google Analytics. Click Connect MonsterInsights to continue.
You’ll now need to log in to your Google account. Simply enter your details and click Next.
After you’ve done this, select your profile from the provided drop-down menu and then click Complete Connection.
Your plugin will now begin authenticating. Once this has been completed, you’ll need to select which features you wish to enable for your site and click Continue.
Alternatively, you can click Skip for Now if you’d rather decide this later.
On the next page, you’ll now see a confirmation message, stating that MonsterInsights has connected to your Google Analytics account.
You can now view your Google Analytics for your WordPress site by selecting Insights in the left-hand menu.