Simply fork, configure, and create your own custom tracked links!
Example: My GitHub Profile
This step can be skipped if you already have an account. link tracking uses GA to collect and store data.
Instructions to Setup Google Analytics
Make copy of this repo. link tracking uses GitHub Pages to collect data and redirect users.
Set the gaID
field in link.js
of your forked repo. This ID is used by Google to direct Analytics Events such as link clicks to your account.
const config = {
gaID: 'UA-46933211-3', // CHANGE ME
// ...
};
Analytics ID can be found in the Admin panel on Google Analytics.
How to Find Google Analytics ID
GitHub Pages will serve the link tracking and forwarding repo for free!
How to Setup GitHub Pages for a Repository
Links can now be created using <username>.github.io/link/?l=<url>
, and clicks can be viewed in the "Events" section of Google Analytics. To view in Realtime select "Realtime > Events" in the GA menu.
Github pages can be configured to a custom domain name - currently I use kevingleason.me/link), which allows creation of tracked links to have a custom name.
How to Setup a Custom Domain with GitHub Pages
This link tracking is as accurate as Google Analytics. If browsers block Google Analytics, the resulting clicks will not be accurately tracked. In these cases, the redirect will still work just fine after a 1-second timeout.