So last night an interesting idea popped into my head, a simple solution to help you track who visited your GitHub profile. I began thinking of an approach and finally settled on pixel tracking [→].
which means I will give you an image tag to embed in your GitHub profile README.md ie:
With this when someone lands on your page and their browser tries to get the image from my server I will collect all their browser info and use it to provide you analytics, so their IP helps me know their location, user agent [→] to get their device details, language, (Ethics aside for now :)) etc.
Also since the width and height of the image are set to 0 they won't even see that it's there, very straightforward.
This morning I decided to test this out on my own profile [↗] and I learned something interesting I never thought of.
The above is what I got back,
github-camo was sent back as the user agent [→]. so I googled it. It turns out to be a proxy server [→] setup by GitHub, https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/about-anonymized-urls.
So basically GitHub requests resources on behalf of the user so I can't get info from the visitor's browser. So even the IP I get back is the one from GitHub's server and not the visitor.
I knew Gmail had this kind of implementation to prevent pixel tracking but I always thought GitHub, Twitter, etc masked URLs using domains like githubusercontent.com just for CDN purposes, I never thought it was more than just that.
I am keeping this in mind for future work I will be doing that involves allowing people to embed or share URLs.
But on the real though, GitHub should give us profile analytics just like they do with repos. :)
Here is another article you might like 😊 "No time to learn a static site generator? Try this"