Have you ever wondered what people actually do when they enter yourWordPress website?

Have you thought about which website pages they tend to stay on longest, what campaigns bring them there, and which of your website pages convert the best?

谷歌分析can help you understand all of this information and more. By simply installing a Google Analytics plugin on your WordPress website, you can start collecting this data immediately. With help from a plugin, adding Google Analytics to WordPress is a painless process.

如果您不想为此目的安装插件,只要您对代码舒适,还有其​​他方法可以将Google Analytics(分析)与您的网站集成。

在this guide, we’ll walk you through how to install Google Analytics in WordPress with two different methods. In a handful of steps, you can uncover insights about your website visitors — including what is and isn’t working for them — to improve the user experience, increase conversions, and learn about your audience.

Measure your performance with HubSpot's free WordPress plugin

谷歌分析for WordPress: What Can You Track?

Whether you’re looking for details about who is visiting your site, what they’re doing while on your site, or how long they’re staying on specific pages, Google Analytics provides you with the report you need. The tool allows you to track many interactions between your website and visitors.

Let’s review some more of the specific types of reporting Google Analytics provides:

Real-time Activity

Realtime reports show you current activity on your website, including where visitors enter your website and the actions they take on your site. You can also see how users are getting to your site, what pages they’re visiting, and whether they’re converting. This report is useful for monitoring the immediate results of a campaign, social media post, or real-world event.

Acquisition

收购报告将帮助您了解访问者的来源。在设置营销活动时,此信息很有帮助,因为它可以向您显示最适合您所获得的访问者的东西。它还告诉您哪些用户是新的,哪些是返回的。

Engagement

Engagement reports help you understand how users are interacting with your website. It includes page views, scrolling activity, time-on-page, interactions with media, and other important events. Google Analytics groups user activity by sessions — a session can be understood as a single visit to your website.

该报告还跟踪转换率。您可以将它们与您的目标进行比较,并了解哪些CTA正在工作。您将了解更多有关网站上哪些CTA和登陆页面的成功,以及使访问者最参与的原因。

货币化

货币化reports track your revenue from purchases, subscriptions, and advertisements on your site. It also shows you how users move through the checkout process and how they engage with your product pages.

Retention

Retention reports monitor how well your website retains visitors — in other words, how often users return to your website after their first visit, and for how long. You can also view retention by cohort. A cohort is a group of users that share a characteristic, like the date of their first session.

Demographics

The demographics report will help you understand who your visitors are. It reports users by age, language, location, gender, and topics of interest.

Tech

技术报告向您展示了访问者用于访问您的网站的技术,包括设备类别(台式机,手机或平板电脑)和访问应用程序(Web浏览器或移动应用程序)。此信息可以根据用户喜欢哪些技术来帮助您的优化工作。

特定于插件的分析

除了过多的信息哟u receive from Google Analytics, your chosen plugin will also provide you with unique insights. For example, let’s review whatExactMetrics提供。这些见解和功能中的一些标准配备了WordPress中的其他分析插件图书馆也是。

在-Depth Performance Reports。These reports provide you with in-depth performance details, such as bounce rates, referrals, page views, organic searches, and more, for each post and page on your website so you can segment your analytical data in a way that makes sense for your website and business.

Real-Time Stats。您可以在打开插件时可以查看实时统计信息。其中一些统计数据包括您网站上的当前访问者数量,您的收购渠道以及当前流量的来源。

自定义尺寸跟踪。您可以创建自定义尺寸以获取对您和您的业务重要的特定数据。例如,您可以创建有关某些事件和用户参与类型的自定义维度跟踪,这对您很重要。

根据用户角色设置权限。如果您有一个大型团队,或者在分析方面具有不同资格和需求的团队,则可以根据用户角色设置权限。这样,您才能确保只有合适的人才能进行更改。

如何为WordPress设置Google Analytics(分析)

To add Google Analytics to your WordPress site, you can either go with a plugin or opt for a manual approach. We’ll review both methods, starting with the plugin.

But, whichever method you choose, make sure you have an active Google Analytics account. To sign up for Google Analytics, firstcreate a Google account。如果您已经有了Google帐户,那么您将获得一个很好的开始,因为这是您使用Google Analytics(分析)的唯一方法。

Sign in to your Google account, then head to the谷歌分析sign-up page然后单击开始测量

WordPress Google Analytics(Analyticsis):签名页面以获取Google Analytics(分析)

On theAccount Setuppage, fill in the necessary information. YourAccount Namewill be the Google Analytics profile name for your website. You can choose whatever name you like, but we recommend using your business name.

下一个, check your preferred boxes underAccount Data Sharing Settingsto control how Google may share your data, then click下一个

Under属性设置,为您的第一个Google Analytics(分析)属性提供名称。您可以暂时将其简化您的网站名称。点击下一个

Finally, under关于your business, you can provide additional information about your company. This section is optional. To complete setup, clickCreate

You’ll now be taken to your analytics dashboard. On this screen, underChoose a platform, 点击网络(since you’re tracking a website).

wordpress google analytics: data stream setup

You’ll be asked to set up a data stream, which is a source of data from a website or an app. Fill in the required fields and click创建流。这提供了你所愿th a measurement ID, a string of characters you’ll use to send your website tracking data to Google Analytics. If you go with a plugin, you may need to add this information to the plugin, so it’s a good idea to keep this tab open.

WordPress Google Analytics(分析):Google Analytics(分析)的测量ID

现在,您的Google Analytics(分析)帐户已经准备好,让我们学习如何使用插件将其链接到WordPress网站。

使用WordPress插件设置Google Analytics(分析)

Depending on the Google Analytics plugin you choose, setup may differ slightly. For the sake of this example, we’re going to review how to set up theExactMetrics插入。无论您最终选择网站的哪个插件选项,该过程看起来都相当相似。

First, you’ll need to install and activate ExactMetrics on your site. (Not sure how?请参阅我们安装WordPress插件的指南。) Once that’s done, select the newExactMetricsoption from your WordPress dashboard, then clickLaunch Setup Wizard

wordpress google analytics: exactmetrics setup prompt

点击through the setup screens until you’re prompted to sign in to Google and grant the plugin your desired permissions. Then, on theConnect Google Analytics to Your Website屏幕,选择您之前创建的视图,然后单击Complete Connection

After clicking through some additional screens, you’ll be ready to use Google Analytics with WordPress. View your analytics under确切对象>报告

wordpress google analytics: exactmetrics reporting page

Some plugins may require you to insert the tracking code yourself if they don’t come with the same level of automation. You can find this tracking information by going to your Google Analytics admin tab (the cog icon in the bottom left corner of the dashboard), then choosingData Streams根据所需的帐户和财产。

wordpress google analytics: data streams option in the google analytics dashboard

然后,单击您的数据流。你会看到你的测量ID在右上角。在下面标记指令,您还会看到您的Global Site Tag,一个代码块,将分析添加到您的网站中section of your HTML.

将此脚本添加到您的HTML的最简单方法是在sert Headers and Footersplugin — this lets you add tracking code without directly modifying your files, which could break your site.

Set Up Google Analytics Without a WordPress Plugin

Those who would rather not use a plugin and are comfortable editing WordPress theme files directly can choose this next method instead. Before continuing,备份your WordPress sitein case something goes wrong in the process.

Since this method also requires you to change theme files, we also recommend making your edits to achild themeso that you can update the parent theme without losing your modifications.

要获取跟踪代码,请转到Google Analytics Admin选项卡(仪表板左下角的COG图标),然后选择Data Streams根据所需的帐户和财产。Select the data stream you want, then scroll down to标记指令。打开Global Site Tagaccordion and copy the code.

wordpress google analytics: tracking code for google analytics

下一个, you’ll paste this code into your active theme’sheader.php文件。无论您喜欢》中编辑此文件 - 您可以下载文件并将其重新上传到您的服务器,或通过WordPress编辑文件。外观>主题编辑器

header.php, paste your tracking code just above the closing标签(如下图)并保存更改。

WordPress Google Analytics(分析):跟踪粘贴到WordPress header.php文件中的代码

This code will send tracking information from your website to Google Analytics.

Use Google Analytics to understand your WordPress site.

谷歌分析provides you with insights and data that can help you drastically improve the state of your website. You can learn more about what your visitors enjoy and discover more about who they are, so you can continue to tailor your content to their needs.

With WordPress, installing Google Analytics on your website is quick and easy. In just minutes, you can start collecting the information that you need to enhance user experience and increase conversions on your WordPress website.

Editor's note: This post was originally published in November 2018and has been updated for comprehensiveness.

Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

Originally published Oct 15, 2021 7:00:00 AM, updated October 15 2021

Topics:

WordPress Website