Skip to content

Commit

Permalink
fix: disable analytics data on development mode (#1134)
Browse files Browse the repository at this point in the history
* fix: disable analytic during dev mode

* fix: lint
  • Loading branch information
saurabhraghuvanshii authored Dec 20, 2024
1 parent 27398a9 commit f8bfd15
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pages/tools/lib/postAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ export async function postAnalytics({
eventPayload,
}: AnalyticsParams) {
try {
if (process.env.NODE_ENV !== 'production') {
console.log('Analytics event is disabled in development mode.');
return;
}

const deviceType = /Mobi/.test(navigator.userAgent) ? 'Mobile' : 'Desktop';

const response = await fetch(
Expand Down

0 comments on commit f8bfd15

Please sign in to comment.