Any way to have a global variable across shortcodes?

I’d like to migrate my hugo blog to zola. For this, I want to implement citations without JavaScript.
The interface is inspired by hugo-cite, which works as follows.
In the text, whenever you want to cite something, you do {{ cite(who="CitationKey") }} and at the very end of a page, simply {{ bibliography(cited=true) }}
If cited parameter of the bibliography shortcode is true, only the cited keys should appear, while with false, all entries of the bibtex should be dumped.
The issue with the “only those entries that were cited”-functionality is that the cite shortcodes need to somehow keep track what has been cited, so that in bibliography we know what’s been cited and what not.
set_global does not work, since it sets the variable locally to the current shortcode’s context, instead of globally for all shortcodes (imo a good thing).
I’m now asking whether you know any way to extend e.g. page.extra with custom data or encode in any other way somehow the information of cited entries.
Thanks in advance,

No, shortcodes cannot communicate with the outside world in any way