/Alle spalle di XYZ/ is the version that is nowadays mostly used, and it literally means:
behind XYZ,.
Examples:
-- C'e un orso alle tue spalle, scappa!
-- Alle spalle del Monte Terminillo, vicino a Roma, c'e` il piccolo paese di Leonessa
It is clear the direction when XYZ is a human being (i.e. in the direction that the person can't see), but when XYZ is a thing /alle spalle/ could be ambiguous.
I everyday usage, this is the literally meaning.
The usual metaphorical meaning is 'not seen by XYZ', 'something done secretely', as in:
- Il mio collega Marco, di cui mi fidavo (whom I trusted) ha fatto un piano alle mie spalle per prendere il mio posto.