> without it knowing that it is incognito somehow
It has been a while since I was in js land but I do recall writing a browser extension that needed to know this, and in chrome it was made available to detect whether your script was running in incognito. It was a property of something.
So I imagine as a starting point the Google Analytics client js could utilize this to avoid interacting with the analytics server altogether.