Pip just gave attention naturally when he was learning to heel. And I never really taught Maisy to heel well, so... with Squash I started by click/treating one step at a time - literally, one physical step with attention at a time - and gradually shot for more in a row. Very gradually, with lots of practice. Lots of practice. So much practice.
To get his attention... sometimes I lured, sometimes I carry a squeaky toy and let him have it after a few successful steps, sometimes I just talk to him - and I'm pretty sure there are certain phrases that have evolved into cues over time. And *I* try to maintain attention to *him* as well, which seems to keep him engaged.
And a LOT of premack with distractions on the ground - practicing just out of reach of, say, a new toy on the ground and then he gets to have the toy only after a few successful passes by it. He's really, really nosy and something as simple as a piece of paper on the ground over in the corner can distract him for an entire rally course. Premack has been the most successful with polishing his attention for that kind of OMG WHAT IS THAT THING OVER THERE I MUST SEE IT stuff. It's still our biggest challenge, though, along with novel environments.
Also, his attention while heeling seemed to REALLY take off when I started doing Rally, and especially when I taught him to back up in heel position. I think partially just because he learned he needs to pay attention because otherwise he never really knew what we were going to do, and partially because he really, really loves to back up... sometimes I actually even use backing up or spinning in a backwards circle as a "reward" for a string of nice heeling which sounds crazy but he loves it so much that hey, why not.