# Class CompoundTelemetryClient

Used to combine a set of TwinfinityTelemetryClient instances and have calls to the trackXYZ methods, on this instance, forwarded to them.

#### Implements

- TwinfinityTelemetryClient

##### Index

### Constructors

constructor

### Properties

role?

### Accessors

accountId
isConsoleLoggingEnabled
userId

### Methods

delete
entries
set
setAuthenticatedUserContext
startTrackEvent
trackEvent
trackException
trackMetric
trackTrace
createDefault

## Constructors

### constructor

- new CompoundTelemetryClient(): CompoundTelemetryClient

  Constructor. While possible to use one should probably use createDefault instead.

  #### Returns CompoundTelemetryClient

## Properties

### `Optional` role

role?: string

Optional Role name that application insights will report. A good idea is to use application name for this.

## Accessors

### accountId

- get accountId(): string

  AccountId that application insights will report. In twinfinity its a good idea to set it to the customer hostname.

  #### Returns string

### isConsoleLoggingEnabled

- get isConsoleLoggingEnabled(): boolean

  `true` if console logging is enabled, otherwise `false`.

  #### Returns boolean

- set isConsoleLoggingEnabled(v: boolean): void

  Set to `true` to enable console logging. `false` to disable.

  #### Parameters

  - v: boolean

  #### Returns void

### userId

- get userId(): string

  User id that application insights will report. In twinfinity its a good idea to set this to the logged in user.

  #### Returns string

## Methods

### delete

- delete(name: string): boolean

  Unregister a TwinfinityTelemetryClientConfig. Calls to the trackXYZ methods will no longer be forwarded to that instance.

  #### Parameters

  - name: string

    Name of TwinfinityTelemetryClientConfig to delete.

  #### Returns boolean

  `true` if TwinfinityTelemetryClientConfig existed (and hence was deleted), otherwise `false`

### entries

- entries(): IterableIterator<TwinfinityTelemetryClientConfig>

  Iterator for all registered TwinfinityTelemetryClientConfig. See set and delete as well.

  #### Returns IterableIterator<TwinfinityTelemetryClientConfig>

  Iterator for all registered TwinfinityTelemetryClientConfig.

### set

- set(o: TwinfinityTelemetryClientConfig): void

  Register a TwinfinityTelemetryClientConfig instance. Future calls to trackXYZ methods will be forwarded to the client property of this instance.

  #### Parameters

  - o: TwinfinityTelemetryClientConfig

    a TwinfinityTelemetryClientConfig.

  #### Returns void

### setAuthenticatedUserContext

- setAuthenticatedUserContext(
  authenticatedUserId: string,
  accountId?: string,
  storeInCookie?: boolean,
  ): void

  Set the authenticated user id and the account id. Used for identifying a specific signed-in user. Parameters must not contain whitespace or ,;=|

  The method will only set the `authenticatedUserId` and `accountId` in the current page view. To set them for the whole session, you should set `storeInCookie = true`

  #### Parameters

  - authenticatedUserId: string
  - `Optional` accountId: string
  - `Optional` storeInCookie: boolean

  #### Returns void

  Implementation of TwinfinityTelemetryClient.setAuthenticatedUserContext

### startTrackEvent

- startTrackEvent(name: string): TelemetryEvent

  Starts tracking an event with the given name.

  #### Parameters

  - name: string

    The name of the event to track.

  #### Returns TelemetryEvent

### trackEvent

- trackEvent(event: IEventTelemetry, customProperties?: ICustomProperties): void

  Track an event. See Application insights documentation for more information

  #### Parameters

  - event: IEventTelemetry
  - `Optional` customProperties: ICustomProperties

  #### Returns void

  Implementation of TwinfinityTelemetryClient.trackEvent

### trackException

- trackException(
  exception: IExceptionTelemetry,
  customProperties?: ICustomProperties,
  ): void

  Track an exception. See Application insights documentation for more information

  #### Parameters

  - exception: IExceptionTelemetry
  - `Optional` customProperties: ICustomProperties

  #### Returns void

  Implementation of TwinfinityTelemetryClient.trackException

### trackMetric

- trackMetric(
  metric: IMetricTelemetry,
  customProperties?: ICustomProperties,
  ): void

  Track a metric. See Application insights documentation for more information

  #### Parameters

  - metric: IMetricTelemetry
  - `Optional` customProperties: ICustomProperties

  #### Returns void

  Implementation of TwinfinityTelemetryClient.trackMetric

### trackTrace

- trackTrace(trace: ITraceTelemetry, customProperties?: ICustomProperties): void

  Track a trace. See Application insights documentation for more information

  #### Parameters

  - trace: ITraceTelemetry
  - `Optional` customProperties: ICustomProperties

  #### Returns void

  Implementation of TwinfinityTelemetryClient.trackTrace

### `Static` createDefault

- createDefault(): CompoundTelemetryClient

  Creates the default CompoundTelemetryClient instance. It will log to console by default and if it detects a application insights instance in the page it will use that as well.

  #### Returns CompoundTelemetryClient