Gems in defense battles?

I got a gem once for a defense victory. At first I assumed it might be a glitch or something, but in another thread someone else mentioned it happening to them as well. Is there some formula to this? Is it a freak occurrence? I don’t remember seeing anything about winning gems for successful defenses in patch notes or anything, but I’m really curious to see if this is actually a thing.

It is a feature that is suppose to happen and has always been in effect since defend rewards started. It is suppose to reward 1 gem for every 7+ cascade the AI makes on your behalf. The formula in which it payouts does not seem to coincide with gems actually earned though, otherwise most people would get a gem or two from defends most every reset; whereas in actuality, most people have never received one and if so only one ever.

Maybe when you get a defense victory and you (well, the AI) gets a 7-gem cascade, instead of a treasure map you get a gem, like it was before. It never happened to me tho, just throwing an idea out there

It is also suppose to reward keys when the AI happens to get a key from matching, but that one not occurring is a lot more understandable than 7+ cascades.

Actually I get a lot more keys from gem matches than treasure maps from cascades (when attacking of course)

It depends on your type of team. Gem spawns and board manipulation get more gems than other builds.