mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
43 lines
752 B
JavaScript
43 lines
752 B
JavaScript
import * as segment from './segment';
|
|
import * as google from './google';
|
|
|
|
let initialized = false;
|
|
export async function init (accountId) {
|
|
if (initialized) {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
await segment.init();
|
|
await google.init(accountId);
|
|
|
|
initialized = true;
|
|
} catch (e) {
|
|
// Just to be extra safe
|
|
}
|
|
}
|
|
|
|
export function trackEvent (...args) {
|
|
try {
|
|
google.sendEvent(...args);
|
|
} catch (e) {
|
|
// Just to be extra safe
|
|
}
|
|
}
|
|
|
|
export function setAccountId (accountId) {
|
|
try {
|
|
google.setUserId(accountId);
|
|
} catch (e) {
|
|
// Just to be extra safe
|
|
}
|
|
}
|
|
|
|
export function trackLegacyEvent (event, properties) {
|
|
try {
|
|
segment.trackLegacyEvent(event, properties)
|
|
} catch (e) {
|
|
// Just to be extra safe
|
|
}
|
|
}
|