Skip to content

Commit

Permalink
Wrap up analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
xzilja committed Oct 9, 2023
1 parent c436a16 commit 8aef9cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
20 changes: 9 additions & 11 deletions packages/core/src/controllers/EventsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,24 @@ export const EventsController = {
}
},

_sendAnalyticsEvent(payload: EventsControllerState) {
if (excluded.includes(payload.data.event) || typeof window === 'undefined') {
return
}

api
.post({
async _sendAnalyticsEvent(payload: EventsControllerState) {
try {
if (excluded.includes(payload.data.event) || typeof window === 'undefined') {
return
}
await api.post({
path: '/event',
headers: EventsController._getApiHeaders(),
body: {
url: window.location.href,
domain: window.location.hostname,
product: 'WEB3MODAL',
timestamp: payload.timestamp,
props: payload.data
}
})
.catch(_error => {
// Silent error handling
})
} catch {
// Catch silently
}
},

sendEvent(data: EventsControllerState['data']) {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/utils/CoreHelperUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export const CoreHelperUtil = {

getAnalyticsUrl() {
return CoreHelperUtil.isRestrictedRegion()
? 'https://analytics-api-cf-workers-staging.walletconnect-v1-bridge.workers.dev'
: 'https://analytics-api-cf-workers-staging.walletconnect-v1-bridge.workers.dev'
? 'https://pulse.walletconnect.org'
: 'https://pulse.walletconnect.com'
}
}

0 comments on commit 8aef9cb

Please sign in to comment.