How can I disable some scripts for admin users

There’s no way inside of a Ghost theme, the Staff User system used for the admin area is completely separate to facilitate caching and improve security.

The best route is to use the internal traffic filtering options google analytics gives you.

If you can’t use those, you may be able to use some client-side scripts to query the Admin API to detect if an admin session cookie exists and only inject the script when there’s no session but it’s not optimal, it will slow down the script insertion and it’s not foolproof due to browser’s privacy mechanisms blocking cross-site request cookies. There’s some old discussion for how to do that in this topic:

1 Like