Analytics - Disable only in editor

Hello. I couldn’t find any topics that ask this question, so I’ll ask it here.

Is there an easy way to stop Unity Analytics from tracking data from within the editor? We have an alpha version of our game out for testing, and I we’re only interested in what our testers are doing, not what we are doing when we’re working on the game. I know that I could turn off analytics, but that also turns off In-App purchases and produces a lot of errors due to exclusion of required libraries from the project, and handling all that isn’t a good way to go about it.

So is there a good way to handle this so that editor data doesn’t get mixed with actual test users’ data.

you could surround the code that you want to only run / not run in editor with precompiler directives

such as

   // do unity editor only stuff
// do non - editor only code

see Unity - Manual: Conditional Compilation for more information