On round layers I attach the ribbon in the back with some piping gel. If you take your time you can just wrap the ribbon around the tier and not use anything to "glue" it to the layer. I think a major thing is to make sure the cake layer is as close to perfectly vertical as possible.
On square layers I put dabs of icing or piping gel at the corners to make sure the ribbon doesn't move.
Good Luck and I'm sure you will get a lot of helpful hints on this one!