mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 01:36:22 +00:00
setting AMA custom events
This commit is contained in:
36
browser/main/lib/AwsMobileAnalyticsConfig.js
Normal file
36
browser/main/lib/AwsMobileAnalyticsConfig.js
Normal file
@@ -0,0 +1,36 @@
|
||||
const AWS = require('aws-sdk')
|
||||
const AMA = require('aws-sdk-mobile-analytics')
|
||||
const ConfigManager = require('browser/main/lib/ConfigManager')
|
||||
|
||||
AWS.config.region = 'us-east-1'
|
||||
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
|
||||
IdentityPoolId: 'us-east-1:xxxxxxxxxxxxxxxxxxxxxxxxx'
|
||||
})
|
||||
const mobileAnalyticsClient = new AMA.Manager({
|
||||
appId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
||||
appTitle: 'xxxxxxxxxx'
|
||||
})
|
||||
|
||||
function initAwsMobileAnalytics () {
|
||||
AWS.config.credentials.get(function(err) {
|
||||
if (!err) {
|
||||
console.log("Cognito Identity ID: " + AWS.config.credentials.identityId)
|
||||
}
|
||||
})
|
||||
recordStaticCustomEvent()
|
||||
}
|
||||
|
||||
function recordDynamitCustomEvent (type) {
|
||||
mobileAnalyticsClient.recordEvent(type)
|
||||
}
|
||||
|
||||
function recordStaticCustomEvent () {
|
||||
mobileAnalyticsClient.recordEvent('UI_COLOR_THEME', {
|
||||
uiColorTheme: ConfigManager.default.get().ui.theme
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
initAwsMobileAnalytics,
|
||||
recordDynamitCustomEvent
|
||||
}
|
||||
Reference in New Issue
Block a user