1+ /**
2+ * [pageView description] 页面事件
3+ * @param {[type] } pageName [description] 页面标识,支持类型:String;最大长度255字符
4+ * @param {[type] } pageInfo [description] 页面信息,支持类型:Object/Array;页面信息最多包含100条;Object类型内key以字母或$开头,包括大小写字母、数字、下划线和$,最大长度125字符,不支持乱码和中文;Object/Array中的value,支持类型:String;则最大长度255字符
5+ */
6+ function pageView ( pageName , pageInfo ) {
7+ AnalysysAgent . pageView ( pageName , pageInfo )
8+ }
9+ /**
10+ * [track description] 点击事件
11+ * @param {[type] } eventName [description] 事件名称。支持类型:String。以字母或$开头,可以包含大小写字母/数字/下划线,不支持中文,不支持乱码,最大长度99字符。
12+ * @param {[type] } eventInfo [description] 事件属性,支持类型:Object/Array;事件属性最多包含100条;Object类型内key以字母或$开头,包括大小写字母、数字、下划线和$,最大长度125字符,不支持乱码和中文;Object/Array中的value,支持类型:String;则最大长度255字符
13+ */
14+ function track ( eventName , eventInfo ) {
15+ AnalysysAgent . track ( eventName , eventInfo ) ;
16+ }
17+ /**
18+ * [registerSuperProperty description] 注册通用属性
19+ * @param {[type] } uperPropertyName [description] 属性名称 支持类型:String。以字母或$开头,可以包含大小写字母/数字/下划线,不支持中文,不支持乱码,最大长度99字符。
20+ * @param {[type] } superPropertyValue [description] 事件属性,支持类型:String;则最大长度255字符
21+ */
22+ function registerSuperProperty ( superPropertyName , superPropertyValue ) {
23+ AnalysysAgent . registerSuperProperty ( superPropertyName , superPropertyValue ) ;
24+ }
25+
26+ /**
27+ * [registerSuperProperties description] 注册通用属性
28+ * @param {[type] } superProperties [description] 属性集合 支持类型:Object。key以字母或$开头,可以包含大小写字母/数字/下划线,不支持中文,不支持乱码,最大长度99字符,value支持类型:String;则最大长度255字符。
29+ */
30+ function registerSuperProperties ( superProperties ) {
31+ AnalysysAgent . registerSuperProperties ( superProperties ) ;
32+ }
33+ /**
34+ * [unregisterSuperProperty description] 删除单个通用属性
35+ * @param {[type] } superPropertyName [description] 属性名称 支持类型:String。以字母或$开头,可以包含大小写字母/数字/下划线,不支持中文,不支持乱码,最大长度99字符。
36+ */
37+ function unRegisterSuperProperty ( superPropertyName ) {
38+ AnalysysAgent . unRegisterSuperProperty ( superPropertyName ) ;
39+ }
40+ /**
41+ * [clearSuperProperties description] 清除所有通用属性
42+ */
43+ function clearSuperProperties ( ) {
44+ AnalysysAgent . clearSuperProperties ( ) ;
45+ }
46+ /**
47+ * [clearSuperProperties description] 获取单个通用属性
48+ */
49+ function getSuperProperty ( superPropertyName ) {
50+ AnalysysAgent . getSuperProperty ( superPropertyName ) ;
51+ }
52+ /**
53+ * [clearSuperProperties description] 获取所有通用属性
54+ */
55+ function getSuperProperties ( ) {
56+ AnalysysAgent . getSuperProperties ( ) ;
57+ }
58+ /**
59+ * [identify description] 用户ID设置
60+ * @param {[type] } distinctId [description] 唯一身份标识,支持类型:String;长度大于0且小于255字符
61+ */
62+ function identify ( distinctId ) {
63+ AnalysysAgent . identify ( distinctId ) ;
64+ }
65+ /**
66+ * [alias description]用户关联 新distinctID关联到原有originalID,originalID为原始id.
67+ * @param {[type] } aliasId [description] 支持类型:String;长度大于0,且小于255字符
68+ * @param {[type] } originalId [description] 可以是现在使用也可以是历史使用的id,不局限于本地正使用的distinctId,若为空则使用本地的distinctId,支持类型:String;长度大于0且小于255字符
69+ */
70+ function alias ( aliasId , originalId ) {
71+ AnalysysAgent . alias ( aliasId , originalId ) ;
72+ }
73+ /**
74+ * [profileSet description] 设置用户属性
75+ * @param {[type] } propertyName [description] 支持类型:String;以字母或`$`开头,可包含大小写字母/数字/`_`/`$`,最大长度125字符,不支持乱码和中文
76+ * @param {[type] } propertyValue [description]支持类型:String/Number/Boolean/Object/Array;若为字符串,则最大长度255字符;若为数组或集合,则最多包含100条,且key约束条件与属性名称一致,value最大长度255字符
77+ */
78+ function profileSet ( propertyName , propertyValue ) {
79+ AnalysysAgent . profileSet ( propertyName , propertyValue ) ;
80+ }
81+ /**
82+ * [profileSetOnce description] 在首次设置时有效的属性
83+ * @param {[type] } propertyName [description] 支持类型:String;以字母或`$`开头,可包含大小写字母/数字/`_`/`$`,最大长度125字符,不支持乱码和中文
84+ * @param {[type] } propertyValue [description] 支持类型:String/Number/Boolean/Object/Array;若为字符串,则最大长度255字符;若为数组或集合,则最多包含100条,且key约束条件与属性名称一致,value最大长度255字符
85+ */
86+ function profileSetOnce ( propertyName , propertyValue ) {
87+ AnalysysAgent . profileSetOnce ( propertyName , propertyValue ) ;
88+ }
89+ /**
90+ * [profileIncrement description] 设置用户属性相对变化值
91+ * @param {[type] } propertyName [description] 属性名称 支持类型:String;以字母或`$`开头,可包含大小写字母/数字/`_`/`$`,最大长度125字符,不支持乱码和中文
92+ * @param {[type] } propertyValue [description] 属性值 支持类型:String/Number/Boolean/Object/Array;若为字符串,则最大长度255字符;若为数组或集合,则最多包含100条,且key约束条件与属性名称一致,value最大长度255字符
93+ */
94+ function profileIncrement ( propertyName , propertyValue ) {
95+ AnalysysAgent . profileIncrement ( propertyName , propertyValue )
96+ }
97+ /**
98+ * [profileAppend description]设置单个列表类型的属性
99+ * @param {[type] } propertyName [description] 属性名称 支持类型:String;以字母或`$`开头,可包含大小写字母/数字/`_`/`$`,最大长度125字符,不支持乱码和中文
100+ * @param {[type] } propertyValue [description] 属性值 支持类型:String/Number/Boolean;最大长度255字符;
101+ */
102+ function profileAppend ( propertyName , propertyValue ) {
103+ AnalysysAgent . profileAppend ( propertyName , propertyValue ) ;
104+ }
105+ /**
106+ * [profileUnset description] 删除设置的属性
107+ * @param {[type] } property [description] 属性名称 支持类型:String;以字母或`$`开头,可包含大小写字母/数字/`_`/`$`,最大长度125字符,不支持乱码和中文
108+ */
109+ function profileUnset ( property ) {
110+ AnalysysAgent . profileUnset ( property ) ;
111+ }
112+ /**
113+ * [profileDelete description] 要清除已经设置的所有属性
114+ */
115+ function profileDelete ( ) {
116+ AnalysysAgent . profileDelete ( ) ;
117+ }
118+ /**
119+ * [reset description] 清除本地设置
120+ */
121+ function reset ( ) {
122+ AnalysysAgent . reset ( ) ;
123+ }
124+
125+ /**
126+ * [historyPage description] 修改history记录跳转页面
127+ * @param {[type] } page [description] 跳转页面地址
128+ * @return {[type] } [description]
129+ */
130+ function historyPage ( page ) {
131+ document . title = 'historyPage' //跳转后的页面title
132+ history . pushState ( null , null , page )
133+ }
134+ /**
135+ * [historyPage description] 修改hash值跳转页面
136+ * @param {[type] } page [description] 跳转页面地址
137+ * @return {[type] } [description]
138+ */
139+ function hashPage ( page ) {
140+ document . title = 'hashPage'
141+ location . href = page
142+ }
143+
144+ function arrayTrack ( ) {
145+ var productList = [ {
146+ "OrderId" : "123456" ,
147+ "ProductName" : "Iphone 6s plus" ,
148+ "ProductTotalPrice" : "10000"
149+ } ,
150+ {
151+ "OrderId" : "123456" ,
152+ "ProductName" : "Iphone 7s plus" ,
153+ "ProductTotalPrice" : "20000"
154+ }
155+ ]
156+ var ShopName = "天猫旗舰店"
157+ for ( var i = 0 ; i < productList . length ; i ++ ) {
158+ productList [ i ] [ "ShopName" ] = ShopName
159+ AnalysysAgent . track ( "buy" , productList [ i ] )
160+ }
161+ }
0 commit comments