UNPKG

vue-auto-track

Version:

auto tracking for vue

35 lines (33 loc) 755 B
import { getSystemInfo } from "./native"; let systemInfo = null; export default async function initNativeInfo(env) { await getSystemInfo(env).then((res) => { return (systemInfo = res); }); } export function thirdTrack(eventCode, data, options) { let other = { deviceId: systemInfo ? systemInfo.model + "/" + systemInfo.brand + "/" + systemInfo.system + "/" + systemInfo.version + "/" + systemInfo.xSDKVersion : "", ...options.dyData(), ...options.constData, }; let newItem = { eventCode, ...data, ...other }; options .upload(newItem) .then((e) => { if (e && e.result === true) { } else { } }) .catch((err) => {}); }