data-umami-event attribute non-functional (Reopening #2186)
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
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?
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 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, 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.