Skip to content

Add support for umami analytics in status page #5608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

hadestructhor
Copy link

@hadestructhor hadestructhor commented Feb 8, 2025

⚠️⚠️⚠️ Since we do not accept all types of pull requests and do not want to waste your time. Please be sure that you have read pull request rules:
https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma

Tick the checkbox if you understand [x]:

  • I have read and understand the pull request rules.

Description

Fixes #5607
Fixes #5690
Fixes #2938

Type of change

Please delete any options that are not relevant.

  • User interface (UI)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist

  • My code follows the style guidelines of this project
  • I ran ESLint and other linters for modified files
  • I have performed a self-review of my own code and tested it
  • I have commented my code, particularly in hard-to-understand areas (including JSDoc for methods)
  • My changes generates no new warnings
  • My code needed automated testing. I have added them (this is optional task)

Screenshots (if any)

Please do not use any external image service. Instead, just paste in or drag and drop the image here, and it will be uploaded automatically.

@hadestructhor
Copy link
Author

@louislam I just read the contributing and I'm tagging you as written in there.
This is a pull request where I intend to add support for umami analytics in status pages.
You can read the issue I've opened 5607.

@hadestructhor hadestructhor force-pushed the feature/umami-analytics-status-page branch 3 times, most recently from ffe03e8 to 6cd8931 Compare February 9, 2025 13:04
@hadestructhor hadestructhor force-pushed the feature/umami-analytics-status-page branch from 6cd8931 to afae736 Compare February 9, 2025 13:06
@NotAShelf
Copy link

It would be very neat if you could make the implementation a bit more generic, so that other analytics software can be used as well. Plausible, for example, uses an almost identical format for injecting your "tracker" inside a script tag.

https://github.com/louislam/uptime-kuma/pull/5608/files#diff-abaf9512ad93e05dbe972cee7baafec4eedeed70fb3144655f55a4d54ac8cf62R206-R207

could easily be made generic imo.

@hadestructhor
Copy link
Author

@NotAShelf Very nice idea, for now, I've tested my code and it fits my need to add umami tracking. I will probably open another issue and make another pr to make it more generic as the code truly is very similar to the google analytics pr I had seen.
I haven't used Plausible, but I know there are other analytics tools, I just happened to find Umami easier to run and setup.
For now, I've found the following analytics platforms:

  • Google Analytics (already implemented)
  • Umami Analytics (which should be covered with this pr)
  • Matomo (to be added)
  • Plausible (to be added)

I've found many more but these are the main ones I've found being used online. If there are any more, I invite anyone who uses them to list them in a comment so we can discuss adding them.

@hadestructhor hadestructhor marked this pull request as ready for review February 9, 2025 21:46
Copy link
Collaborator

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty good.

I have left a comment about the migration/db-design and one how we could declutter this part of the UI.

@CommanderStorm CommanderStorm added the pr:please address review comments this PR needs a bit more work to be mergable label Feb 16, 2025
@hadestructhor
Copy link
Author

Hey, just saw your comments @CommanderStorm, I will take them into account this week hopefully, can't promise anything.
I've never used vue so I'll need to check how to make a list of options to select the type, and I might as well add support for plausible while I'm at it if I'm generalizing the database.
Didn't know about knex either, so I need some time to use it, but I looked at how it's used and it should be easy.

@hadestructhor hadestructhor force-pushed the feature/umami-analytics-status-page branch 2 times, most recently from 71761e9 to a52341b Compare February 17, 2025 23:42
@hadestructhor hadestructhor force-pushed the feature/umami-analytics-status-page branch from a52341b to e44ec55 Compare February 17, 2025 23:45
@hadestructhor
Copy link
Author

@CommanderStorm I finished taking into account your remarks. I have honestly never used vue and it took me a while to get the select working, but it is tested and works as intended (automated tests and I tested it manually by connecting it to my own umami instance).
I don't have the time to add the Plausible support, but I will try to do it tomorrow if I have the time for @NotAShelf.
Don't hesitate to tell me if I did something that could be done better (I know I added a script tag before the template one on the status page when there's already another one at the bottom, but I couldn't get my options to load otherwise, I'm guessing the order counts in vue).

@hadestructhor hadestructhor force-pushed the feature/umami-analytics-status-page branch from 2dd52c4 to 6bade1f Compare February 18, 2025 23:08
@hadestructhor
Copy link
Author

@CommanderStorm I finished making it generic and refactoring the code, the tests all pass, I will let you validate it whenever you feel like it.
@NotAShelf I've also added support for Plausible, it should be pretty easy to add any other analytics software support in the future, I tried making one entry point and have specific implementations for each analytics platform.

Copy link
Collaborator

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is my review. Took a bit longer, but hey exams..
We can merge it into V2.1, once these are adressed

@hadestructhor hadestructhor force-pushed the feature/umami-analytics-status-page branch from 1a2826c to 8f480c7 Compare April 10, 2025 21:45
@hadestructhor hadestructhor force-pushed the feature/umami-analytics-status-page branch from 8f480c7 to 28e288d Compare April 10, 2025 21:48
@hadestructhor
Copy link
Author

Hey All, sorry for the wait, I've had life happen to me for a few weeks.

@CommanderStorm, I took into account your review, feel free to validate it or not, but I think this time, I didn't change the db init file when I shouldn't (sorry, I don't know why I changed it again when you had already told me not to, must've done it by habit xD).

I also took your very understandable remark and use case into account @aldalen, I'll let you test out the proxying and validate that end as I only tested with umami and by giving the full script url with the updated code.

@CommanderStorm CommanderStorm changed the base branch from master to 2.1.X April 10, 2025 22:26
Copy link
Collaborator

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. Thanks for everything
Will be merged into V2.1 once master branches into this direction.

@CommanderStorm CommanderStorm changed the base branch from 2.1.X to master April 10, 2025 22:28
@CommanderStorm CommanderStorm added this to the 2.1.0 milestone Apr 10, 2025
@hadestructhor
Copy link
Author

@aldalen I had you as a reviewer, but since you commented that it's okay for you, I suppose this can be merged.

What do you think @CommanderStorm ?

@CommanderStorm
Copy link
Collaborator

CommanderStorm commented May 4, 2025

It will be merged into v2.1 as said above.
This is a bit too much of a feature for such late in the cycle for V2.0 (we are already at beta.3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:resolve-merge-conflict pr:please address review comments this PR needs a bit more work to be mergable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Matomo Analytics Support Umami analytics support Support Plausible and other Analytics Platforms
4 participants