Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**
* Why was this account created?
*/
type CreationReason = {
creationDate: string,
installerId?: string
}
const CREATION_REASON_FILE = 'CreationReason.json'
const UTILITY_SERVER_FILE = 'utilityServer.json'
// Install information powered by the util server:
let installReason: InstallReason = {}
// Set up the global Firebase instance at boot:
if (ENV.USE_FIREBASE && !firebase.isMock) {
firebase.analytics().setUserId(DeviceInfo.getUniqueID())
global.firebase = firebase
}
/**
* Tracks a user event, like navigating or logging in.
*/
export async function trackEvent (event: TrackingEvent, opts?: TrackingOptions = {}) {
if (global.firebase) {
const { accountDate, currencyCode, dollarValue, installerId, pluginId } = opts
const params: Object = {}
if (accountDate != null) params.adate = accountDate
if (currencyCode != null) params.currency = currencyCode
if (dollarValue != null) {
params.currency = 'USD'