umami icon indicating copy to clipboard operation
umami copied to clipboard

data-umami-event attribute non-functional (Reopening #2186)

Open plokkingmachine opened this issue 1 year ago • 4 comments

Describe the Bug

I utilized the data-umami-event attribute in some of my links and the data gets collected. For some elements it does not work. Both of them are <a> elements. Page views are registered without issues.

Database

PostgreSQL

Relevant log output

No, there is none in the console output.
Some events get recorded, some don't.

Which Umami version are you using? (if relevant)

v2.10.2

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

Docker

plokkingmachine avatar Mar 10 '24 10:03 plokkingmachine

I'm having trouble reproducing this issue. Are you using any particular UI framework, link component, or does this apply to a straight <a> element in html?

And when you say 'some elements it does not work', are you saying it disables the tag from working, or that Umami is not sending data?

briancao avatar Mar 25 '24 00:03 briancao

I'm experiencing this as well. Some events will work and get logged, others will not.

After a bit of testing, I think I was able to find a potential reason and wondering if others can confirm for me.

When the event name used is more than 50 characters, the event does not seem to get logged. Perhaps the truncation logic is not working as intended?

I noticed this behavior both with the data-attribute method as well as the onclick method.

As a sanity check, when I limit the event name to 50 chars via data-umami-event="${name.slice(0, 50)}", every link now gets logged.

cc: #2186

gxespino avatar Apr 18 '24 06:04 gxespino

@gxespino We have a yup validation on the api/send to limit event_name to 50 characters.

https://github.com/umami-software/umami/blob/a38baa50afa7eae54ffdbafece83d10745bb808d/src/pages/api/send.ts#L75

The error message in the send response, should also be informing you of the validation.

briancao avatar Apr 18 '24 17:04 briancao

@briancao, would it be possible to up the limit a bit please? (to 100 characters?)

For some precise events, it is useful to be able to describe them in more details than 50 characters.

ThomasCloarec avatar Jun 25 '24 02:06 ThomasCloarec