@dash0/sdk-web
Version:
Dash0's Web SDK to collect telemetry from end-users' web browsers
20 lines (17 loc) • 720 B
text/typescript
import { addAttribute, AttributeValueType, removeAttribute } from "../utils/otel";
import { vars } from "../vars";
import { AnyValue } from "../types/otlp";
/**
* Adds a signal attribute to be transmitted with every signal.
* Note: if you need to ensure attributes are included with signals transmitted on initial page load, you should use
* the "additionalSignalAttributes" property of the init call instead
*/
export function addSignalAttribute(name: string, value: AttributeValueType | AnyValue) {
addAttribute(vars.signalAttributes, name, value);
}
/**
* Removes a previously added signal attribute
*/
export function removeSignalAttribute(name: string) {
removeAttribute(vars.signalAttributes, name);
}