Another way to do it:
Every action frame, the ‘death’ part of the events list has all the units that were destroyed. You could accumulate these, that’s what I do. No need to compare game states.
EDIT: The frame info documentation is in the community contributions thread, and also here: :pink_encryptor: Frame Info Documentation