Type Alias: CmcdEncodeOptions
type CmcdEncodeOptions = object;Defined in: CmcdEncodeOptions.ts:12
Options for encoding CMCD values.
Properties
baseUrl?
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?
customHeaderMap?: Partial<CmcdHeaderMap>;Defined in: CmcdEncodeOptions.ts:45
A map of CMCD header fields to custom CMCD keys.
events?
events?: string[];Defined in: CmcdEncodeOptions.ts:68
Array of event names to filter.
filter?
filter?: (key) => boolean;Defined in: CmcdEncodeOptions.ts:54
A filter function for CMCD keys.
Parameters
key
The CMCD key to filter.
Returns
boolean
true if the key should be included, false otherwise.
formatters?
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, or1forpr. The exceptions arepron aprevent andbgon abevent. - It wraps a string for
e,ot,sf,st, andstainSfToken. - It replaces a
tsthat 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?
reportingMode?: CmcdReportingMode;Defined in: CmcdEncodeOptions.ts:26
The reporting mode to use.
Default Value
CmcdReportingMode.REQUEST
version?
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