This question already has an answer here:
The Shield Guardian has the following feature:
Spell Storing. A spellcaster who wears the shield guardian's amulet can cause the guardian to store one spell of 4th level or lower. To do so, the wearer must cast the spell on the guardian. The spell has no effect but is stored within the guardian. When commanded to do so by the wearer or when a situation arises that was predefined by the spellcaster, the guardian casts the stored spell with any parameters set by the original caster, requiring no components. When the spell is cast or a new spell is stored, any previously stored spell is lost.
I'm unsure what the bolded phrase requires/means. Does the spell just needs to target the Guardian for it to be stored? What counts as casting a spell on a Shield Guardian? What are the criteria for whether or not a spell can be stored in a Shield Guardian?