Skip to content

Commit

Permalink
fix: dont attempt to track if no settings.writeKey provided
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamiewarb committed Jul 16, 2023
1 parent 72ccf7d commit 723f94d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/runtime/composables/useSegment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function useSegment(segment?: AnalyticsBrowser) {
const logPrefix = shouldTrack() ? 'segment' : 'segment-mock';

function shouldTrack() {
return process.client && (process.env.NODE_ENV !== 'development' || config.trackDevMode);
return process.client && config.settings?.writeKey && (process.env.NODE_ENV !== 'development' || config.trackDevMode);
}

// See: https://segment.com/docs/connections/spec/identify/
Expand Down

0 comments on commit 723f94d

Please sign in to comment.