Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/analytics #143

Merged
merged 2 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/afraid-snakes-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@web3modal/core-react-native': patch
---

fixed duplicated events issue
2 changes: 1 addition & 1 deletion .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"mode": "exit",
"mode": "pre",
"tag": "alpha",
"initialVersions": {
"@apps/gallery": "1.0.5-alpha.0",
Expand Down
13 changes: 7 additions & 6 deletions packages/core/src/controllers/EventsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ export const EventsController = {
};
},

async _sendAnalyticsEvent(payload: EventsControllerState) {
if (excluded.includes(payload.data.event)) {
async _sendAnalyticsEvent(data: EventsControllerState['data'], timestamp: number) {
if (excluded.includes(data.event)) {
return;
}

Expand All @@ -57,8 +57,8 @@ export const EventsController = {
body: {
eventId: CoreHelperUtil.getUUID(),
bundleId: CoreHelperUtil.getBundleId(),
timestamp: payload.timestamp,
props: payload.data
timestamp,
props: data
}
});
} catch {
Expand All @@ -67,12 +67,13 @@ export const EventsController = {
},

async sendEvent(data: EventsControllerState['data']) {
state.timestamp = Date.now();
const timestamp = Date.now();
state.timestamp = timestamp;
state.data = data;
await ApiController.state.prefetchPromise;

if (OptionsController.state.enableAnalytics) {
EventsController._sendAnalyticsEvent(state);
EventsController._sendAnalyticsEvent(data, timestamp);
}
}
};
22 changes: 4 additions & 18 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11789,24 +11789,10 @@ __metadata:
languageName: node
linkType: hard

"caniuse-lite@npm:^1.0.30001517":
version: 1.0.30001519
resolution: "caniuse-lite@npm:1.0.30001519"
checksum: 563008248cb7f3746dba1f72ae300140e30f7cf6c0f8becd94fd8923b481cad85a08818b5c1462bb94f11e7afdc3c69ada75113db36483aa551c000a00e97733
languageName: node
linkType: hard

"caniuse-lite@npm:^1.0.30001541":
version: 1.0.30001547
resolution: "caniuse-lite@npm:1.0.30001547"
checksum: bd8ef400fdd6a76aa5a4bc490a5b9b8adffbff1657d36ee1516b4be30315f1a3cfaa51ab872a46d5e7db17424eaa335593cd27e640248b4df3897b113650a7d3
languageName: node
linkType: hard

"caniuse-lite@npm:^1.0.30001565":
version: 1.0.30001570
resolution: "caniuse-lite@npm:1.0.30001570"
checksum: e47230d2016edea56e002fa462a5289f697b48dcfbf703fb01aecc6c98ad4ecaf945ab23c253cb7af056c2d05f266e4e4cbebf45132100e2c9367439cb95b95b
"caniuse-lite@npm:^1.0.30001517, caniuse-lite@npm:^1.0.30001541, caniuse-lite@npm:^1.0.30001565":
version: 1.0.30001589
resolution: "caniuse-lite@npm:1.0.30001589"
checksum: 20debfb949413f603011bc7dacaf050010778bc4f8632c86fafd1bd0c43180c95ae7c31f6c82348f6309e5e221934e327c3607a216e3f09640284acf78cd6d4d
languageName: node
linkType: hard

Expand Down
Loading