I was following this tutorial
https://www.youtube.com/watch?v=CVPcT0dJmoY&t=346s
which is a bit old but I was able to get it through the camera tracking and to the point of adding 3d objects to the scene via the "setup tracking scene" in the movie clip editor. However, while the cube (layer 1) has a shadow cast on it, there is no shadow cast on the ground (layer 2).
It seems to cast it onto the plane but not onto the background image. In the tutorial, there is a problem with his compositing but mine seems to be set up correctly but I still can't figure out how to fix it. Can anyone see the problem? I checked his compositing nodes and they seem to be the same arrangement as mine. Can anyone help me?
Here is a screenshot of my attempt to use the Blender Render fix suggested in one of cegaton's links

I switched over to Cycles and used shadow catcher which worked on one level, but now I'm stumped again. I can see the shadow in the render window but when I render it out to an animation there was no shadow. In the screenshot below you can see the rendered output at the bottom with no shadow and the render window in the top right with a shadow. I rendered it as a .png sequence. Not sure what I did wrong. Thanks for your help so far and I hope you can help me figure this out.