Skip to content

Type Alias: CmcdEncodeOptions ​

ts
type CmcdEncodeOptions = object;

Defined in: CmcdEncodeOptions.ts:12

Options for encoding CMCD values.

Properties ​

baseUrl? ​

ts
baseUrl?: string;

Defined in: CmcdEncodeOptions.ts:63

Base URL (typically the manifest or current request URL) used to convert absolute nor values into paths relative to this base, per the CMCD specification. This option does not modify values that are already relative paths, but CMCD version 1 still URL-encodes them on emission. If omitted, nor values are emitted unchanged (subject to the version 1 URL-encoding rule). If baseUrl is not a valid URL, the encoder ignores it.


customHeaderMap? ​

ts
customHeaderMap?: Partial<CmcdHeaderMap>;

Defined in: CmcdEncodeOptions.ts:45

A map of CMCD header fields to custom CMCD keys.


events? ​

ts
events?: string[];

Defined in: CmcdEncodeOptions.ts:68

Array of event names to filter.


filter? ​

ts
filter?: (key) => boolean;

Defined in: CmcdEncodeOptions.ts:54

A filter function for CMCD keys.

Parameters ​

key ​

CmcdKey

The CMCD key to filter.

Returns ​

boolean

true if the key should be included, false otherwise.


formatters? ​

ts
formatters?: Partial<CmcdFormatterMap>;

Defined in: CmcdEncodeOptions.ts:40

A map of CMCD keys to custom formatters. A formatter replaces the value rule of its key. The encoder does not apply the type, length, and token rules of the key to the output. The encoder still applies these rules to the output:

  • It drops an empty value. An empty value is undefined, null, an empty string, an empty array, or a number that is not finite.
  • It drops a default value, with or without parameters. The default value is false, or 1 for pr. The exceptions are pr on a pr event and bg on a b event.
  • It wraps a string for e, ot, sf, st, and sta in SfToken.
  • It replaces a ts that is not a finite number with the current time.

The encoder does not call a formatter for an empty value, for false, or for v. It also skips the formatter of a key that it does not send. The formatters of ot and e still run when a rule needs their value.


reportingMode? ​

ts
reportingMode?: CmcdReportingMode;

Defined in: CmcdEncodeOptions.ts:26

The reporting mode to use.

Default Value ​

CmcdReportingMode.REQUEST


version? ​

ts
version?: CmcdVersion;

Defined in: CmcdEncodeOptions.ts:19

The version of the CMCD specification to use. If omitted, the version is inferred from the data's v key, defaulting to CMCD_V2.

Default Value ​

CMCD_V2

A Streaming Video Technology Alliance project.