File tree Expand file tree Collapse file tree 5 files changed +19
-0
lines changed Expand file tree Collapse file tree 5 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ export class BrowserBackend extends BaseBackend<BrowserOptions> {
6262 ...this . _options . transportOptions ,
6363 dsn : this . _options . dsn ,
6464 tunnel : this . _options . tunnel ,
65+ sendClientReports : this . _options . sendClientReports ,
6566 _metadata : this . _options . _metadata ,
6667 } ;
6768
Original file line number Diff line number Diff line change @@ -88,6 +88,9 @@ export function init(options: BrowserOptions = {}): void {
8888 if ( options . autoSessionTracking === undefined ) {
8989 options . autoSessionTracking = true ;
9090 }
91+ if ( options . sendClientReports === undefined ) {
92+ options . sendClientReports = true ;
93+ }
9194
9295 initAndBind ( BrowserClient , options ) ;
9396
Original file line number Diff line number Diff line change @@ -67,6 +67,10 @@ export abstract class BaseTransport implements Transport {
6767 * @inheritDoc
6868 */
6969 public recordLostEvent ( type : Outcome ) : void {
70+ if ( ! this . options . sendClientReport ) {
71+ return ;
72+ }
73+
7074 logger . log ( `Adding ${ type } outcome` ) ;
7175 this . _outcomes [ type ] = ( this . _outcomes [ type ] ?? 0 ) + 1 ;
7276 }
@@ -75,6 +79,10 @@ export abstract class BaseTransport implements Transport {
7579 * Send outcomes as an envelope
7680 */
7781 protected _flushOutcomes ( ) : void {
82+ if ( ! this . options . sendClientReport ) {
83+ return ;
84+ }
85+
7886 if ( ! navigator || typeof navigator . sendBeacon !== 'function' ) {
7987 logger . warn ( 'Beacon API not available, skipping sending outcomes.' ) ;
8088 return ;
Original file line number Diff line number Diff line change @@ -132,6 +132,11 @@ export interface Options {
132132 */
133133 autoSessionTracking ?: boolean ;
134134
135+ /**
136+ * Automatically send SDK Client Report
137+ */
138+ sendClientReports ?: boolean ;
139+
135140 /**
136141 * Initial data to populate scope.
137142 */
Original file line number Diff line number Diff line change @@ -64,6 +64,8 @@ export interface TransportOptions {
6464 fetchParameters ?: { [ key : string ] : string } ;
6565 /** The envelope tunnel to use. */
6666 tunnel ?: string ;
67+ /** Automatically send SDK Client Report */
68+ sendClientReport ?: boolean ;
6769 /**
6870 * Set of metadata about the SDK that can be internally used to enhance envelopes and events,
6971 * and provide additional data about every request.
You can’t perform that action at this time.
0 commit comments