Does anyone know a good catch-all for Linux user agents? I have a scenario where I need to block Google Tag Manager tags from firing for Linux users. The goal is to prevent Linux data from reaching Google Analytics. I don't want to impact Android users. I expect I could do something where I match on Linux while doing a negative lookahead for Android, but I'm not sure if I will be missing some scenarios. Any recommendations?
Asked
Active
Viewed 132 times
1 Answers
0
No need to limit yourself to a trigger based on a built-in variable. In this case, you want to actually have a CJS variable that would take into account not just the useragent, but the viewport too to make sure mobile resolutions would be exceptions from any useragent-based logic you have.
And since we're on JS level now, no need to try and fit all logic in one regex.
As a precaution, you can build a user-agent report in GA comparing a time period before your change to the time period after your change. GA will graciously highlight losers so you'll see what adjustments to your logic are to be had.

BNazaruk
- 6,300
- 3
- 19
- 33
-
I'm not sure mobile resolutions would need to be a factor. I actually have limitations for involving custom JS that make a regex ideal. – Synk Dive Oct 05 '22 at 15:14