Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
) {
const meta = {
device: `${DeviceInfo.getModel()}-${DeviceInfo.getSystemVersion()}`,
...extra,
};
const data = {
[`${functionName}_error`]: `${JSON.stringify(
meta,
)}-${this.serializeObject(error)}`,
};
if (__DEV__) {
// tslint:disable-next-line
console.log(`${moduleName}_${pageName}_${functionName}_error:`, error);
}
Analytics.trackEvent(`${moduleName}_${pageName}`, data);
}
}
return async dispatch => {
const locale = setI18nConfig(desiredLocale);
Analytics.trackEvent(`LocaleChanged: ${locale}`);
// Always restart app on locale change, it's easier this way
dispatch(restartApp(locale));
};
}
) {
let payload = { deviceId }
const additionalPayload = actionToPayload(action)
if (additionalPayload) {
payload = {...payload, ...additionalPayload}
}
Analytics.trackEvent(action.type, payload)
return next(action)
}
const currentScreen = getCurrentRouteName(getState().nav)
const result = next(action)
const nextScreen = getCurrentRouteName(getState().nav)
if (nextScreen !== currentScreen) {
try {
Analytics.trackEvent(action.type, { currentScreen, nextScreen, deviceId })
// Example: Analytics.trackEvent('user_navigation', {currentScreen, nextScreen})
} catch (error) {
Analytics.trackEvent('error', { error, deviceId })
}
}
return result
}
let A = async event => {
amplitude.getInstance().logEvent(event, {});
try {
Analytics.trackEvent(event);
} catch (err) {
console.log(err);
}
};
action: () => {
const eventName = 'EventWithLongProperties';
Analytics.trackEvent(eventName, { propertyValueTooLong: '12345678901234567890123456789012345678901234567890123456789012345' });
console.log(`Scheduled event '${eventName}'.`);
}
},
action: () => {
const eventName = 'EventWithoutProperties';
Analytics.trackEvent(eventName);
console.log(`Scheduled event '${eventName}'.`);
}
},
Analytics.trackEvent('Event without properties')}>
Analytics.trackEvent('Button press', { page: 'Home page' })}>
onPress: () => {
Analytics.trackEvent("Sample event", {});
Alert.alert(null, "Event sent", [{ text: "Ok" }], { cancelable: false });
}
},
action: () => {
const eventName = 'EventWithProperties';
Analytics.trackEvent(eventName, { property1: '100', property2: '200' });
showEventToast(eventName);
}
},