Skip to content

Commit

Permalink
🐛 read segment write key on build time
Browse files Browse the repository at this point in the history
  • Loading branch information
sebipap committed Nov 21, 2023
1 parent e51a3be commit 0ebfba1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions utils/segment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ type TX = {
usdAmount: string;
};

const analyticsApiKey = process.env.NEXT_PUBLIC_SEGMENT_WRITE_KEY || '';

export function getAnalytics() {
const { NEXT_PUBLIC_SEGMENT_WRITE_KEY } = process.env;
if (!NEXT_PUBLIC_SEGMENT_WRITE_KEY) throw new Error('Missing NEXT_PUBLIC_SEGMENT_WRITE_KEY');
const analytics = AnalyticsBrowser.load({ writeKey: NEXT_PUBLIC_SEGMENT_WRITE_KEY });
const analytics = AnalyticsBrowser.load({ writeKey: analyticsApiKey });
return analytics;
}

Expand Down

1 comment on commit 0ebfba1

@vercel
Copy link

@vercel vercel bot commented on 0ebfba1 Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

app – ./

app.exactly.app
app.exact.ly
exactly-development.vercel.app
app-git-main.exactly.app

Please sign in to comment.