by Pankaj Singh

潘卡·辛格(Pankaj Singh)

如何在Google Analytics(分析)中轻松设置自定义事件跟踪 (How to easily set up custom events tracking in Google Analytics)

自定义事件跟踪的需求不断增长 (The Growing need for Custom Event Tracking)

I am a technologist-turned-analytics professional since five-plus years. Recently, a friend asked me how he can set up a custom event tracking on his small business website and understand his site’s user behavior better.

我有五年以上的工作经验,是一名技术专家,后来成为分析专家。 最近,一个朋友问我如何在自己的小型企业网站上设置自定义事件跟踪,并更好地了解其网站的用户行为。

Until a few years back small businesses and personal bloggers were satisfied knowing their number of unique visitors and page views on their website. But everyone now wants to understand much more than mere page views. They want to know how many users clicked on different buttons, watched a video, checked details of a product, or clicked on third-party advertisements among other things. There’s an increasing demand to understand how different users are engaging on their digital assets.

直到几年前,小型企业和个人博客作者对了解他们的唯一身份访问者数量和网站访问量感到满意。 但是,现在每个人都想了解的不仅仅是页面浏览量。 他们想知道有多少用户单击了不同的按钮,观看了视频,检查了产品的详细信息或单击了第三方广告。 人们越来越需要了解不同的用户如何使用他们的数字资产。

There are many objectives you can use your website for, and there are as many activities to monitor on a website. While big businesses have dedicated teams, small companies usually have a single person managing both the analysis and the technical setup of their analytics account.

您可以使用网站来实现许多目标,并且可以监视网站上的活动。 大公司拥有专门的团队,而小公司通常只有一个人来管理其分析帐户的分析和技术设置。

"Thankfully setting up basic goals and even the advance custom goals in google analytics isn’t difficult, as long as you know the right steps. And in this article we are going to go through exactly that. I’ll walk you through the steps of setting up custom goals in the simplest way while you enjoy your coffee!" - Google's documentation

“只要您知道正确的步骤,就可以很高兴地在Google Analytics(分析)中设置基本目标甚至是高级自定义目标。在本文中,我们将严格按照这一步骤进行操作。我将逐步指导您完成这些步骤您可以一边享用咖啡,一边以最简单的方式设置自定义目标!” -Google的文档

总览 (Overview)

First, for the sake of revision, let’s go over the four main types of custom goals available in your Google Analytics account. If you are already familiar with them and want to understand only the last one (the “Event” goal type), then scroll down to point 4: “Setting up an Event goal”. A glance at the screenshot below will explain to you the four main goals that you can customize in Google Analytics.

首先,为了进行修订,让我们来看一下Google Analytics(分析)帐户中可用的四种主要自定义目标类型。 如果您已经熟悉它们并且只想了解最后一个(“事件”目标类型),则向下滚动至第4点:“设置事件目标”。 一览以下屏幕快照,即可向您说明可以在Google Analytics(分析)中自定义的四个主要目标。

You’ll notice that the first 3 goals are very intuitive and directly usable. Once set, they will give you an x% conversion in the past 7 days. But the last one will return a 0% conversion. Let’s first review the three simpler goals and then we’ll be able to understand the event goal in detail.

您会注意到前三个目标非常直观并且可以直接使用。 设置后,他们将在过去7天内为您带来x%的转化。 但是最后一个将返回0%的转化。 首先,我们回顾三个简单的目标,然后我们将能够详细了解事件目标。

1.设定目标 (1. Setting a Destination Goal)

All you need for this is to give the URL of the page which you identify as a success on a page visit. For example in e-commerce websites, when a person makes a purchase and reaches a “thank-you” page, it’s a success. So visiting the thank-you page can be a goal.

您所需要做的就是提供页面的URL,您将其标识为一次成功的页面访问。 例如,在电子商务网站中,当某人进行购买并到达“谢谢”页面时,即表示成功。 因此,访问“谢谢”页面可能是一个目标。

All you need to do is enter the URL of that page as a destination, www.yourexamplesite.com/thanks.html. It’s possible that your website may have different query parameters, so you can use options like “URL Begins with”, “URL Ends with” or “Regex”.

您需要做的就是输入该页面的URL作为目的地,即www.yourexamplesite.com/thanks.html 。 您的网站可能具有不同的查询参数,因此您可以使用“ URL开头为”,“ URL结尾为”或“ Regex”之类的选项。

2.设定工期目标 (2. Setting a Duration Goal)

This refers to the number of minutes (or hours) spent on your website by a user. This goal’s use can vary based on the purpose of a website. Spending more time on your site may be desirable, but it doesn’t mean a sure shot conversion. It can also mean that your website is not easy enough to help users accomplish their tasks quickly.

这是指用户在您的网站上花费的分钟数(或小时数)。 根据网站的目的,此目标的用途可能会有所不同。 在您的网站上花费更多的时间可能是可取的,但这并不意味着可以可靠地进行镜头转换。 这也可能意味着您的网站不够简单,无法帮助用户快速完成任务。

However, for content-oriented websites such as that of newspapers, bloggers, magazines or video content, a duration goal can be important. So based on your site’s purpose, it might be a good idea to set different time duration goals.

但是,对于诸如报纸,博客,杂志或视频内容之类的面向内容的网站,持续时间目标可能很重要。 因此,根据您网站的目的,最好设置不同的持续时间目标。

As you can see below, you can enter a time duration for this goal and you’ll be set to track all users who cross that mark.

如下所示,您可以输入该目标的持续时间,并设置为跟踪所有超过该目标的用户。

3.每个会话的页面/屏幕数 (3. Pages/screens per session)

This is the number of pages viewed in a single session or visit. If a visitor closes the website and then returns the next day, or after a gap of 30 minutes on the same day, it’s called a new session.

这是在单个会话或访问中查看的页面数。 如果访问者关闭该网站,然后在第二天或隔天30分钟后返回,则称为新会话。

4.设置自定义事件目标类型 (4. Setting a Custom Event Goal Type)

An ‘event’ is any action taken by a user that marks an interaction with your website after landing on any of its pages. The simplest example is when they click on a button like “Buy Now”, or “Learn More”. It can also be used for options like downloading a PDF or E-book, among other actions.

“事件”是用户在登录到您的网站的任何页面后对其进行标记的任何操作。 最简单的示例是当他们单击“立即购买”或“了解更多”之类的按钮时。 它还可用于诸如下载PDF或电子书之类的选项,以及其他操作。

Clicking on a button is typically referred to as a CTA, short for “Call to Action”. When you choose this option in your custom goals setting, you’ll see this window open up with four options:

单击按钮通常称为CTA,简称“号召性用语”。 在自定义目标设置中选择此选项时,您会看到此窗口打开,其中包含四个选项:

All four fields or parameters are simple to enter. GA needs you to define each event with these four fields so that you can easily identify them during analysis.

所有四个字段或参数都易于输入。 Google Analytics(分析)需要您使用这四个字段定义每个事件,以便您可以在分析过程中轻松识别它们。

"You can write anything in these parameters, but it’s recommended that you define them in a way that makes the most business sense for you." - Google's documentation

您可以在这些参数中编写任何内容,但建议您以对您最有意义的方式定义它们。 ”-Google的文档

For example, if you are managing a store selling electronic gadgets and accessories, you may want to fill it like this :

例如,如果您正在管理一家销售电子产品和配件的商店,则可能需要这样填写:

A. Category: Category of the product. Example, ‘Headphones’

A.类别:产品的类别。 例如,“耳机”

B. Action: Let’s say a user clicked the ‘Add To Cart’ button. Then you could write ‘AddToCartClick’ in your action. In case you have an additional button for ‘Features’ or ‘Learn More’ for that product, you can have an additional goal and define its action as ‘LearnMoreClick’ for that button.

B.行动:假设用户点击了“添加到购物车”按钮。 然后,您可以在操作中编写“ AddToCartClick”。 如果您有用于该产品的“功能”或“了解更多”的附加按钮,则可以有一个附加目标,并将该按钮的操作定义为“ LearnMoreClick”。

C. Label: Label can be anything which helps you recognize or group your events better during your analysis. It can be the name of a ‘Campaign’ or a ‘Brand’. For example, ‘CollegeCampaignSonic’.

C.标签 :标签可以是有助于您在分析过程中更好地识别或分组事件的任何内容。 它可以是“广告系列”或“品牌”的名称。 例如,“ CollegeCampaignSonic”。

D. Value: This is an optional value, mostly used to set a revenue number. It can be used to set a specific number like $50, or to take a dynamic value from the revenue variable of your page, like $(“PriceVariable”). Note that $ here is a jquery identifier and not the currency dollar. Picking up an ID would depend on the price or cost variable defined in your HTML.

D.值:这是一个可选值,主要用于设置收入数字。 它可以用于设置特定的数字(例如$ 50),或从页面的收入变量中获取动态值,例如$(“ PriceVariable”)。 请注意,这里的$是一个jquery标识符,而不是货币美元。 提取ID取决于HTML中定义的价格或成本变量。

"After you define your Event goal type values here, the tricky part starts. Since every other goal in GA is directly usable once defined, it’s confusing to many why the event goal doesn’t start to work right away. That’s why when you click on ‘Verify the conversion’ for this goal, you see a 0% conversion." - Google's documentation

“在此处定义事件目标类型的值后,棘手的部分开始了。由于GA中的所有其他目标一经定义就可以直接使用,所以很多人会混淆为什么事件目标不会立即开始起作用。这就是为什么单击在针对此目标的“验证转化”上,您看到0%的转化。” -Google的文档

To correct this 0% conversion, you need to integrate the settings of this goal with the actual click event or the custom action responsible on your website, for this goal.

要更正这一0%的转化,您需要将此目标的设置与实际的点击事件或您网站上负责该目标的自定义操作进行集成。

将自定义事件跟踪与网站HTML集成 (Integrating custom event tracking with the HTML of your website)

Sometimes, business users (especially non-technical ones) tend to feel anxious when anything related to coding comes up while doing their analysis. Thankfully Google has made it very simple to tie any custom event tracking need that needs to be integrated with your website. Only if you’re managing a complex e-commerce website would you need help from a developer, which in most cases you would have access to if you are working in a mid-size company.

有时,当进行分析时,与编码有关的任何事情出现时,业务用户(尤其是非技术用户)往往会感到焦虑。 值得庆幸的是,Google使绑定需要与您的网站集成的任何自定义事件跟踪需求变得非常简单。 仅当您管理复杂的电子商务网站时,您才需要开发人员的帮助,在大多数情况下,如果您在中型公司中工作,则可以访问。

For integration, Google has already set up a standard template function that it expects you to use when tracking a custom event on your page. It’s one line of code, for which you have already set values in your GA account. Marketers or coders typically refer it to as the GA-Send call which is in the below format:

为了进行集成,Google已经设置了标准模板功能,希望您在跟踪页面上的自定义事件时使用该功能。 这是一行代码,您已经在GA帐户中为其设置了值。 营销人员或编码人员通常将其称为GA-Send调用,格式如下:

ga(‘send’, ‘event’, [eventCategory], [eventAction], [eventLabel], [eventValue]);

The actual JS function in your HTML page may be in single line or may look like this for easy readability:

HTML页面中的实际JS函数可能在一行中,或者可能看起来像这样以便于阅读:

ga('send', {hitType: 'event',eventCategory: ‘Headphones',eventAction: ‘AddToCartClick',eventLabel: ‘CollegeCampaignSony'
});

Note that the values in this function must match the values entered in your GA account while setting up the event for its respective parameters. Now you still need to tie the above GA send call with the actual action on the button.

请注意,在为相应参数设置事件时,此函数中的值必须与您在GA帐户中输入的值匹配。 现在,您仍然需要将上述GA发送呼叫与按钮上的实际操作联系起来

For example, you want to tie the above function with the click on the ‘Add To Cart’ button. The only step you would need to add is to include this function on the ‘onClick’ action event for that button ID.

例如,您想通过单击“添加到购物车”按钮来绑定上述功能。 您需要添加的唯一步骤是将该功能包括在该按钮ID的“ onClick”操作事件中。

Integrating the above cited Google Analytics Event script inside your HTML
<script>
$(document).ready(function(){$("#exampleAddNowButtonID").click(function(){ga ('send', 'event', 'Headphones' , 'AddToCartClick' , 'CollegeCampaignSonic');});
});
</script>

结语 (Wrapping up)

This brings me to the end of this article. I have tried to explain with simplicity and details that I felt lacking when I was learning how to set up custom tracking for my own requirements. Hopefully, this step by step guide helps you in setting up tracking for your custom goals that best fit your needs.

这使我到本文的结尾。 我试图简单,详细地解释我在学习如何针对自己的需求设置自定义跟踪时所缺少的细节。 希望此逐步指南可帮助您设置最适合您需求的自定义目标的跟踪。

Feel free to share your thoughts or ask any clarifying questions related to this post in the comments.

随时在评论中分享您的想法或提出任何与此职位相关的澄清问题。

In case you want to take any free online courses on Google Analytics, you can visit here.

如果你想利用在谷歌Analytics(分析)的任何免费在线课程,您可以访问这里 。

Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.

此页面的某些部分是根据 Google 创建和 共享的 作品所做的修改 并根据 知识共享3.0署名许可 中所述的 条款使用

翻译自: https://www.freecodecamp.org/news/how-to-easily-set-up-custom-events-tracking-in-google-analytics-d1818e2ecdd0/

如何在Google Analytics(分析)中轻松设置自定义事件跟踪相关推荐

  1. 谷歌浏览器在新页面打开_如何在Google文档中更改页面方向

    谷歌浏览器在新页面打开 Most of the time, using a portrait orientation for document pages makes sense. Occasiona ...

  2. 在中国使用谷歌语音识别_如何在Google文档中使用语音输入

    在中国使用谷歌语音识别 Google Docs lets you use voice typing to dictate using your computer's microphone. It's ...

  3. 如何在 Google Chrome 浏览器中使用 Java?

    如何在 Google Chrome 浏览器中使用 Java? 本文适用于: 浏览器: Chrome Java 版本: 7.0, 8.0 Chrome 对 NPAPI 的支持 用于 Web 浏览器的 J ...

  4. 谷歌浏览器在怎么添加迅雷_如何在Google搜索结果中添加作者信息

    谷歌浏览器在怎么添加迅雷 How to enable the author information in Google search results as shown for many posts? ...

  5. 谷歌云端硬盘快速下载方法_如何在Google云端硬盘中禁用“快速访问”快捷方式...

    谷歌云端硬盘快速下载方法 Recently, Google introduced a new feature in Google Drive that makes it easier to quick ...

  6. 如何在Google Chrome浏览器中更改主页

    Google Chrome opens with a "New Tab" page by default, but it's easy to open the browser wi ...

  7. 如何在Google文档中的图片周围换行

    If you want to insert an image or object into a document, it's relatively simple. However, positioni ...

  8. 如何在Google文档中创建连字符,连字符和Em连字符

    Standard keyboards don't have dedicated keys for special punctuation marks, such as an en or em dash ...

  9. 谷歌play更新_如何在Google Play音乐中管理播客

    谷歌play更新 Hey, did you know that the Google Play Music app that comes with your Android phone can sub ...

最新文章

  1. [Oracle] - 性能优化工具(5) - AWRSQL
  2. [JVM]线上CPU负载持续飙高的问题解决
  3. WPF中的动画——(五)路径动画
  4. GitHub 远程仓库 de 第一次配置
  5. Disruptor并发框架-2
  6. android dialog加载中动画效果
  7. python一元三次方程拟合_一元三次方程的求根公式
  8. js中call和apply的作用和用法
  9. 如何调整金格电子章服务器印章_重磅!公安部再度认可电子签名、电子印章法律效力!...
  10. 查看函数库.a函数符号信息
  11. linux 窗口管理器_您最喜欢的Linux窗口管理器是什么?
  12. 敏捷开发一千零一问系列之三:序言及解决问题的心法(共振)
  13. tcl计算机语言,简述TCL语言的应用
  14. 计算机无法识别1136打印机,惠普HP M1136打印机驱动安装失败的多种解决办法
  15. UDP实时图像传输进阶篇——1080P视频传输
  16. pvp服务器有什么项目,N服PVP服率先回归!压测后未来3-4周正式开服
  17. python运维小工具_Python实现跨平台运维小神器
  18. 对办公文档加密 到了外部计算机就无法打开,使用文件夹加密超级大师加密了文件,更换电脑后加密文件打不开了怎么办?...
  19. chinese-ocr-lite(pytorch) 转 caffe
  20. 崔羚:乳品行业后道包装及物流解决方案

热门文章

  1. strstr函数头文件_strstr函数
  2. 集成电路的类型与封装形式
  3. LibVLCSharp在WPF中无法响应鼠标事件
  4. FileNotFoundError: [Errno 2] No such file or directory:
  5. 线程资源PHP源码分析之线程安全模型
  6. Mysql时间字段增加一段时间或减少一段时间
  7. ARC110E Shorten ABC
  8. zabbix告警短信推送
  9. grouping_idgrouping sets
  10. javascript 原型属性(prototype 属性)与 实例属性(自身属性)