Skip to content

Commit efb01ab

Browse files
authored
Merge pull request #423 from prezly/fix/segment-tracking-when-no-key
[DEV-19738] Fix - Do not try tracking to segment when no writeKey provided
2 parents 9acaa25 + 08a6902 commit efb01ab

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/analytics-nextjs/src/Analytics.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,13 @@ export class Analytics {
7171
}
7272

7373
get integrations() {
74+
const hasSegmentWriteKey = Boolean(
75+
this.config?.segment && this.config.segment.settings.writeKey,
76+
);
77+
7478
return {
7579
Prezly: this.permissions.canTrackToPrezly,
76-
'Segment.io': this.permissions.canTrackToSegment,
80+
'Segment.io': hasSegmentWriteKey && this.permissions.canTrackToSegment,
7781
};
7882
}
7983

0 commit comments

Comments
 (0)