How to create a link tracker using Github Pages

  Kiến thức lập trình

I know it needs a backend technology to create a link tracking subdomain, but can I do that from my Github Pages though actions or using Google Analytics?

What I want to achive is a link like: that only redirects the user to another website, like social media or stackoverflow. But before directing the user, a record is saved about the click, ip of the browser, location, …etc.

If it is not possible, what about firebase? Can that be achived? At places like Render or, I can do it since I have the full privileges of a backend server.

I have tried a redirect link using JavaScript, something like…

window.addEventListener('load', () => {
  window.location = "";

This way, I haven’t recorded anything, just a redirect!