Skip to content

Commit d4ed67f

Browse files
author
shengyonggen
committed
全埋点预置属性
1 parent 825ec17 commit d4ed67f

File tree

4 files changed

+30
-28
lines changed

4 files changed

+30
-28
lines changed

sensorsdata.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/sdk.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,7 +1489,7 @@ saEvent.send = function(p, callback) {
14891489
for(var key in state.props){
14901490
state.props[key] = state.props[key].slice(0, sd.para.max_referrer_string_length);
14911491
}
1492-
this.save;
1492+
this.save();
14931493
}
14941494

14951495
} else {
@@ -1637,24 +1637,25 @@ saEvent.send = function(p, callback) {
16371637

16381638
var props = {};
16391639

1640-
props._el_tagname = tagName;
1641-
props._el_name = target.getAttribute('name');
1642-
props._el_id = target.getAttribute('id');
1643-
props._el_classname = typeof target.className === 'string' ? target.className : null;
1644-
props._el_href = target.getAttribute('href');
1640+
props.$element_type = tagName;
1641+
props.$element_name = target.getAttribute('name');
1642+
props.$element_id = target.getAttribute('id');
1643+
props.$element_class_name = typeof target.className === 'string' ? target.className : null;
1644+
props.$element_target_url = target.getAttribute('href');
16451645

16461646
// 获取内容
16471647
if (target.textContent) {
16481648
var textContent = _.trim(target.textContent);
16491649
if (textContent) {
16501650
textContent = textContent.replace(/[\r\n]/g, ' ').replace(/[ ]+/g, ' ').substring(0, 255);
16511651
}
1652-
props._el_value = textContent;
1652+
props.$element_content = textContent;
16531653
}
16541654
props = _.strip_empty_properties(props);
16551655

16561656
props.$url = location.href;
16571657
props.$url_path = location.pathname;
1658+
props.$tite = document.title;
16581659

16591660
return props;
16601661
},
@@ -1667,7 +1668,7 @@ saEvent.send = function(p, callback) {
16671668

16681669
if(tagName === 'input'){
16691670
if(target.getAttribute('type') === 'button' || target.getAttribute('type') === 'submit'){
1670-
props._el_value = target.value;
1671+
props.$element_content = target.value;
16711672
}else{
16721673
return false;
16731674
}
@@ -1676,9 +1677,9 @@ saEvent.send = function(p, callback) {
16761677
_.extend(props, this.getProps(tagName,target));
16771678

16781679
if(tagName === 'a'){
1679-
_.trackLink({event:e},'_web_event',props);
1680+
_.trackLink({event:e},'$webClick',props);
16801681
}else{
1681-
sd.track('_web_event',props);
1682+
sd.track('$webClick',props);
16821683
}
16831684
}
16841685

src/sensorsdata.full.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ if(typeof JSON!=='object'){JSON={}}(function(){'use strict';var rx_one=/^[\],:{}
618618
, slice = ArrayProto.slice
619619
, toString = ObjProto.toString
620620
, hasOwnProperty = ObjProto.hasOwnProperty
621-
, LIB_VERSION = '1.6.20';
621+
, LIB_VERSION = '1.6.22';
622622

623623
sd.lib_version = LIB_VERSION;
624624

@@ -2097,7 +2097,7 @@ saEvent.send = function(p, callback) {
20972097
for(var key in state.props){
20982098
state.props[key] = state.props[key].slice(0, sd.para.max_referrer_string_length);
20992099
}
2100-
this.save;
2100+
this.save();
21012101
}
21022102

21032103
} else {
@@ -2245,24 +2245,25 @@ saEvent.send = function(p, callback) {
22452245

22462246
var props = {};
22472247

2248-
props._el_tagname = tagName;
2249-
props._el_name = target.getAttribute('name');
2250-
props._el_id = target.getAttribute('id');
2251-
props._el_classname = typeof target.className === 'string' ? target.className : null;
2252-
props._el_href = target.getAttribute('href');
2248+
props.$element_type = tagName;
2249+
props.$element_name = target.getAttribute('name');
2250+
props.$element_id = target.getAttribute('id');
2251+
props.$element_class_name = typeof target.className === 'string' ? target.className : null;
2252+
props.$element_target_url = target.getAttribute('href');
22532253

22542254
// 获取内容
22552255
if (target.textContent) {
22562256
var textContent = _.trim(target.textContent);
22572257
if (textContent) {
22582258
textContent = textContent.replace(/[\r\n]/g, ' ').replace(/[ ]+/g, ' ').substring(0, 255);
22592259
}
2260-
props._el_value = textContent;
2260+
props.$element_content = textContent;
22612261
}
22622262
props = _.strip_empty_properties(props);
22632263

22642264
props.$url = location.href;
22652265
props.$url_path = location.pathname;
2266+
props.$tite = document.title;
22662267

22672268
return props;
22682269
},
@@ -2275,7 +2276,7 @@ saEvent.send = function(p, callback) {
22752276

22762277
if(tagName === 'input'){
22772278
if(target.getAttribute('type') === 'button' || target.getAttribute('type') === 'submit'){
2278-
props._el_value = target.value;
2279+
props.$element_content = target.value;
22792280
}else{
22802281
return false;
22812282
}
@@ -2284,9 +2285,9 @@ saEvent.send = function(p, callback) {
22842285
_.extend(props, this.getProps(tagName,target));
22852286

22862287
if(tagName === 'a'){
2287-
_.trackLink({event:e},'_web_event',props);
2288+
_.trackLink({event:e},'$webClick',props);
22882289
}else{
2289-
sd.track('_web_event',props);
2290+
sd.track('$webClick',props);
22902291
}
22912292
}
22922293

vtrack.min.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)