Shadow collector material for composure

Question about compositing characters onto media plates: what’s the ideal way to handle shadows and reflections?
For instance, in the attached image, what’s the recommended way to composite the character’s shadow over the media plate while knocking out the rest of the shadow collector object?

Looking to recreate functionality similar to this.

I’ve been experimenting with a material expression (using forward renderer so shadow information will be available during shading pass):

return Square(Texture2DSampleLevel(LightAttenuationTexture, LightAttenuationTextureSampler, UV, 0));

but I’m not getting results I expect, and this method wouldn’t be useful for capturing reflections.

What’s the right way to do this?