First of all, you won't be able to create a plugin you want only using API. Because plugins are server-sided and, currently, there is no known way to open a new browser tab on client's PC.
Secondly, i suggest you to join our Discord server.
Hm, it's weird. But try APrimalStructure::Destroyed instead of Die, it returns ID of the structure owner for sure.
Also, you can usually get faster response if you join API Discord.