无论您拥有哪种类型的网站,了解访问者如何与您的网站互动都是必不可少的。谷歌分析 (GA)(Google Analytics (GA))历来是网站管理员用来深入了解网站流量的工具。GA 为用户提供以下方面的统计数据和报告:
- 您网站的访问者数量
- 他们来自哪个国家
- 他们每个会话访问了多少页面
- 您网站上最受欢迎的页面
- 有多少网站访问者反弹(没有执行任何操作就离开了)
使用 GA 跟踪页面浏览量、会话持续时间和跳出率等基本指标需要在每个网页上放置GA 跟踪代码(GA Tracking Code)或GA JavaScript代码段。这是跟踪一般信息的理想选择。
但是,对于更具体的指标或多个交互,跟踪每个操作变得更具挑战性。例如,对于想要跟踪几种不同形式和各种功能的网站所有者来说,设置和运行所有必要的标签需要花费大量时间。
Google Tag Manager ( GTM ) 是一款免费的标签管理工具,可以让您更轻松地跟踪所有标签。
什么是谷歌标签管理器?(What Is Google Tag Manager?)
GTM不是替换 GA,而是与 GA(它本身就是一个标签)一起帮助用户添加跟踪代码(标签)、定义规则和部署代码片段。
GTM收集的数据被发送并存储在 GA 和其他工具中,例如Google Ads、PayPal和Facebook。
网站所有者可能想要跟踪的标签示例如下:
- 谷歌广告
- 活动
- Facebook 像素代码
- 再营销
- 自定义 HTML/JavaScript 代码
网站所有者应该决定哪些行为将提供他们需要做出更好的战略营销决策的洞察力。然后使用Google Tag Manager收集数据并分析结果。
在本文中,我们将概述如何开始为您的网站使用GTM。
设置您的网站(Set Up Your Website)
- 如果您还没有Google 跟踪代码管理器(Google Tag Manager)帐户,请设置一个(set one up)。
- 添加您的帐户名称、国家/地区、容器设置(您的域)和您的目标平台(选择 Web)。然后单击创建(Create)。
- 在您同意 Google 的服务条款后,您将看到带有两个代码段的容器 ID。
- 您需要将这两个片段添加到您网站的每个页面以完成设置过程。确保将它们添加到正确的位置。一个属于您页面的<head> 。另一个在开始<body>标记之后。
- 如果您在安装代码段时需要更多帮助,请阅读 Google 的快速入门指南( Quick Start Guide)。或者,如果您使用的是WordPress,您可以使用几个插件( several plugins)。
- 创建容器后,您可以开始添加标签和触发器,以深入了解您网站的访问者。
以下(Below)是帮助您衡量营销工作的网站操作示例。
跟踪按钮点击(Tracking Button Clicks)
按钮(Button)点击是指您的网站号召性用语 ( CTA ) 被点击的次数。许多网站有多个CTA(CTAs),例如:
- 下载。
- 添加到购物车。
- 点击通话。
- 订阅。
- 注册。
- 开始吧。
- 获取您的免费报告。
- 学到更多。
- 加入。
设置一些变量(Set Up Some Variables)
- 单击变量(Variables),然后从左侧导航中 配置。(Configure)
- 向下滚动并单击Element、Classes、ID、Target、URL和Text。
- 下一步是启用将在所有点击时触发的触发器。单击(Click)左侧导航中的触发器,然后单击(Triggers)新建。(NEW.)
- 然后给你的触发器一个名字。我们称之为Button Click。
- 要选择触发类型,请在触发窗口内单击,向下滚动到弹出页面的底部,然后单击所有元素(All Elements)。
- 确保设置This triggers(This trigger fires) on All Clicks并单击Save。
- 要确保标记正常工作,请单击预览(Preview)按钮。将出现一个橙色条,以便您知道您处于预览模式。
- 在新的浏览器选项卡中打开您的网站并刷新页面。您将在快速预览模式下看到摘要项目。因为在此示例中,我们将触发器设置为在任何人点击您网站上的任何位置时触发,它将注册为GTM点击。
- 如果您想识别页面上的特定按钮,请在Google 跟踪代码管理器(Google Tag Manager)预览面板中选择一次点击。然后单击变量(Variables)。
您将看到单击类、单击元素和单击文本。所有不同的点击和点击类别都被标注。找到变量后,找出要为要跟踪的按钮过滤掉的内容。
单击(Click)该网站按钮,它将突出显示您网站下方GTM预览中的摘要部分。
查看与您选择的按钮相关的变量,例如Click classes、Click Element和Click ID。使用此信息来设置您的按钮点击。返回到您的Google 跟踪代码管理器(Google Tag Manager)。导航(Navigate)到按钮单击(Button Click)。
出于本文的目的,让我们为Grab your free report(Grab your free report)设置一个按钮,因此将该按钮重命名为Grab your free report CTA。
- 导航到This triggers on(This trigger fires on)并选择Some Clicks。
在这里,您可以按在预览模式下找到的变量进行过滤。
返回您的网站预览并写下您要跟踪的按钮的变量。根据您单击的位置,按钮的不同部分可能具有不同的类。(Different)
最好的解决方案是将您的跟踪切换到链接点击(Link Click),因为无论您点击哪里,类都是相同的。链接点击是保持不变的超链接。
- 要在GTM中更改它,请选择Click – All Elements并将其更改为Just Links。
- 使用您在预览模式下记下的课程,并将其添加到Click Classes(Click Classes )右侧的空白框中,然后单击Save。
创建标签(Create a Tag)
- 点击左侧导航中的标签,然后点击(Tags)新建(New)。
- 在标签配置(Tag Configuration)框内单击以打开标签类型。向下滚动(Scroll)并选择自定义 HTML(Custom HTML)。
- 您可以通过在这些括号 { } 中键入变量来使用此自定义 HTML部分中的变量。(Custom HTML)
- 当您开始输入括号时,您将看到一个快速搜索选择菜单,您可以在其中选择定义的现有变量。
- 现在您需要将其连接到您刚刚创建的触发器。在触发(Triggering)框内单击,选择触发器并单击(Click)保存(Save)。
- 再次刷新您的预览页面以测试您的按钮。单击(Click)您的按钮以查看标记是否已触发。如果它不起作用,请返回并检查所有设置。
- 如果它们正确,您将看到在此事件上触发的标签(Tags Fired on This Event)。您现在正在跟踪单击按钮的时间。
使标签成为事件(Make The Tag An Event)
- 返回GTM并选择您刚刚创建的标签。确保使用可识别的名称为其命名。
- 将标签类型从自定义 HTML(Custom HTML)更改为 Google Analytics:Google Analytics:Universal Analytics。
- 为Track Type选择Event,为Event Tracking Parameters选择(Event Tracking Parameters)CTA Button,为Action选择 Click并为(Click)Label添加一个识别名称。
- 向下滚动(Scroll)到Google Analytics Settings,选择{{Google Analytics}}并点击Save。现在,您正在将Google Analytics中的点击作为一个事件进行跟踪。
- 提交您的活动,然后发布(Publish)。
- 在Container Version Description部分中,为您的事件添加一个描述性名称,然后单击Continue。
- 您的新触发器和新标签现在在您的网站上运行,以跟踪网站访问者点击按钮的任何时间。
您可以使用Google(Google Tag Manager)跟踪代码管理器跟踪的操作数量没有限制。您收集和衡量的数据越多,您就能够更好地调整营销和广告活动以增加转化率和销售额。
How To Use Google Tag Manager To Analyze Your Website Traffic
No matter what type of website you have, knowing how your visitors interact with your site is essential. Google Analytics (GA) has traditionally been the tool used by webmasters to gain insights into website traffic. GA gives users statistics and reports about:
- The number of visitors to your site
- What country they are from
- How many pages they visited per session
- The most popular pages on your site
- How many site visitors bounced (left without performing any action)
Tracking essential metrics such as page views, session durations, and bounce rate with GA require the placement of GA Tracking Code or a GA JavaScript code snippet on every webpage. This is ideal for keeping track of general information.
However, for more specific metrics or multiple interactions, it becomes more challenging to keep track of every action. For example, it would take a lot of time for a website owner who wants to track several different forms and various features to get all the necessary tags set up and running.
Google Tag Manager (GTM) is a free tag management tool that makes tracking all your tags easier.
What Is Google Tag Manager?
Rather than replacing GA, GTM works with GA (which is a tag itself) to help users add tracking code (tags), define rules and deploy code snippets.
The data collected by GTM is sent to and stored in GA and other tools such as Google Ads, PayPal, and Facebook.
Examples of tags website owners might want to track are:
- Google Ads
- Events
- Facebook pixel code
- Remarketing
- Custom HTML/JavaScript code
Website owners should decide which behaviors will provide insights they need to make better strategic marketing decisions. Then use Google Tag Manager to collect data and analyze the results.
In this article, we will outline how to get started using GTM for your website.
Set Up Your Website
- If you don’t already have a Google Tag Manager account, set one up.
- Add your account name, country, container setup (your domain), and your target platform (choose web). Then click Create.
- After you agree to Google’s terms of service, you will see your container ID with two code snippets.
- You need to add both the snippets to each page of your site to complete the setup process. Make sure you add them in the correct place. One belongs in the <head> of your page. The other goes after the opening <body> tag.
- If you need additional help installing the snippets, read Google’s Quick Start Guide. Or, if you are using WordPress, there are several plugins you can use.
- Once you create your container, you can start adding tags and triggers to gain insights into your site’s visitors.
Below is an example of a website action to help you measure your marketing efforts.
Tracking Button Clicks
Button clicks refer to how many times your website call-to-action (CTA) is clicked. Many sites have multiple CTAs, such as:
- Download.
- Add to cart.
- Click to call.
- Subscribe.
- Sign up.
- Get started.
- Grab your free report.
- Learn more.
- Join.
Set Up Some Variables
- Click on Variables and then Configure from the navigation on the left.
- Scroll down and click Element, Classes, ID, Target, URL and Text.
- The next step is to enable a trigger that will fire on all clicks. Click on Triggers from the navigation on the left and hit NEW.
- Then give your trigger a name. Let’s call it Button Click.
- To select a trigger type, click inside the trigger window, scroll down to the bottom of the pop-up page, and click on All Elements.
- Make sure you set This trigger fires on All Clicks and click Save.
- To make sure the tag is working correctly, click the Preview button. An orange bar will appear so that you will know you are in preview mode.
- Open your website in a new browser tab and refresh the page. You will see summary items in the quick preview mode. Because in this example we set the trigger to fire whenever anyone clicks anywhere on your site, it will register as a GTM click.
- If you want to identify a specific button on a page, select one of the clicks in the Google Tag Manager preview panel. Then click Variables.
You will see click classes, click elements, and click texts. All the different clicks and click classes are notated. Once you have located the variables, figure out what to filter out for the button you want to track.
Click on that website button, and it will highlight the summary section on the GTM preview below your website.
Look at the variables that are related to your selected button such as Click classes, Click Element, and Click ID. Use this information to set up your button click. Go back to your Google Tag Manager. Navigate to Button Click.
For the purpose of this article, let’s set up a button for Grab your free report, so rename the button to Grab your free report CTA.
- Navigate to This trigger fires on and choose Some Clicks.
Here is where you will be able to filter by the variables you found when in preview mode.
Go back to your website preview and write down the variables for the button you want to track. Different parts of a button might have different classes depending upon where you click.
The best solution for this is to switch your tracking to Link Click because the classes are the same no matter where you click. A link click is a hyperlink that remains constant.
- To change that inside of GTM, select Click – All Elements and change it to Just Links.
- Use the class you wrote down from the preview mode and add it in the blank box to the right of Click Classes and click Save.
Create a Tag
- Click on Tags from the left-side navigation and hit New.
- Click inside the Tag Configuration box to open the tag types. Scroll down and select Custom HTML.
- You can use variables inside this Custom HTML section by typing them inside these brackets { }.
- When you start typing the brackets, you will see a quick search select menu where you can choose your defined existing variables.
- Now you need to hook this up to the trigger you just created. Click inside the Triggering box, select the trigger and click Save.
- Refresh your preview page again to test your button. Click on your button to see if the tag is fired. If it doesn’t work, go back and check all your settings.
- When they are correct, you will see Tags Fired on This Event. You are now tracking when your button is clicked.
Make The Tag An Event
- Go back to GTM and select the tag you just created. Make sure to name it with an identifiable name.
- Change the Tag type from Custom HTML to Google Analytics: Google Analytics: Universal Analytics.
- Select Event for Track Type, CTA Button for Event Tracking Parameters, Click for Action and add an identifying name for Label.
- Scroll down to Google Analytics Settings, select {{Google Analytics}} and click Save. Now you are tracking your clicks inside of Google Analytics as an event.
- Submit your event and then Publish it.
- In the Container Version Description section add a descriptive name for your event and click Continue.
- Your new trigger and new tag are now live on your website to track any time a site visitor clicks on the button.
There is no limit to the number of actions you can track using Google Tag Manager. The more data you collect and measure, the better you will be able to tweak your marketing and ad campaigns to increase conversions and sales.