@_malek said in I cannot used google analytics for captive portal:
I know DNS and DHCP work as expected, but standard GA scripts seem completely blocked in this pre-auth phase.
The device using the GA (?) script, or the GA script isn't portal aware.
Be aware : most of the portal support isn't what pfSense does. The actual portal support must be build into the device you use. Most recent OS's are portal aware, but there can still be 'programs' (processes) that 'see' the Ethernet interface is 'up' so a 'Internet' connection' must be there. This is a wrong assumption.
You don't do "Google Analytics" or anything else for that matter before the user has been authenticated on the portal.
Like unlocking your phone before using it, or leaving the toilet before unlocking the door.
@_malek said in I cannot used google analytics for captive portal:
or is it technically impossible due to browser/portal restrictions?
A good browser is portal aware by itself.
Stupid browser plugins might exists that break this. That's not new.
@_malek said in I cannot used google analytics for captive portal:
or is it technically impossible
The portal can have "Allowed IPs" and "allowed host names" lists : these two destinations types - both are eventually the same : a list with IPs - will pass through the portal firewall even when the user (device) hasn't been granted portal access yet. So it's a matter of 'find all the IPs' and your done.
The thing is : you want to use services from the "big ones" (Meta, Google, Microsoft, Apple, etc) and that is hard. These guys have thousands of IPs, entire AS sections, and they swap them in and out all the time.
Basically, what you are trying to do isn't the correct way.
If you have to use "Google Analytics" because, for example, you sold your user's device Internet usage to Google, don't put these devices behind a portal.
Or tell the users that they should connect first, and then and only then they can do what they have to do. Like : before driving a car, they have to start it first. They'll understand.
The portal is just a concept that gives you the control "who us using your Internet resources".
For example, I have a hotel, so I want to offer an Internet connection to my hotel clients as an extra service. Not everybody surrounding the hotel. After all, I am still somewhat (more or less) responsable for what these stranger 'do' with 'my' connection.
Ones connected, the entire 'Internet' opens up for them. They can even launch nukes if they have the credentials to do so. What they are doing isn't my business.
If needed, I can route all portal traffic out over a VPN connection, so my hotel visitors , who use my ISP WAN IP (!) won't blacklist my (static) WAN IP. This rarely happens though, as the portal ads - I think - a strange effect to them : they think they are watched ^^