mip-stats-baidu Baidu Statistics


mip-stats-baidu is used to support webmasters to add Baidu statistics.

QQ截图20170204132040.png

Example

MIP provides Baidu Statistics plug-in to facilitate analysis of page data. You need to create a site in Baidu Statistics in advance, and js code will be automatically generated for use. The extraction tool extracts the token and uses the plug-in provided by MIP.

Basic usage

<mip-stats-baidu token="02890d4a309827eb62bc3335b2b28f7f"></mip-stats-baidu>

Custom parameter usage

Reference:Baidu statistics custom parameter api

<mip-stats-baidu token="02890d4a309827eb62bc3335b2b28f7f" setconfig="%5B_setAutoPageview%2C%20false%5D"></mip-stats-baidu>

Add event tracking

Reference:Baidu statistics event tracking api.

Need to add the data-stats-baidu-obj attribute to the tracked dom.

<div data-stats-baidu-obj="%7B%22type%22:%22click%22,%22data%22:%22%5B_trackPageview,%20/virtual/login%5D%22%7D">
    我是事件追踪dom
</div>

Attribute

token

Description: token
Required: Yes
Format: String

setconfig

Description: Used to perform statistical operations on the entire page. The setconfig value must be processed by encodeURIComponent. For example, [_setAutoPageview, true] needs to be converted into %5B_setAutoPageview%2C%20false%5D string and passed
Value: _setAutoPageview, _setCustomVar, etc.
Required: No
Format: string

data-stats-baidu-obj

Note: The dom node that needs to add event tracking needs to have the data-stats-baidu-obj attribute, and the attribute value is after encoding json object. Such as {"type":"click","data":"[_trackPageview, /virtual/login]"}, encodeURIComponent and then converted to %7B%22type% 22:%22click%22,%22data%22:%22%5B_trackPageview,%20/virtual/login%5D%22%7D
Required: Yes
Format: String

  • type

    说明:对应的触发事件(load加载触发/click点击触发)   
    必填:是   
    格式:字符串
  • data

    说明:用于事件追踪数据传递参考
    必填:是   
    格式:字符串数组