Matomo数据模型系列文章之(四)归档数据

归档数据是在归档过程中通过聚合日志数据产生的。

Matomo(之前叫Piwik)聚合并持久化两类归档数据:

  • Metrics:简单的数值指标
  • Reports:二维数组类型

报表通常包含数值指标,也包含其他数据(附加的或者替换数值指标)。 报表和数值指标由插件进行定义。插件可以扩展matomo分析出的数据。Matomo内核预定义了一些核心指标(Core metric)。

欢迎加入Matomo中文网。请加入官方QQ群255820112(点击滚动至本页末可扫描二维码),随时提问,有问必答。

数据子集参数

报表和数值指标提供了数据的分析结果。这个分析结果由下面几个参数进行范围限制:

  • 站点ID
  • 周期(Period)
  • 分段(Segments)

站点ID限制了数据只属于特定站点。在HTTP请求中用idSite参数进行表示。

周期限制了数据只处于特定时间段。在HTTP请求中用date和period来表示(一个表示日期,一个表示按天还是按周按月按年)。

分段(segment)是以访客属性构成的布尔表达式,它类似于SQL语句中的where条件。在HTTP请求中用segment参数进行表示。通过它可以限定得到任何子集的访问数据。

分析参数是以metadata的方式存储在报表里。也就是存储在DataTable对象的metadata中。

数值指标

核心指标

核心数值指标是由Piwik内核定义的,而不是由插件定义的。

新的报表如果要分析访客、行为类型或转化的话,应当包含这些指标。

访客指标

名称 指标ID 描述
访问(visits) nb_visits 访问数
同一访客在间隔不超过30分钟的一系列访问事件就构成一次访问。
独立访客(Unique visitors) nb_uniq_visitors 独立访问源的数量 访问源代表一个被追踪访问的对象。
行为数(Actions) nb_actions 被追踪行为数
一个行为就是一次被Matomo追踪的事件。
最大行为数(Max Actions) max_actions 一次访问中发生的最大行为数。
总访问时长(Sum Visit Length) sum_visit_length 每次访问的时间总和
弹出数(Bounce Count) bounce_count 只发生一次行为的访问数
转化访问数(Converted Visits) nb_visits_converted 至少发生一次转化的访问数
转化数(Conversions) nb_conversions 特定访问集中发生的转化数
收入(Revenue) revenue 访问所产生的收入。包括每个目标所代表的收入加上电子商务收入。

行为指标

名称 指标ID 描述
点击量(Hits) nb_hits 某个行为发生的次数
总耗时(Sum Time Spent) sum_time_spent 用户发生在某个行为上的总时间。
页面生成总时长(Sum Page Generation Time) sum_time_generation 服务器生成特定页面耗费的总时长。
Hits With Generation Time nb_hits_with_time_generation The number of hits that included generation time information.
页面最小生成时间(Min Page Generation Time) min_time_generation The minimum amount of time a server spent serving this action.
页面最大生成时间(Max Page Generation Time) max_time_generation The maximum amount of time a server spent serving this action.
独立跳出访客数(Unique Exit Visitors) exit_nb_uniq_visitors 某行为之后跳出网站的独立访客数
跳出访问数(Exit Visits) exit_nb_visits 以某个行为跳出网站访问的访问数。
独立入口访客数(Unique Entry Visitors) entry_nb_uniq_visitors 以某个行为为入口的独立访客数
入口访问数Entry Visits entry_nb_visits 以某个行为为入口的访问数
入口行为数Entry Actions entry_nb_actions
入口访问总时长Entry Sum Visit Length entry_sum_visit_length The sum of each entry visit’s elapsed time.
入口弹出数(Entry Bounce Count) entry_bounce_count 只包含特定行为的访问数
搜索点击数Hits From Search nb_hits_following_search 在站内搜索后某行为发生的次数

电子商务指标

用来记录一系列电子商务转化(要么所有订单,要么被放弃的购物车)

名称 指标 ID 描述
Revenue Subtotal revenue_subtotal The total cost of every item that was a part of these orders or abandoned carts.
Revenue Tax revenue_tax The total tax amount applied to these orders/abandoned carts.
Revenue Shipping revenue_shipping The total amount of shipping applied to these orders/abandoned carts.
Revenue Discount revenue_discount The total amount of discounts applied to these orders/abandoned carts.
Ecommerce Item Count items The total number of items in these orders/abandoned carts.

目标指标

Name Metric ID Description
Goal Conversions goal_<idGoal>_nb_conversions The conversions tracked for a specific goal and this set of visits.
Goal Revenue goal_<idGoal>_revenue The total revenue generated by the conversions for a specific goal.

备注: <idGoal> 需要被替换成系统创建目标对应的ID

目标相关的指标在数据库中是存储在报表序列化数据的goals列中。此列包含的内容是从目标ID到目标指标值数组的数组。

需要运算的指标

考虑到归档效率和数据库大小的问题,有些指标没有被存储到数据库中,而是在需要的时候通过其他指标计算得到。这些指标被称为运算指标。 下面的列表就是利用内核指标计算得到的运算指标。新的报表在分析访问、行为类型或者转化的时候应当会用到它们。

备注:一些运算指标在下表中多次出现。因为这些运算指标在不同的报表中有不同的含义。

针对访问的运算指标

Name Metric ID Description
Conversion Rate conversion_rate The percent of visits that had at least one conversion.
Actions Per Visit nb_actions_per_visit The average number of actions for a single visit.
Average Time On Site avg_time_on_site The average number of time spent per visit in seconds.
Bounce Rate bounce_rate The percent of visits that resulted in a bounce.

针对单个行为的运算指标

Name Metric ID Description
Average Generation Time avg_time_generation The average amount of time it took for a server to serve this action.
Average Number of Search Result Pages Viewed nb_pages_per_search The average number of search result pages viewed after a site search. 
Only valid for site search keywords and site search categories.
Average Time On Page avg_time_on_page The average amount of time users spent doing this action.
Entry Bounce Rate bounce_rate The percent of all visits that consisted of this action and no other.
Exit Rate exit_rate The percent of all visits that ended with this action.

针对系列访问中电子商务订单的运算指标

Name Metric ID Description
Average Order Revenue avg_order_revenue The average revenue of each order.

针对订单或放弃的购车中商品的运算指标

Name Metric ID Description
Average Price avg_price The average price of each item.
Average Quantity avg_quantity The average number of each item in an order/abandoned cart.
Product Conversion Rate conversion_rate The percent of orders/abandoned carts that include this item.

针对特定站点某目标的运算指标

Name Metric ID Description
Average Revenue per Visit goal_<idGoal>_revenue_per_visit The average amount of revenue generated per visit for this goal.

命名规则

由插件计算并持久化的指标必须命名为以下格式:PluginName_metricName.中间有个下划线,内核指标除外。

报表

在内存中,报表存储在DataTable对象中。一个DataTable对象是一个由行和列构成的二维数组。

行数据包含访问、行为、转化对应的指标。数据对应的范围在label列中定义和描述。列如何描述数据集完全依赖于所处的报表。比如说 UserSettings.getBrowser报告,标有Firefox的行数据反映了使用Firefox浏览器的访问数。

一些报表如VisitsSummary.get 没有包含label列: they have only one row that refers to the entire set of entities.

报表元数据

除了指标外,每行数据都包含元数据(metadata)。这些元数据和label列一同描述行所代表的数据含义。

一些元数据有特殊的含义,比如:

  • logo:它的值可以是图片的数据,它会被展示在行中作为小图标
  • url:表示行需要链接的内容

子表

报表可以是有层次的:每行数据可附加到另一个DataTable中。附加到行的表被称为子表。

子表可以提供对行数据的更进一步的分析。比如说,Referrers.getSearchEngines报告每行表示一个搜索引擎。每行还包含有一个子表,其中包含对应的搜索词。数据形如:

Matomo report子表

命名规则

像指标一样,报表的命名方式必须是:PluginName_reportName,别忘了下划线。

发表评论

邮箱地址不会被公开。 必填项已用*标注