Open danilofuchs opened 1 year ago
I was wondering the same thing, for the same reason - to call clarity.identify
. This is especially important if loading Clarity via UET, since you may know if UET loads, but not after UET loads Clarity.
How about this?
https://github.com/microsoft/clarity/blob/a60d2e7389e305da017e91c61ea9eb5705324edf/packages/clarity-js/src/queue.ts#L7-L16 shows there's an array queue and it seems to be flushed. Not sure if this is officially supported (i.e. if it could break later), but it seems to work.
// Start queuing up calls if Clarity hasn't loaded
window.clarity = window.clarity || function() {
(window.clarity.q = window.clarity.q || []).push(arguments)
}
Is there an event for something like
window.addEventListener("clarity:start")
?It would be useful to make sure our calls to
identify()
happen after that