Allow disabling session events for the AmplitudeSessionPlugin

Open
#1,109 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
55/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Stale
Tech stack
react-native, typescript
Domain
mobile

Research direction

Start at the AmplitudeSessionPlugin entry point and its configuration type. Preserve session_id enrichment while making session_start and session_end conditional on disableSessionEvents, with false as the default; verify behavior with the option enabled and disabled.

Written by the indexing model from the issue text.

Description

enhancement

Summary

The AmplitudeSessionPlugin currently emits session_start and session_end track events in addition to enriching all events with session_id.

According to Amplitude's documentation, the session_id property is the primary
mechanism for session tracking
, while the start/end events are optional. Amplitude staff has
confirmed
that sessions work correctly without these events.

For high-volume applications, these events can represent a big chunk of total Segment API calls. I'd like the ability to disable the event emission while retaining session_id enrichment.

Proposed Solution

Add a disableSessionEvents configuration option:

interface AmplitudeSessionPluginConfig {
  /**
   * When true, suppresses 'session_start' and 'session_end' track events.
   * The session_id will still be attached to all events via integrations.
   *
   * @default false
   */
  disableSessionEvents?: boolean;
}

// Usage
segmentClient.add({
  plugin: new AmplitudeSessionPlugin({ disableSessionEvents: true })
});

Dominant language
TypeScript
Stars
383
Forks
206
Avg merge
14h 45m
Merged PRs (30d)
11

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from segmentio/analytics-react-native

All issues in segmentio/analytics-react-native

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.