Here's how I do it. What I like about this setup is that it's just one render and I get a pure selection mask, an RGBa image with the shadow included. You could even have an additional mask with the object and shadow. Whatever you like. I've done other where I have 10 passes, all done with one render and has everything from individual lights (if you set up LightMix), to reflections, bloom and glare, etc.
Don't hesitate to ask more questions.