UNPKG

tpa_web_component

Version:

TPA Web Components Library

25 lines (22 loc) 861 B
import { getDeviceInfoFromStorage } from "./util"; function uploadTrackData(eventName, eventId, value) { if ( window.tpa_web_component_env != 'prod') return; //测试环境不上报 if (eventId) { window.gio && window.gio(eventName, eventId, value); } else { window.gio && window.gio(eventName, value); } } export function uploadBuryingPointEvent(eventId, value) { uploadTrackData('track', eventId, value); } export function uploadBuryingPointEventWithDefaultParams(eventId, value = {}) { console.log('gio上报的时候对应的额外参数', value); uploadTrackData('track', eventId, { platform: getDeviceInfoFromStorage().platformName, script_version: getDeviceInfoFromStorage().scriptVersion, app_version: getDeviceInfoFromStorage().appVersion, staffId: sessionStorage.getItem('currentStaffId'), ...value }); }