I didn't glue mine anywhere. I used stainless screws and washers to install it. (you cannot see them) The reason? When it gets wet I can rip it all out and let it dry in the sun. It never gets wet, but, you never know.
If you want to glue it in you should use a 3M type carpet glue or if your careful an aerosol adhesive. Just make sure you coat the carpet and the car (both sides).