Skip to main content

validateEventIdFormat

Upgather Analytics


Upgather Analytics / validateEventIdFormat

Function: validateEventIdFormat()

validateEventIdFormat(eventId): boolean

Validate an event ID format.

Parameters

eventId

string

The event ID to validate

Returns

boolean

true if the format is valid, false otherwise

Remarks

This function performs a quick validation of the event ID format without making an API call. It checks that the ID follows the required naming convention.

Example

const isValid = validateEventIdFormat('homepage-visit');
console.log(`Valid format: ${isValid}`); // true

const isInvalid = validateEventIdFormat('Invalid Event!');
console.log(`Valid format: ${isInvalid}`); // false