Some background info:
I've set up a page rule in CloudFlare at a certain URL (on the same domain), let's say /track-referral
This page rule instantly redirects visitors to our website's homepage. What I'd like to be able to do is track exactly what number (and preferably proportion) of visitors land on the homepage having visited the redirect URL first.
I can think of ways to manually do this by reading the HTTP referer header (I'm assuming it's managed by CloudFlare) but I'm already using both Google Analytics and Hotjar. I'd imagine GA is going to be the way forward but nothing's intuitive there, I've looked around a bit and not managed to find anything matching my objective that works.
If your /track-referral page loads client-side code
fire a normal GA page view tracking and then in reporting have a look at your pageviews for your homepage with a secondary dimension of 'full referrer'
Append some UTM parameters to the /track-referral URL to populate the campaign, source and medium reports in GA which you can use to see how people ended up on your homepage.
If your /track-referral page does not load any client-side code
/track-referral
URL and then your server side script should pass on the UTM parameters when it redirects e.g. instead of redirecting to /index.html
it should redirect to /index.html?utm_source=cloudflare&utm_medium=redirect
Note: in my experience you cannot reliably modify your header info to attempt to spoof the referrer when redirecting from your /track-referral
page.
You can override the referrer that GA records, so if your homepage knew it has been accessed via cloudflare then you could overwrite it (see docs here) but then your reporting is not a true reflection of your user's journey as /track-referral
is ignored. I don't think this benefits you above the solutions noted above.