Here's how to avoid tracking page views in Google Analytics when you're logged in as an administrative or other specific user.
This solution presupposes that your Google Analytics tracking snippet is pasted into the field labelled "At end of the HEAD" in the Custom HTML section in the Confluence Administration Area as shown below...
Before modification, your Google Analytics tracking code should look something like this.
Now, to avoid tracking pages for an administrative user (or any particular user or set of users, for that matter), you can wrap the ga() function calls in an IF check. In the following code, we use the Confluence AJS object to determine whether or not the authenticated user is an administrative user. If that's true, we do not reach the ga() functions and thus, the pageview is not tracked. In all other cases, however, the pageview will be tracked.
You could use console.log statements to test this in your local browser.
If you want to avoid logging page views for specific users, you can check for specific user names with AJS.params.remoteUser.
Blog:Avoid Tracking Google Analytics Page Views for Admin or Specific Users in Atlassian Confluence (Cody Burleson's Weblog)
Blog:Confluence Panel Macro (Cody Burleson's Weblog)
Blog:Create an Atlassian Confluence plugin (Cody Burleson's Weblog)