Tracking User Interactions in Google Analytics for a Website Opened via an iFrame from a Captive Portal
-
I'm facing an issue where I can't track user interactions on the client’s website when it is opened through a captive portal. The site loads inside an iFrame, and even though I added all required URLs (including google-analytics.com) to the Allowed Hostnames, Google Analytics still doesn't record any events. I suspect the main problem is related to captive-portal restrictions. Has anyone found a solution to make GA tracking work in this scenario?
-
No.
-
@_malek said in Tracking User Interactions in Google Analytics for a Website Opened via an iFrame from a Captive Portal:
I added all required URLs (including google-analytics.com) to the Allowed Hostnames, Google Analytics still doesn't record any events
When you add "Allowed Hostname" to the portal, a DNS lookup is performed and an ( 1 !! ) IPv4 is rteurn so the pf firewall can filter to 'allow'.
Remember : a firewall can ='can't filter hos names. Just "IP addresses" (see for yourself : [what is in an Ethernet packet header]( what is in an Ethernet packet header)).
Gues what : "Google Analytics" isn't one IPv4 - it changes all the time, as that site (service) is used by billions any moment thousands of times per second (everybody want to do Google Analytics for some reason) so the load is DNS pre distributed / balanced over a lot of (major understatement) IPv4 addresses.https://docs.netgate.com/pfsense/en/latest/captiveportal/allowed-hostnames.html :

If you manage to get them all, and you add all the possible IPv4s to the "Allowed IP Addresses" list, it might work.