File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,8 @@ var mp_scene = {
8383
8484var sa_referrer = '直接打开' ;
8585
86+ var mpshow_time = null ;
87+
8688sa . lib_version = LIB_VERSION ;
8789
8890var logger = typeof logger === 'object' ? logger : { } ;
@@ -944,6 +946,8 @@ function appShow(para) {
944946 // console.log('app_show', JSON.stringify(arguments));
945947 var prop = { } ;
946948
949+ mpshow_time = ( new Date ( ) ) . getTime ( ) ;
950+
947951 if ( para && para . path ) {
948952 prop . $url_path = para . path ;
949953 }
@@ -958,8 +962,14 @@ function appShow(para) {
958962} ;
959963
960964function appHide ( ) {
965+ var current_time = ( new Date ( ) ) . getTime ( ) ;
966+ var prop = { } ;
967+ if ( mpshow_time && ( current_time - mpshow_time > 0 ) && ( ( current_time - mpshow_time ) / 3600000 < 24 ) ) {
968+ prop . event_duration = ( current_time - mpshow_time ) / 1000 ;
969+ }
961970 if ( sa . para . autoTrack && sa . para . autoTrack . appHide === true ) {
962- sa . autoTrackCustom ( 'appHide' , { } , '$MPHide' ) ;
971+
972+ sa . autoTrackCustom ( 'appHide' , prop , '$MPHide' ) ;
963973 }
964974 // console.log('app_hide', JSON.stringify(arguments));
965975 // sa.track('app_hide', { detail: JSON.stringify(arguments) });
You can’t perform that action at this time.
0 commit comments